diff options
| author | 2020-10-21 18:57:26 +0530 | |
|---|---|---|
| committer | 2020-10-21 18:57:26 +0530 | |
| commit | e4a9d370fe13e909c597e7ea1e8a0fc777fcee59 (patch) | |
| tree | 7c5b797c1f93a3b0b36cc4d4ef147afecf41a683 | |
| parent | send_spook_msg to staticmethod (diff) | |
Fix candy distribution logic
| -rw-r--r-- | bot/exts/halloween/candy_collection.py | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/bot/exts/halloween/candy_collection.py b/bot/exts/halloween/candy_collection.py index a5e2b02b..e1602137 100644 --- a/bot/exts/halloween/candy_collection.py +++ b/bot/exts/halloween/candy_collection.py @@ -96,20 +96,21 @@ class CandyCollection(commands.Cog):          if message.id in self.candy_messages and str(reaction.emoji) == EMOJIS['CANDY']:              self.candy_messages.remove(message.id) -            prev_record = self.candy_records.get(str(message.author.id), 0) -            self.candy_records[str(message.author.id)] = prev_record + 1 +            prev_record = self.candy_records.get(str(user.id), 0) +            self.candy_records[str(user.id)] = prev_record + 1          elif message.id in self.skull_messages and str(reaction.emoji) == EMOJIS['SKULL']:              self.skull_messages.remove(message.id) -            if (prev_record := self.candy_records.get(str(message.author.id))) is not None: +            # Skip if no past score exists or if it's 0 +            if prev_record := self.candy_records.get(str(user.id)):                  lost = min(random.randint(1, 3), prev_record) -                self.candy_records[str(message.author.id)] = prev_record - lost +                self.candy_records[str(user.id)] = prev_record - lost                  if lost == prev_record: -                    await CandyCollection.send_spook_msg(message.author, message.channel, 'all of your') +                    await CandyCollection.send_spook_msg(user, message.channel, 'all of your')                  else: -                    await CandyCollection.send_spook_msg(message.author, message.channel, lost) +                    await CandyCollection.send_spook_msg(user, message.channel, lost)          else:              return  # Skip saving | 
