diff options
| author | 2019-03-15 18:29:35 +0100 | |
|---|---|---|
| committer | 2019-03-15 18:29:35 +0100 | |
| commit | c4b48c8d343a2cf9fb55ba1616e65deccdc3ea0d (patch) | |
| tree | 5d0cd201595a4e97d5a07e5076ef0245d5fd6309 /bot/seasons | |
| parent | Merge pull request #138 from python-discord/docker-fix (diff) | |
| parent | Requested Changes (diff) | |
Merge pull request #140 from Suhail6inkling/pickup-lines
Pickup Lines
Diffstat (limited to 'bot/seasons')
| -rw-r--r-- | bot/seasons/valentines/pickuplines.py | 44 | 
1 files changed, 44 insertions, 0 deletions
diff --git a/bot/seasons/valentines/pickuplines.py b/bot/seasons/valentines/pickuplines.py new file mode 100644 index 00000000..4462478f --- /dev/null +++ b/bot/seasons/valentines/pickuplines.py @@ -0,0 +1,44 @@ +import logging +import random +from json import load +from pathlib import Path + +import discord +from discord.ext import commands + +from bot.constants import Colours + +log = logging.getLogger(__name__) + +with open(Path('bot', 'resources', 'valentines', 'pickup_lines.json'), 'r', encoding="utf8") as f: +    pickup_lines = load(f) + + +class PickupLine: +    """ +    A cog that gives random cheesy pickup lines. +    """ + +    def __init__(self, bot): +        self.bot = bot + +    @commands.command() +    async def pickupline(self, ctx): +        """ +        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) + + +def setup(bot): +    bot.add_cog(PickupLine(bot)) +    log.info('Pickup line cog loaded')  |