Skip to content

Commit

Permalink
Handle messages no longer existing in remove_subscribed_message
Browse files Browse the repository at this point in the history
Co-authored-by: Will Barber <[email protected]>
  • Loading branch information
raccube and WillB97 committed Aug 16, 2024
1 parent 8792a30 commit b3639af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,10 @@ async def remove_subscribed_message(self, msg: SubscribedMessage) -> None:
return
message = await msg_channel.fetch_message(msg.message_id)

chan_name = message.channel.name if hasattr(message.channel, 'name') else 'unknown channel'
print(f'Removing message in {chan_name} from {message.author.name}')
await message.delete() # remove message from discord
if message: # message may have already been deleted manually
chan_name = message.channel.name if hasattr(message.channel, 'name') else 'unknown channel'
print(f'Removing message in {chan_name} from {message.author.name}')
await message.delete() # remove message from discord

# remove message from subscription list and save to file
self.subscribed_messages.remove(msg)
Expand Down

0 comments on commit b3639af

Please sign in to comment.