aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar JackyFWong <[email protected]>2019-04-26 17:48:53 -0400
committerGravatar JackyFWong <[email protected]>2019-04-26 17:48:53 -0400
commite6d53a15c6152807443e63c63b6d67333be231b1 (patch)
tree0fae3ac7b2d00dc9be8c2213690e4de287db09b2 /bot
parentremoved punctuation from riddles (diff)
added answer parsing and pining winner
Diffstat (limited to 'bot')
-rw-r--r--bot/seasons/easter/easter_riddle.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py
index 7a76e203..18b4c31d 100644
--- a/bot/seasons/easter/easter_riddle.py
+++ b/bot/seasons/easter/easter_riddle.py
@@ -14,7 +14,7 @@ log = logging.getLogger(__name__)
with open(Path('bot', 'resources', 'easter', 'easter_riddle.json'), 'r', encoding="utf8") as f:
RIDDLE_QUESTIONS = load(f)
-TIMELIMIT = 20
+TIMELIMIT = 10
class EasterRiddle(commands.Cog):
@@ -23,7 +23,7 @@ class EasterRiddle(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.quiz_messages = {}
- self.mention = " "
+ self.winner = " "
self.correct = ""
@commands.command(aliases=["riddlemethis", "riddleme"])
@@ -34,7 +34,7 @@ class EasterRiddle(commands.Cog):
"""
random_question = random.choice(RIDDLE_QUESTIONS)
question, hints = random_question["question"], random_question["riddles"]
- correct = random_question["correct_answer"]
+ self.correct = random_question["correct_answer"]
description = f"You have {TIMELIMIT} seconds before the first hint.\n\n"
@@ -43,7 +43,6 @@ class EasterRiddle(commands.Cog):
await ctx.send(embed=q_embed)
await asyncio.sleep(TIMELIMIT)
- """
h_embed = discord.Embed(
title=f"Here's a hint: {hints[0]}!",
colour=Colours.pink
@@ -59,21 +58,25 @@ class EasterRiddle(commands.Cog):
await ctx.send(embed=h_embed)
await asyncio.sleep(TIMELIMIT)
- """
- content = f"Well done {self.mention} for getting it correct!" if self.mention else "Nobody got it right..."
+ if self.winner != " ":
+ content = "Well done " + self.winner + " for getting it correct!"
+ else:
+ content = "Nobody got it right..."
a_embed = discord.Embed(
- title=f"The answer is: {correct}!",
+ title=f"The answer is: {self.correct}!",
colour=Colours.pink
)
await ctx.send(content, embed=a_embed)
+ self.winner = " "
+
@commands.Cog.listener()
async def on_message(self, message):
if message.content.lower() == self.correct.lower():
- self.mention = message.author
+ self.winner = message.author.mention