diff options
| author | 2019-03-14 15:07:18 +0000 | |
|---|---|---|
| committer | 2019-03-14 15:07:18 +0000 | |
| commit | a13ac5ec8127595401c44623b7b46c694adb2a4b (patch) | |
| tree | 6fbbecf750cbe750689e4723a3dcb7c0d085dc67 /bot/seasons/valentines/pickuplines.py | |
| parent | Merge pull request #138 from python-discord/docker-fix (diff) | |
Pickup Lines
Includes the File for the cog containing the command in addition to the JSON file containing the list of pickup lines
Diffstat (limited to 'bot/seasons/valentines/pickuplines.py')
| -rw-r--r-- | bot/seasons/valentines/pickuplines.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/bot/seasons/valentines/pickuplines.py b/bot/seasons/valentines/pickuplines.py new file mode 100644 index 00000000..bb4721e9 --- /dev/null +++ b/bot/seasons/valentines/pickuplines.py @@ -0,0 +1,43 @@ +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__) + + +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! + """ + with open(Path('bot', 'resources', 'valentines', 'pickup_lines.json'), 'r', encoding="utf8") as f: + pickup_lines = load(f) + 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.debug('Pickup line cog loaded') |