Skip to content

Commit

Permalink
Resolve notification_module bug on macosx using native apple utility
Browse files Browse the repository at this point in the history
  • Loading branch information
kostino committed Nov 25, 2020
1 parent 72c0c73 commit 5b73b61
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/notification_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
# Usage: !notification "Notification Content"
# Dependencies: plyer

import os
import asyncio
from plyer import notification as notifier

from plyer import utils as plyerUtils

async def notification(ctx, txt):
await ctx.send("Sending Notification: " + txt)
notifier.notify(title='Chimera Notification',
# Bypass plyer bug on macosx and use already included applescript
if plyerUtils.platform == 'macosx':
os.system("osascript -e 'display notification \"{}\"\'".format(txt))
else:
notifier.notify(title='Chimera Notification',
message=txt,
app_name="Chimera",
app_icon="icon.ico",
Expand Down

0 comments on commit 5b73b61

Please sign in to comment.