From d4381c597371d8052efe6f2c46ced4df8dc6f989 Mon Sep 17 00:00:00 2001 From: twhaley6 Date: Thu, 25 Apr 2019 12:11:39 -0400 Subject: riddle easter questions added --- bot/resources/easter/easter_riddle.json | 82 +++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 bot/resources/easter/easter_riddle.json (limited to 'bot') diff --git a/bot/resources/easter/easter_riddle.json b/bot/resources/easter/easter_riddle.json new file mode 100644 index 00000000..069d727a --- /dev/null +++ b/bot/resources/easter/easter_riddle.json @@ -0,0 +1,82 @@ +[ + { + "question": "What kind of music do bunnies like?", + "riddles": [ + "two words", + "jump to the beat" + ], + "correct_answer": "Hip hop" + }, + { + "question": "What kind of jewelry do rabbits wear?", + "riddles": [ + "they can eat it too", + "14 ___ gold" + ], + "correct_answer": "14 carrot gold" + }, + { + "question": "What does the easter bunny get for making a basket?", + "riddles": [ + "KOBE!", + "1+1 = ?" + ], + "correct_answer": "2 points!" + }, + { + "question": "Where does the easter bunny eat breakfast?", + "riddles": [ + "No waffles here", + "An international home" + ], + "correct_answer": "IHOP" + }, + { + "question": "What do you call a rabbit with fleas?", + "riddles": [ + "A bit of a looney tune", + "What's up Doc?" + ], + "correct_answer": "Bugs Bunny" + }, + { + "question": "Why was the little girl sad after the race?", + "riddles": [ + "2nd place?", + "Who beat her?" + ], + "correct_answer": "Because an egg beater!" + }, + { + "question": "What happened to the Easter Bunny when he misbehaved at school?", + "riddles": [ + "Won't be back anymore", + "Worse than suspension" + ], + "correct_answer": "He was eggspelled." + }, + { + "question": "What kind of bunny can't hop?", + "riddles": [ + "Might melt in the sun", + "Fragile and Yummy" + ], + "correct_answer": "A chocolate one!" + }, + { + "question": "Where does the Easter Bunny get his eggs?", + "riddles": [ + "Not a bush or tree", + "Emoji for a body part" + ], + "correct_answer": "Eggplants" + }, + { + "question": "Why did the Easter Bunny have to fire the duck?", + "riddles": [ + "quack", + "MY EGGS!!!" + ], + "correct_answer": "He kept quacking the eggs!" + } +] \ No newline at end of file -- cgit v1.2.3 From 052db73f2747d75b28df190bf2cf20782ed85a82 Mon Sep 17 00:00:00 2001 From: twhaley6 Date: Fri, 26 Apr 2019 16:29:51 -0400 Subject: easter riddle .py created --- bot/seasons/easter/easter_riddle.py | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 bot/seasons/easter/easter_riddle.py (limited to 'bot') 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") -- cgit v1.2.3 From 6de1c25335d818928e594edddbf715451a4506c5 Mon Sep 17 00:00:00 2001 From: twhaley6 Date: Fri, 26 Apr 2019 16:59:06 -0400 Subject: added user input checks --- bot/seasons/easter/easter_riddle.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index 0fff5542..2562fa17 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -23,6 +23,7 @@ class EasterRiddle(commands.Cog): def __init__(self, bot): self.bot = bot self.quiz_messages = {} + self.mention = " " @commands.command(aliases=["riddlemethis", "riddleme"]) async def riddle(self, ctx): @@ -38,30 +39,41 @@ class EasterRiddle(commands.Cog): q_embed = discord.Embed(title=question, description=description, colour=Colours.pink) - msg = await ctx.send(embed=q_embed) + await ctx.send(embed=q_embed) await asyncio.sleep(TIMELIMIT) """ - a_embed = discord.Embed( + h_embed = discord.Embed( title=f"Here's a hint: {hints[0]}!", colour=Colours.pink ) - msg = await ctx.send(embed=q_embed) + await ctx.send(embed=h_embed) await asyncio.sleep(TIMELIMIT) - a_embed = discord.Embed( - title=f"Here's a hint: {hints[0]}!", + h_embed = discord.Embed( + title=f"Here's a hint: {hints[1]}!", colour=Colours.pink ) + + await ctx.send(embed=h_embed) + await asyncio.sleep(TIMELIMIT) """ + content = f"Well done {mention} for getting it correct!" if mention else "Nobody got it right..." + a_embed = discord.Embed( title=f"The answer is: {correct}!", colour=Colours.pink ) - await ctx.send(embed=a_embed) + await ctx.send(content, embed=a_embed) + + @commands.Cog.listener() + async def on_message(self, message): + if message.lower() == self.correct.lower(): + self.mention = message.author + def setup(bot): -- cgit v1.2.3 From 69811b9fdaeb79758439ef5768ca60ab2fe9f529 Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Fri, 26 Apr 2019 17:09:23 -0400 Subject: fixed some errors in easter_riddle --- bot/seasons/easter/easter_riddle.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index 2562fa17..7a76e203 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 = 10 +TIMELIMIT = 20 class EasterRiddle(commands.Cog): @@ -24,6 +24,7 @@ class EasterRiddle(commands.Cog): self.bot = bot self.quiz_messages = {} self.mention = " " + self.correct = "" @commands.command(aliases=["riddlemethis", "riddleme"]) async def riddle(self, ctx): @@ -60,7 +61,7 @@ class EasterRiddle(commands.Cog): await asyncio.sleep(TIMELIMIT) """ - content = f"Well done {mention} for getting it correct!" if mention else "Nobody got it right..." + content = f"Well done {self.mention} for getting it correct!" if self.mention else "Nobody got it right..." a_embed = discord.Embed( title=f"The answer is: {correct}!", @@ -71,7 +72,7 @@ class EasterRiddle(commands.Cog): @commands.Cog.listener() async def on_message(self, message): - if message.lower() == self.correct.lower(): + if message.content.lower() == self.correct.lower(): self.mention = message.author -- cgit v1.2.3 From 0d88fdd2f28bde5d0c6dce6877b5abd9b39286a7 Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Fri, 26 Apr 2019 17:11:29 -0400 Subject: removed punctuation from riddles --- bot/resources/easter/easter_riddle.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'bot') diff --git a/bot/resources/easter/easter_riddle.json b/bot/resources/easter/easter_riddle.json index 069d727a..f32b5258 100644 --- a/bot/resources/easter/easter_riddle.json +++ b/bot/resources/easter/easter_riddle.json @@ -21,7 +21,7 @@ "KOBE!", "1+1 = ?" ], - "correct_answer": "2 points!" + "correct_answer": "2 points" }, { "question": "Where does the easter bunny eat breakfast?", @@ -45,7 +45,7 @@ "2nd place?", "Who beat her?" ], - "correct_answer": "Because an egg beater!" + "correct_answer": "Because an egg beater" }, { "question": "What happened to the Easter Bunny when he misbehaved at school?", @@ -53,7 +53,7 @@ "Won't be back anymore", "Worse than suspension" ], - "correct_answer": "He was eggspelled." + "correct_answer": "He was eggspelled" }, { "question": "What kind of bunny can't hop?", @@ -61,7 +61,7 @@ "Might melt in the sun", "Fragile and Yummy" ], - "correct_answer": "A chocolate one!" + "correct_answer": "A chocolate one" }, { "question": "Where does the Easter Bunny get his eggs?", @@ -77,6 +77,6 @@ "quack", "MY EGGS!!!" ], - "correct_answer": "He kept quacking the eggs!" + "correct_answer": "He kept quacking the eggs" } -] \ No newline at end of file +] -- cgit v1.2.3 From e6d53a15c6152807443e63c63b6d67333be231b1 Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Fri, 26 Apr 2019 17:48:53 -0400 Subject: added answer parsing and pining winner --- bot/seasons/easter/easter_riddle.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'bot') 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 -- cgit v1.2.3 From 120fa538166eb6fbaa40579633c0d5694cb8199e Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Fri, 26 Apr 2019 18:06:02 -0400 Subject: finalized riddles and fixed various easter_riddle bugs --- bot/resources/easter/easter_riddle.json | 12 ++++++------ bot/seasons/easter/easter_riddle.py | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'bot') diff --git a/bot/resources/easter/easter_riddle.json b/bot/resources/easter/easter_riddle.json index f32b5258..e93f6dad 100644 --- a/bot/resources/easter/easter_riddle.json +++ b/bot/resources/easter/easter_riddle.json @@ -2,15 +2,15 @@ { "question": "What kind of music do bunnies like?", "riddles": [ - "two words", - "jump to the beat" + "Two words", + "Jump to the beat" ], "correct_answer": "Hip hop" }, { "question": "What kind of jewelry do rabbits wear?", "riddles": [ - "they can eat it too", + "They can eat it too", "14 ___ gold" ], "correct_answer": "14 carrot gold" @@ -59,7 +59,7 @@ "question": "What kind of bunny can't hop?", "riddles": [ "Might melt in the sun", - "Fragile and Yummy" + "Fragile and yummy" ], "correct_answer": "A chocolate one" }, @@ -74,8 +74,8 @@ { "question": "Why did the Easter Bunny have to fire the duck?", "riddles": [ - "quack", - "MY EGGS!!!" + "Quack", + "MY EGGS!!" ], "correct_answer": "He kept quacking the eggs" } diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index 18b4c31d..6b2ab5ca 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -60,7 +60,7 @@ class EasterRiddle(commands.Cog): await asyncio.sleep(TIMELIMIT) if self.winner != " ": - content = "Well done " + self.winner + " for getting it correct!" + content = "Well done " + self.winner + "for getting it correct!" else: content = "Nobody got it right..." @@ -75,8 +75,9 @@ class EasterRiddle(commands.Cog): @commands.Cog.listener() async def on_message(self, message): - if message.content.lower() == self.correct.lower(): - self.winner = message.author.mention + if self.bot.user != message.author: + if message.content.lower() == self.correct.lower(): + self.winner = self.winner + message.author.mention + " " -- cgit v1.2.3 From 2bb744fb58723355ba46e06a74706bca059631fd Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Fri, 26 Apr 2019 18:17:22 -0400 Subject: changes to meet flake8 --- bot/seasons/easter/easter_riddle.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index 6b2ab5ca..ced09dae 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -55,7 +55,7 @@ class EasterRiddle(commands.Cog): title=f"Here's a hint: {hints[1]}!", colour=Colours.pink ) - + await ctx.send(embed=h_embed) await asyncio.sleep(TIMELIMIT) @@ -77,12 +77,10 @@ class EasterRiddle(commands.Cog): async def on_message(self, message): if self.bot.user != message.author: if message.content.lower() == self.correct.lower(): - self.winner = self.winner + message.author.mention + " " - + self.winner = self.winner + message.author.mention + " " def setup(bot): """Cog load.""" - bot.add_cog(EasterRiddle(bot)) log.info("Easter Riddle bot loaded") -- cgit v1.2.3 From 131643d489f4f11ce7ea0316ab8bcd0062b9cb97 Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Mon, 17 Jun 2019 13:03:59 -0400 Subject: most changes requested implemented, fixed linting errors --- bot/seasons/easter/easter_riddle.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index ced09dae..65d94e5c 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -23,17 +23,15 @@ class EasterRiddle(commands.Cog): def __init__(self, bot): self.bot = bot self.quiz_messages = {} - self.winner = " " + self.winner = "" self.correct = "" @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 - - """ + """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"] + question = random_question["question"] + hints = random_question["riddles"] self.correct = random_question["correct_answer"] description = f"You have {TIMELIMIT} seconds before the first hint.\n\n" @@ -59,8 +57,8 @@ class EasterRiddle(commands.Cog): await ctx.send(embed=h_embed) await asyncio.sleep(TIMELIMIT) - if self.winner != " ": - content = "Well done " + self.winner + "for getting it correct!" + if not self.winner: + content = f"Well done {self.winner} for getting it correct!" else: content = "Nobody got it right..." @@ -71,10 +69,11 @@ class EasterRiddle(commands.Cog): await ctx.send(content, embed=a_embed) - self.winner = " " + self.winner = "" @commands.Cog.listener() async def on_message(self, message): + """If a non-bot user enters a correct answer, their username gets added to self.winner""" if self.bot.user != message.author: if message.content.lower() == self.correct.lower(): self.winner = self.winner + message.author.mention + " " -- cgit v1.2.3 From 6f01cdf7ec7f71d32e547cf259c5af42b7fec543 Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Mon, 17 Jun 2019 16:01:31 -0400 Subject: fixed winner list format and self.winner bool --- bot/seasons/easter/easter_riddle.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index 65d94e5c..d3efdc43 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -23,7 +23,7 @@ class EasterRiddle(commands.Cog): def __init__(self, bot): self.bot = bot self.quiz_messages = {} - self.winner = "" + self.winner = [] self.correct = "" @commands.command(aliases=["riddlemethis", "riddleme"]) @@ -57,8 +57,10 @@ class EasterRiddle(commands.Cog): await ctx.send(embed=h_embed) await asyncio.sleep(TIMELIMIT) - if not self.winner: - content = f"Well done {self.winner} for getting it correct!" + if self.winner: + win_list = " " + win_list = win_list.join(self.winner) + content = f"Well done {win_list} for getting it correct!" else: content = "Nobody got it right..." @@ -76,7 +78,7 @@ class EasterRiddle(commands.Cog): """If a non-bot user enters a correct answer, their username gets added to self.winner""" if self.bot.user != message.author: if message.content.lower() == self.correct.lower(): - self.winner = self.winner + message.author.mention + " " + self.winner.append(message.author.mention) def setup(bot): -- cgit v1.2.3 From bf75c4dbf08f22e138ce145452f7738e8c836f5f Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Mon, 17 Jun 2019 16:24:55 -0400 Subject: fix variables and typo --- bot/seasons/easter/easter_riddle.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index d3efdc43..747c6cdc 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -22,8 +22,7 @@ class EasterRiddle(commands.Cog): def __init__(self, bot): self.bot = bot - self.quiz_messages = {} - self.winner = [] + self.winners = [] self.correct = "" @commands.command(aliases=["riddlemethis", "riddleme"]) @@ -57,10 +56,10 @@ class EasterRiddle(commands.Cog): await ctx.send(embed=h_embed) await asyncio.sleep(TIMELIMIT) - if self.winner: - win_list = " " - win_list = win_list.join(self.winner) + if self.winners: + win_list = " ".join(self.winners) content = f"Well done {win_list} for getting it correct!" + self.winners = [] else: content = "Nobody got it right..." @@ -71,14 +70,12 @@ class EasterRiddle(commands.Cog): await ctx.send(content, embed=a_embed) - self.winner = "" - @commands.Cog.listener() async def on_message(self, message): - """If a non-bot user enters a correct answer, their username gets added to self.winner""" + """If a non-bot user enters a correct answer, their username gets added to self.winners""" if self.bot.user != message.author: if message.content.lower() == self.correct.lower(): - self.winner.append(message.author.mention) + self.winners.append(message.author.mention) def setup(bot): -- cgit v1.2.3 From adc6457aa3496c1606b0728231d4f0f5131207ed Mon Sep 17 00:00:00 2001 From: JackyFWong Date: Sun, 7 Jul 2019 15:40:58 -0400 Subject: implemented one-at-a-time execution policy --- bot/seasons/easter/easter_riddle.py | 77 +++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 34 deletions(-) (limited to 'bot') diff --git a/bot/seasons/easter/easter_riddle.py b/bot/seasons/easter/easter_riddle.py index 747c6cdc..2cae299a 100644 --- a/bot/seasons/easter/easter_riddle.py +++ b/bot/seasons/easter/easter_riddle.py @@ -24,58 +24,67 @@ class EasterRiddle(commands.Cog): self.bot = bot self.winners = [] self.correct = "" + self.current_channel = None @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 = random_question["question"] - hints = random_question["riddles"] - self.correct = random_question["correct_answer"] + if not self.current_channel: + self.current_channel = ctx.message.channel - description = f"You have {TIMELIMIT} seconds before the first hint.\n\n" + random_question = random.choice(RIDDLE_QUESTIONS) + question = random_question["question"] + hints = random_question["riddles"] + self.correct = random_question["correct_answer"] - q_embed = discord.Embed(title=question, description=description, colour=Colours.pink) + description = f"You have {TIMELIMIT} seconds before the first hint.\n\n" - await ctx.send(embed=q_embed) - await asyncio.sleep(TIMELIMIT) + q_embed = discord.Embed(title=question, description=description, colour=Colours.pink) - h_embed = discord.Embed( - title=f"Here's a hint: {hints[0]}!", - colour=Colours.pink - ) + await ctx.send(embed=q_embed) + await asyncio.sleep(TIMELIMIT) - await ctx.send(embed=h_embed) - await asyncio.sleep(TIMELIMIT) + h_embed = discord.Embed( + title=f"Here's a hint: {hints[0]}!", + colour=Colours.pink + ) - h_embed = discord.Embed( - title=f"Here's a hint: {hints[1]}!", - colour=Colours.pink - ) + await ctx.send(embed=h_embed) + await asyncio.sleep(TIMELIMIT) - await ctx.send(embed=h_embed) - await asyncio.sleep(TIMELIMIT) + h_embed = discord.Embed( + title=f"Here's a hint: {hints[1]}!", + colour=Colours.pink + ) - if self.winners: - win_list = " ".join(self.winners) - content = f"Well done {win_list} for getting it correct!" - self.winners = [] - else: - content = "Nobody got it right..." + await ctx.send(embed=h_embed) + await asyncio.sleep(TIMELIMIT) + + if self.winners: + win_list = " ".join(self.winners) + content = f"Well done {win_list} for getting it correct!" + self.winners = [] + else: + content = "Nobody got it right..." - a_embed = discord.Embed( - title=f"The answer is: {self.correct}!", - colour=Colours.pink - ) + a_embed = discord.Embed( + title=f"The answer is: {self.correct}!", + colour=Colours.pink + ) - await ctx.send(content, embed=a_embed) + await ctx.send(content, embed=a_embed) + + self.current_channel = None @commands.Cog.listener() async def on_message(self, message): """If a non-bot user enters a correct answer, their username gets added to self.winners""" - if self.bot.user != message.author: - if message.content.lower() == self.correct.lower(): - self.winners.append(message.author.mention) + if self.current_channel == message.channel: + if self.bot.user != message.author: + if message.content.lower() == self.correct.lower(): + self.winners.append(message.author.mention) + else: + return def setup(bot): -- cgit v1.2.3