Skip to content

Commit 0a8bc8e

Browse files
authored
Merge pull request #979 from allthingslinux/fix-bookmarks
fix: Ensure the bookmarks service will only delete messages in DMs
2 parents dca3492 + 79f4e47 commit 0a8bc8e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tux/cogs/services/bookmarks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent) ->
7373
if payload.emoji.name in self.add_bookmark_emojis:
7474
await self.add_bookmark(user, message)
7575

76-
# If the emoji is the remove bookmark emoji, remove the bookmark
77-
elif payload.emoji.name in self.remove_bookmark_emojis:
76+
# Ensures were in a users DMs before removing (to fix an issue with being able to remove messages anywhere)
77+
if not isinstance(channel, discord.DMChannel):
78+
return
79+
80+
# If the emoji is the remove bookmark emoji and reaction is on the bot, remove the bookmark
81+
if payload.emoji.name in self.remove_bookmark_emojis and message.author is self.bot.user:
7882
await self.remove_bookmark(message)
7983

8084
async def add_bookmark(self, user: discord.User, message: discord.Message) -> None:

0 commit comments

Comments
 (0)