✨ converted hangman to buttons
This commit is contained in:
@ -16,7 +16,7 @@ from discord.ext import commands # Used to compare errors with command
|
||||
# errors
|
||||
|
||||
from discord_slash.context import SlashContext, ComponentContext
|
||||
from gwendolyn.utils.util_functions import emoji_to_command
|
||||
from gwendolyn.utils.util_functions import emoji_to_command, decode_id
|
||||
|
||||
|
||||
class EventHandler():
|
||||
@ -79,37 +79,32 @@ class EventHandler():
|
||||
params = [message, f"#{user.id}", column-1]
|
||||
await self.bot.games.connect_four.place_piece(*params)
|
||||
|
||||
|
||||
elif tests.hangman_reaction_test(*reaction_test_parameters):
|
||||
self.bot.log("They reacted to the hangman message")
|
||||
if ord(reaction.emoji) in range(127462, 127488):
|
||||
# The range is letter-emojis
|
||||
guess = chr(ord(reaction.emoji)-127397)
|
||||
# Converts emoji to letter
|
||||
params = [message, f"#{user.id}", guess]
|
||||
await self.bot.games.hangman.guess(*params)
|
||||
else:
|
||||
self.bot.log("Bot they didn't react with a valid guess")
|
||||
|
||||
async def on_component(self, ctx: ComponentContext):
|
||||
info = ctx.custom_id.split(":")
|
||||
info = decode_id(ctx.custom_id)
|
||||
channel = ctx.origin_message.channel
|
||||
|
||||
if info[0] == "plex":
|
||||
if info[1] == "movie":
|
||||
if info[0].lower() == "plex":
|
||||
if info[1].lower() == "movie":
|
||||
await self.bot.other.plex.add_movie(
|
||||
ctx.origin_message,
|
||||
info[2],
|
||||
not isinstance(channel, discord.DMChannel)
|
||||
)
|
||||
|
||||
if info[1] == "show":
|
||||
elif info[1].lower() == "show":
|
||||
await self.bot.other.plex.add_show(
|
||||
ctx.origin_message,
|
||||
info[2],
|
||||
not isinstance(channel, discord.DMChannel)
|
||||
)
|
||||
|
||||
elif info[0].lower() == "hangman":
|
||||
if str(ctx.author_id) == info[2]:
|
||||
if info[1].lower() == "guess":
|
||||
await self.bot.games.hangman.guess(ctx, *info[3:])
|
||||
elif info[1].lower() == "end":
|
||||
await self.bot.games.hangman.stop(ctx, *info[3:])
|
||||
|
||||
|
||||
class ErrorHandler():
|
||||
"""
|
||||
|
Reference in New Issue
Block a user