diff options
| author | 2019-03-03 21:50:01 -0500 | |
|---|---|---|
| committer | 2019-03-03 21:50:01 -0500 | |
| commit | b53d8d8b7fe7c33c6931fa9075c30c27ea9c02da (patch) | |
| tree | 92ab3e99bebbc0b0dac06571d1e2e6d30f2622cf /bot/seasons/halloween/candy_collection.py | |
| parent | Merge pull request #112 from RohanJnr/be-my-valentine-iceman (diff) | |
Add new Cog class inheritance & event listener decoration
Mitigates recent breaking d.py changes
Diffstat (limited to 'bot/seasons/halloween/candy_collection.py')
| -rw-r--r-- | bot/seasons/halloween/candy_collection.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/seasons/halloween/candy_collection.py b/bot/seasons/halloween/candy_collection.py index 80f30a1b..d75e0d94 100644 --- a/bot/seasons/halloween/candy_collection.py +++ b/bot/seasons/halloween/candy_collection.py @@ -20,7 +20,7 @@ ADD_SKULL_REACTION_CHANCE = 50 # 2% ADD_SKULL_EXISTING_REACTION_CHANCE = 20 # 5% -class CandyCollection: +class CandyCollection(commands.Cog): def __init__(self, bot): self.bot = bot with open(json_location) as candy: @@ -31,6 +31,7 @@ class CandyCollection: userid = userinfo['userid'] self.get_candyinfo[userid] = userinfo + @commands.Cog.listener() async def on_message(self, message): """ Randomly adds candy or skull to certain messages @@ -54,6 +55,7 @@ class CandyCollection: self.msg_reacted.append(d) return await message.add_reaction('\N{CANDY}') + @commands.Cog.listener() async def on_reaction_add(self, reaction, user): """ Add/remove candies from a person if the reaction satisfies criteria |