From 518a5678064f6d51dc7510c58cc6c05f8b03415b Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Sun, 3 Mar 2024 17:29:10 +0100 Subject: [PATCH] fix: bot crashing whenever someone disabled DMs and warning --- bot/app.py | 8 +++++--- bot/commands/SubscribeCommand.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bot/app.py b/bot/app.py index b59aed7..349d09f 100644 --- a/bot/app.py +++ b/bot/app.py @@ -28,9 +28,11 @@ async def time_to_bereal(): # Send message to all subscribers for subscriber in subscribers: - user = await app.fetch_user(subscriber.user_id) - await user.send(f"# :warning: Time to BeReal. :warning:\nCapture a BeReal and see what you friends are up to!\n") - + try: + user = await app.fetch_user(subscriber.user_id) + await user.send(f"# :warning: Time to BeReal. :warning:\nCapture a BeReal and see what you friends are up to!\n") + except: + pass app.time_to_bereal = time_to_bereal diff --git a/bot/commands/SubscribeCommand.py b/bot/commands/SubscribeCommand.py index f2ceeb1..50f7eab 100644 --- a/bot/commands/SubscribeCommand.py +++ b/bot/commands/SubscribeCommand.py @@ -17,7 +17,8 @@ class SubscribeCommand(commands.Cog): await interaction.response.send_message( ":information_source: You have been subscribed to **BeReal. notifications**\n\ :arrow_right: You will receive every day notifications whenever it's\ -time to BeReal.\n:warning: You may unsubscribe at any time using `/unsubscribe`.", +time to BeReal.\n:warning: You may unsubscribe at any time using `/unsubscribe`.\n\ +:red_circle: **Make sure you enabled DMs from this server!**", ephemeral=True, ) else: