diff options
| author | 2021-04-19 17:04:11 -0400 | |
|---|---|---|
| committer | 2021-04-19 17:04:11 -0400 | |
| commit | ae64ddd3e7d731a44a1684c93d67ea6334b120d2 (patch) | |
| tree | 8373f0171385d4065157ce0a4db5e686769ef272 /bot/exts/halloween/halloween_facts.py | |
| parent | Merge pull request #673 from janine9vn/int-eval (diff) | |
Clean Up the Halloween Season
- Change commands.Bot type hints to bot.Bot
- Remove the setting of Cog.bot if it isn't being used
- Use Bot.http_session instead of creating new ones
- Keep string quotes and Doc-Strings consistant
- Remove redundant/outdated code
Ignored spookyavatar.py as it is being moved in another PR.
Diffstat (limited to 'bot/exts/halloween/halloween_facts.py')
| -rw-r--r-- | bot/exts/halloween/halloween_facts.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bot/exts/halloween/halloween_facts.py b/bot/exts/halloween/halloween_facts.py index 7eb6d56f..139e0810 100644 --- a/bot/exts/halloween/halloween_facts.py +++ b/bot/exts/halloween/halloween_facts.py @@ -8,6 +8,8 @@ from typing import Tuple import discord from discord.ext import commands +from bot.bot import Bot + log = logging.getLogger(__name__) SPOOKY_EMOJIS = [ @@ -20,16 +22,15 @@ SPOOKY_EMOJIS = [ "\N{SKULL AND CROSSBONES}", "\N{SPIDER WEB}", ] -PUMPKIN_ORANGE = discord.Color(0xFF7518) +PUMPKIN_ORANGE = 0xFF7518 INTERVAL = timedelta(hours=6).total_seconds() class HalloweenFacts(commands.Cog): """A Cog for displaying interesting facts about Halloween.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - with open(Path("bot/resources/halloween/halloween_facts.json"), "r", encoding="utf8") as file: + def __init__(self): + with Path("bot/resources/halloween/halloween_facts.json").open("r", encoding="utf8") as file: self.halloween_facts = json.load(file) self.facts = list(enumerate(self.halloween_facts)) random.shuffle(self.facts) @@ -53,6 +54,6 @@ class HalloweenFacts(commands.Cog): return discord.Embed(title=title, description=fact, color=PUMPKIN_ORANGE) -def setup(bot: commands.Bot) -> None: - """Halloween facts Cog load.""" - bot.add_cog(HalloweenFacts(bot)) +def setup(bot: Bot) -> None: + """Load the Halloween Facts Cog.""" + bot.add_cog(HalloweenFacts()) |