Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

J maynor/issue23 #33

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dolores.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from configload import config
from modules import *
from notify import notif

intents = discord.Intents.all()
intents.members = True
Expand Down Expand Up @@ -64,6 +65,7 @@ async def on_command_error(ctx, error):
if isinstance(error, (commands.CommandNotFound)):
await ctx.send(text_instance.generate_snarky_comment())
else:
notif.notify(f"Error: {error}")
print(error, file=sys.stderr)


Expand Down
22 changes: 22 additions & 0 deletions notify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from datetime import datetime

import apprise

from configload import config


class Notifier:
def __init__(self, apprise_endpoints: list[str]):
self.apobj = apprise.Apprise()
if apprise_endpoints:
[self.apobj.add(x) for x in apprise_endpoints]

def notify(self, message: str):
return self.apobj.notify(
body=f"{message}"
f'Datetime: {datetime.now().strftime("%m/%d/%Y %H:%M:%S")}',
title="Dolores",
)


notif = Notifier(config["DISCORD"]["apprise_endpoints"])
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pyyaml==6.0.1
yt-dlp==2024.3.10
py-cord[voice]==2.5.0
openai==1.13.3
apprise==1.7.4