diff options
| author | 2019-02-07 15:34:55 +0530 | |
|---|---|---|
| committer | 2019-02-07 15:34:55 +0530 | |
| commit | 38d72e2539382a602bbd4e93a27b56715b584ddc (patch) | |
| tree | 48770f479b2d68d3e3439904421188ce25e1bfa6 /bot/seasons | |
| parent | Merge pull request #99 from python-discord/config-update (diff) | |
I have finished working on the issue #101 SaveTheDate command.i have added around 30 date ideas(using json file to store data).We can add more if needed later.
Diffstat (limited to 'bot/seasons')
| -rw-r--r-- | bot/seasons/valentines/savethedate.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bot/seasons/valentines/savethedate.py b/bot/seasons/valentines/savethedate.py new file mode 100644 index 00000000..25631a7c --- /dev/null +++ b/bot/seasons/valentines/savethedate.py @@ -0,0 +1,37 @@ +import logging +from json import load +from pathlib import Path +import random + +import discord +from discord.ext import commands + + +log = logging.getLogger(__name__) + +emoji = [":heart:", ":couple_with_heart:", ":gift_heart: :revolving_hearts:", ":sparkling_heart:", ":two_hearts:" ] + +class SaveTheDate: + """ + A cog to change a invokers nickname to a spooky one! + """ + + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def savethedate(self, ctx): + with open(Path('bot', 'resources', 'valentines', 'date_ideas.json'), 'r', encoding="utf8") as f: + data = load(f) + date_idea = random.choice(data['ideas']) + emoji_1 = random.choice(emoji) + emoji_2 = random.choice(emoji) + embed = discord.Embed(title=date_idea['name'], + description=f"{emoji_1}{date_idea['description']}{emoji_2}", + colour=0x01d277) + await ctx.send(embed=embed) + + +def setup(bot): + bot.add_cog(SaveTheDate(bot)) + log.debug("Save the date cog loaded") |