aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/holidays/valentines/pickuplines.py
blob: 281f23dc1af22259f19e6055f17021dc9a8d4813 (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
34
35
36
37
38
39
40
41
import random
from json import loads
from pathlib import Path

import discord
from discord.ext import commands
from pydis_core.utils.logging import get_logger

from bot.bot import Bot
from bot.constants import Colours

log = get_logger(__name__)

PICKUP_LINES = loads(Path("bot/resources/holidays/valentines/pickup_lines.json").read_text("utf8"))


class PickupLine(commands.Cog):
    """A cog that gives random cheesy pickup lines."""

    @commands.command()
    async def pickupline(self, ctx: commands.Context) -> None:
        """
        Gives you a random pickup line.

        Note that most of them are very cheesy.
        """
        random_line = random.choice(PICKUP_LINES["lines"])
        embed = discord.Embed(
            title=":cheese: Your pickup line :cheese:",
            description=random_line["line"],
            color=Colours.pink
        )
        embed.set_thumbnail(
            url=random_line.get("image", PICKUP_LINES["placeholder"])
        )
        await ctx.send(embed=embed)


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