aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/valentines/pickuplines.py
diff options
context:
space:
mode:
authorGravatar Rohan_Iceman <[email protected]>2019-03-27 21:09:23 +0530
committerGravatar GitHub <[email protected]>2019-03-27 21:09:23 +0530
commit463e7f9d757ce8142f23f67f55f3c41d4336ba56 (patch)
treefc3e6484b77907bc0158c271af26261d013ae508 /bot/seasons/valentines/pickuplines.py
parentMerge pull request #99 from python-discord/config-update (diff)
parentMerge pull request #132 from python-discord/dpy-cog-changes (diff)
Merge pull request #1 from python-discord/master
syncing fork
Diffstat (limited to 'bot/seasons/valentines/pickuplines.py')
-rw-r--r--bot/seasons/valentines/pickuplines.py44
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..e1abb4e5
--- /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(commands.Cog):
+ """
+ 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('PickupLine cog loaded')