aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/pride/drag_queen_name.py
blob: d9424001bd8ca8fc321f399a0dd7d37d244d6e08 (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
29
30
31
32
33
import json
import logging
import random
from pathlib import Path

from discord.ext import commands

from bot.bot import Bot

log = logging.getLogger(__name__)


class DragNames(commands.Cog):
    """Gives a random drag queen name!"""

    def __init__(self):
        self.names = self.load_names()

    @staticmethod
    def load_names() -> list:
        """Loads a list of drag queen names."""
        with Path("bot/resources/pride/drag_queen_names.json").open(encoding="utf8") as f:
            return json.load(f)

    @commands.command(name="dragname", aliases=["dragqueenname", "queenme"])
    async def dragname(self, ctx: commands.Context) -> None:
        """Sends a message with a drag queen name."""
        await ctx.send(random.choice(self.names))


def setup(bot: Bot) -> None:
    """Load the Drag Names Cog."""
    bot.add_cog(DragNames())