aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/holidays/easter/traditions.py
blob: 3ac5617ca44f5e6d04677a462139e96d4f1a9a0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json
import logging
import random
from pathlib import Path

from discord.ext import commands

from bot.bot import Bot

log = logging.getLogger(__name__)

traditions = json.loads(Path("bot/resources/holidays/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."""

    @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]}")


async def setup(bot: Bot) -> None:
    """Load the Traditions Cog."""
    await bot.add_cog(Traditions())