aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/easter/traditions.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/easter/traditions.py')
-rw-r--r--bot/exts/easter/traditions.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/bot/exts/easter/traditions.py b/bot/exts/easter/traditions.py
new file mode 100644
index 00000000..9529823f
--- /dev/null
+++ b/bot/exts/easter/traditions.py
@@ -0,0 +1,31 @@
+import json
+import logging
+import random
+from pathlib import Path
+
+from discord.ext import commands
+
+log = logging.getLogger(__name__)
+
+with open(Path("bot/resources/easter/traditions.json"), "r", encoding="utf8") as f:
+ traditions = json.load(f)
+
+
+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',))
+ async def easter_tradition(self, ctx: commands.Context) -> None:
+ """Responds with a random tradition or custom."""
+ random_country = random.choice(list(traditions))
+
+ await ctx.send(f"{random_country}:\n{traditions[random_country]}")
+
+
+def setup(bot: commands.Bot) -> None:
+ """Traditions Cog load."""
+ bot.add_cog(Traditions(bot))
+ log.info("Traditions cog loaded")