Skip to content

Commit

Permalink
pl
Browse files Browse the repository at this point in the history
  • Loading branch information
tookender committed Nov 10, 2024
1 parent 5a1ad09 commit ef7fda1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion extensions/utility/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ class UtilityBase(commands.Cog):
def __init__(self, bot: Korii):
self.bot = bot
self.description = "😎 | Lots of useful utility commands."
self.active_games = {}
10 changes: 6 additions & 4 deletions extensions/utility/vocab.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@
"Ich treibe Sport/ klettere / spiele Gitarre.": "Je fais du sport / de l'escalade / de la guitare."
}

active_games = {}

class VocabularyCommand(UtilityBase):
@commands.command(name="vocab")
async def vocab(self, ctx):
if ctx.author.id in self.active_games:
if ctx.author.id in active_games:
await ctx.send("You are already in a game. Type 'stop' to end it.")
return

self.active_games[ctx.author.id] = True
active_games[ctx.author.id] = True
await ctx.send("Starting the vocabulary game! Type 'stop' to end it.")

while self.active_games.get(ctx.author.id):
while active_games.get(ctx.author.id):
german_phrase = random.choice(list(vocabulary.keys()))
french_answer = vocabulary[german_phrase]

Expand All @@ -51,7 +53,7 @@ def check(m):
msg = await self.bot.wait_for("message", check=check)

if msg.content.lower() == "stop":
del self.active_games[ctx.author.id]
del active_games[ctx.author.id]
await ctx.send("Game stopped.")
return

Expand Down

0 comments on commit ef7fda1

Please sign in to comment.