diff options
| author | 2021-05-17 12:50:04 -0500 | |
|---|---|---|
| committer | 2021-05-17 12:50:04 -0500 | |
| commit | a174b78114d4204e74e11a820ddf36f00d293112 (patch) | |
| tree | 9404dbf50e3f11c7c83b782733aa30d7d15fcae2 /bot/exts/easter/traditions.py | |
| parent | Remove comments and update docstrings (diff) | |
| parent | Merge pull request #726 from Objectivitix/main (diff) | |
Merge branch 'main' into http_status_command_randomness
Diffstat (limited to 'bot/exts/easter/traditions.py')
| -rw-r--r-- | bot/exts/easter/traditions.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/bot/exts/easter/traditions.py b/bot/exts/easter/traditions.py index 85b4adfb..93404f3e 100644 --- a/bot/exts/easter/traditions.py +++ b/bot/exts/easter/traditions.py @@ -5,19 +5,17 @@ from pathlib import Path from discord.ext import commands +from bot.bot import Bot + log = logging.getLogger(__name__) -with open(Path("bot/resources/easter/traditions.json"), "r", encoding="utf8") as f: - traditions = json.load(f) +traditions = json.loads(Path("bot/resources/easter/traditions.json").read_text("utf8")) class Traditions(commands.Cog): """A cog which allows users to get a random easter tradition or custom from a random country.""" - def __init__(self, bot: commands.Bot): - self.bot = bot - - @commands.command(aliases=('eastercustoms',)) + @commands.command(aliases=("eastercustoms",)) async def easter_tradition(self, ctx: commands.Context) -> None: """Responds with a random tradition or custom.""" random_country = random.choice(list(traditions)) @@ -25,6 +23,6 @@ class Traditions(commands.Cog): await ctx.send(f"{random_country}:\n{traditions[random_country]}") -def setup(bot: commands.Bot) -> None: - """Traditions Cog load.""" - bot.add_cog(Traditions(bot)) +def setup(bot: Bot) -> None: + """Load the Traditions Cog.""" + bot.add_cog(Traditions()) |