aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar twhaley6 <[email protected]>2019-04-26 16:29:51 -0400
committerGravatar twhaley6 <[email protected]>2019-04-26 16:29:51 -0400
commit052db73f2747d75b28df190bf2cf20782ed85a82 (patch)
treeb89dba24ce4d5b56fdb568ca96c3721eb1157c79 /bot
parentriddle easter questions added (diff)
easter riddle .py created
Diffstat (limited to 'bot')
-rw-r--r--bot/seasons/easter/easter_riddle.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py
new file mode 100644
index 00000000..0fff5542
--- /dev/null
+++ b/bot/seasons/easter/easter_riddle.py
@@ -0,0 +1,71 @@
+import asyncio
+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', 'easter', 'easter_riddle.json'), 'r', encoding="utf8") as f:
+ RIDDLE_QUESTIONS = load(f)
+
+TIMELIMIT = 10
+
+
+class EasterRiddle(commands.Cog):
+ """This cog contains the command for the Easter quiz!"""
+
+ def __init__(self, bot):
+ self.bot = bot
+ self.quiz_messages = {}
+
+ @commands.command(aliases=["riddlemethis", "riddleme"])
+ async def riddle(self, ctx):
+ """
+ Gives a random riddle questions, then provides 2 hints at 10 second intervals before revealing the answer
+
+ """
+ random_question = random.choice(RIDDLE_QUESTIONS)
+ question, hints = random_question["question"], random_question["riddles"]
+ correct = random_question["correct_answer"]
+
+ description = f"You have {TIMELIMIT} seconds before the first hint.\n\n"
+
+ q_embed = discord.Embed(title=question, description=description, colour=Colours.pink)
+
+ msg = await ctx.send(embed=q_embed)
+ await asyncio.sleep(TIMELIMIT)
+
+ """
+ a_embed = discord.Embed(
+ title=f"Here's a hint: {hints[0]}!",
+ colour=Colours.pink
+ )
+
+ msg = await ctx.send(embed=q_embed)
+ await asyncio.sleep(TIMELIMIT)
+
+ a_embed = discord.Embed(
+ title=f"Here's a hint: {hints[0]}!",
+ colour=Colours.pink
+ )
+ """
+
+ a_embed = discord.Embed(
+ title=f"The answer is: {correct}!",
+ colour=Colours.pink
+ )
+
+ await ctx.send(embed=a_embed)
+
+
+def setup(bot):
+ """Cog load."""
+
+ bot.add_cog(EasterRiddle(bot))
+ log.info("Easter Riddle bot loaded")