1
0
Fork 0
mirror of synced 2024-05-07 06:02:24 +12:00

Test print

This commit is contained in:
Dan Hess 2020-11-07 15:30:13 -06:00
parent 3cb2c338ac
commit ed3892fe5f

View file

@ -9,7 +9,8 @@ class Games(commands.Cog):
self.running_games = collections.defaultdict(dict) self.running_games = collections.defaultdict(dict)
@commands.guild_only() @commands.guild_only()
@utils.can_run(send_messages=True) # @utils.can_run(send_messages=True)
@commands.is_owner()
@commands.command(aliases=["word_chain", "しりとり"]) @commands.command(aliases=["word_chain", "しりとり"])
async def shiritori(self, ctx, *, start_word): async def shiritori(self, ctx, *, start_word):
""" """
@ -48,17 +49,18 @@ class Games(commands.Cog):
last_letter = None last_letter = None
words_used = [] words_used = []
# Ensure only one game is happening at once
game = self.running_games["shiritori"].get(ctx.channel.id)
if game:
return await ctx.send("Only one game per channel!")
self.running_games["shiritori"][ctx.channel.id] = True
await ctx.send( await ctx.send(
f"Shiritori game started! First word is `{start_word}`, any responses after this" f"Shiritori game started! First word is `{start_word}`, any responses after this"
"count towards the game" "count towards the game"
) )
while True: while True:
# Ensure only one game is happening at once
game = self.running_games["shiritori"].get(ctx.channel.id)
if game:
return await ctx.send("Only one game per channel!")
self.running_games["shiritori"][ctx.channel.id] = True
# Grab the first letter of this new word and check it # Grab the first letter of this new word and check it
first_letter = grab_letter(message.content, last=False) first_letter = grab_letter(message.content, last=False)
# Include extra check for if this is the first word # Include extra check for if this is the first word
@ -79,7 +81,9 @@ class Games(commands.Cog):
# If we're here, then the last letter used was valid # If we're here, then the last letter used was valid
words_used.append(last_word) words_used.append(last_word)
await message.add_reaction("") await message.add_reaction("")
print(words_used, last_letter, last_author, last_word) await ctx.send(
f"{words_used} - {last_letter} - {last_author} - {last_word}"
)
message = await ctx.bot.wait_for("message", check=check) message = await ctx.bot.wait_for("message", check=check)
# If we're here, game over, someone messed up # If we're here, game over, someone messed up