diff options
| author | 2023-05-09 16:01:01 +0100 | |
|---|---|---|
| committer | 2023-05-09 16:01:01 +0100 | |
| commit | c3e23e60278d34658f801bd7d7ed721d5a272637 (patch) | |
| tree | e159a0fae7850d706d713cf2b49dfed2140ce655 /bot/exts/holidays/halloween/candy_collection.py | |
| parent | Bump sentry-sdk from 1.21.1 to 1.22.1 (#1273) (diff) | |
| parent | Move unshared contants inside modules (diff) | |
Merge pull request #1270 from python-discord/migrate-to-ruff
Migrate to ruff
Diffstat (limited to 'bot/exts/holidays/halloween/candy_collection.py')
| -rw-r--r-- | bot/exts/holidays/halloween/candy_collection.py | 15 | 
1 files changed, 7 insertions, 8 deletions
diff --git a/bot/exts/holidays/halloween/candy_collection.py b/bot/exts/holidays/halloween/candy_collection.py index 683114f9..ca68888b 100644 --- a/bot/exts/holidays/halloween/candy_collection.py +++ b/bot/exts/holidays/halloween/candy_collection.py @@ -1,6 +1,5 @@  import logging  import random -from typing import Union  import discord  from async_rediscache import RedisCache @@ -18,17 +17,17 @@ ADD_CANDY_EXISTING_REACTION_CHANCE = 10  # 10%  ADD_SKULL_REACTION_CHANCE = 50  # 2%  ADD_SKULL_EXISTING_REACTION_CHANCE = 20  # 5% -EMOJIS = dict( -    CANDY="\N{CANDY}", -    SKULL="\N{SKULL}", -    MEDALS=( +EMOJIS = { +    "CANDY": "\N{CANDY}", +    "SKULL": "\N{SKULL}", +    "MEDALS": (          "\N{FIRST PLACE MEDAL}",          "\N{SECOND PLACE MEDAL}",          "\N{THIRD PLACE MEDAL}",          "\N{SPORTS MEDAL}",          "\N{SPORTS MEDAL}",      ), -) +}  class CandyCollection(commands.Cog): @@ -69,7 +68,7 @@ class CandyCollection(commands.Cog):      @in_month(Month.OCTOBER)      @commands.Cog.listener() -    async def on_reaction_add(self, reaction: discord.Reaction, user: Union[discord.User, discord.Member]) -> None: +    async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User | discord.Member) -> None:          """Add/remove candies from a person if the reaction satisfies criteria."""          message = reaction.message          # check to ensure the reactor is human @@ -140,7 +139,7 @@ class CandyCollection(commands.Cog):      @staticmethod      async def send_spook_msg( -        author: discord.Member, channel: discord.TextChannel, candies: Union[str, int] +        author: discord.Member, channel: discord.TextChannel, candies: str | int      ) -> None:          """Send a spooky message."""          e = discord.Embed(colour=author.colour)  |