aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hedy Li <[email protected]>2021-10-29 02:45:48 +0000
committerGravatar Hedy Li <[email protected]>2021-10-29 02:45:48 +0000
commit36d8f996575d99e08256b0336ae75e9e491c381a (patch)
tree3fae5efbaa824aa957a39699075633f3cb2aa02c
parentMigrate to `og_blurple` (#924) (diff)
Candy Game: Ignore reactions to bot messages when adding candies
Check whether a reaction is for a bot message when adding candies upon reactions. Previously you could use bot's reaction buttons which would trigger `on_reaction_add` and have a high chance of getting candies (or skulls). It can easily be abused to spam reactions, which apparently doesn't trigger an auto-mute like spamming messages do, AFAIK. In any case, I don't really feel good about reactions triggering candies. Despite this fix, the game *can* still be abused (but I won't tell you how). Though this occuring by accident is less likely than before. Either figure it out yourself or don't try to cheat :P This patch can be tested using the `.snake antidote` game when you react to the recipe buttons. Using `.help` works too but it produces a lot of noise in the logs. Tic tac toe may be helpful as well. Anyway, you could just react to bot messages yourself.
-rw-r--r--bot/exts/holidays/halloween/candy_collection.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bot/exts/holidays/halloween/candy_collection.py b/bot/exts/holidays/halloween/candy_collection.py
index 079d900d..bb9c93be 100644
--- a/bot/exts/holidays/halloween/candy_collection.py
+++ b/bot/exts/holidays/halloween/candy_collection.py
@@ -83,6 +83,11 @@ class CandyCollection(commands.Cog):
# if its not a candy or skull, and it is one of 10 most recent messages,
# proceed to add a skull/candy with higher chance
if str(reaction.emoji) not in (EMOJIS["SKULL"], EMOJIS["CANDY"]):
+ # Ensure the reaction is not for a bot's message so users can't spam
+ # reaction buttons like in .help to get candies.
+ if message.author.bot:
+ return
+
recent_message_ids = map(
lambda m: m.id,
await self.hacktober_channel.history(limit=10).flatten()