aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Mark <[email protected]>2020-10-01 09:21:41 -0700
committerGravatar GitHub <[email protected]>2020-10-01 09:21:41 -0700
commitfefe77e43eae35b8a2e80781cd13f5bf6b9efdad (patch)
tree3bc177325aa704a123257ea083cf97f5c426494b
parentMerge pull request #1199 from python-discord/bug/backend/1181/wait-for-deleti... (diff)
parentDuck pond: ignore reaction events from other guilds (diff)
Merge pull request #1201 from python-discord/bug/fun/1183/pond-ignore-dm
Duck pond: ignore reactions in DMs
-rw-r--r--bot/exts/fun/duck_pond.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bot/exts/fun/duck_pond.py b/bot/exts/fun/duck_pond.py
index 6c2d22b9c..82084ea88 100644
--- a/bot/exts/fun/duck_pond.py
+++ b/bot/exts/fun/duck_pond.py
@@ -145,6 +145,10 @@ class DuckPond(Cog):
amount of ducks specified in the config under duck_pond/threshold, it will
send the message off to the duck pond.
"""
+ # Ignore other guilds and DMs.
+ if payload.guild_id != constants.Guild.id:
+ return
+
# Was this reaction issued in a blacklisted channel?
if payload.channel_id in constants.DuckPond.channel_blacklist:
return
@@ -154,6 +158,9 @@ class DuckPond(Cog):
return
channel = discord.utils.get(self.bot.get_all_channels(), id=payload.channel_id)
+ if channel is None:
+ return
+
message = await channel.fetch_message(payload.message_id)
member = discord.utils.get(message.guild.members, id=payload.user_id)
@@ -175,7 +182,13 @@ class DuckPond(Cog):
@Cog.listener()
async def on_raw_reaction_remove(self, payload: RawReactionActionEvent) -> None:
"""Ensure that people don't remove the green checkmark from duck ponded messages."""
+ # Ignore other guilds and DMs.
+ if payload.guild_id != constants.Guild.id:
+ return
+
channel = discord.utils.get(self.bot.get_all_channels(), id=payload.channel_id)
+ if channel is None:
+ return
# Prevent the green checkmark from being removed
if payload.emoji.name == "✅":