Fully converted to slash commands

This commit is contained in:
NikolajDanger
2021-03-31 00:38:51 +02:00
parent a8a7e5eabd
commit b345720468
50 changed files with 1102 additions and 1111 deletions

View File

@@ -1,28 +1,28 @@
from discord.ext import commands
from funcs import logThis, emojiToCommand
from utils import emojiToCommand
class ReactionCog(commands.Cog):
def __init__(self, client):
def __init__(self, bot):
"""Listens for reactions."""
self.client = client
self.bot = bot
@commands.Cog.listener()
async def on_reaction_add(self, reaction,user):
async def on_reaction_add(self, reaction, user):
if user.bot == False:
message = reaction.message
channel = message.channel
logThis(user.display_name+" reacted to a message",str(channel.id))
self.bot.log(f"{user.display_name} reacted to a message",str(channel.id), level = 10)
try:
connectFourTheirTurn, piece = self.client.funcs.connectFourReactionTest(channel,message,"#"+str(user.id))
connectFourTheirTurn, piece = self.bot.databaseFuncs.connectFourReactionTest(channel,message,"#"+str(user.id))
except:
connectFourTheirTurn = False
bedreNetflixMessage, addMovie, imdbIds = self.client.funcs.bedreNetflixReactionTest(channel,message)
bedreNetflixMessage, addMovie, imdbIds = self.bot.databaseFuncs.bedreNetflixReactionTest(channel, message)
if connectFourTheirTurn:
place = emojiToCommand(reaction.emoji)
await self.client.gameLoops.connectFour(message,"place "+str(piece)+" "+str(place),user.id, str(message.channel.id))
await self.bot.games.gameLoops.connectFour(message,"place "+str(piece)+" "+str(place),user.id, str(message.channel.id))
elif bedreNetflixMessage and addMovie:
moviePick = emojiToCommand(reaction.emoji)
await message.delete()
@@ -30,7 +30,7 @@ class ReactionCog(commands.Cog):
imdbID = None
else:
imdbID = imdbIds[moviePick-1]
await self.client.bedreNetflix.addMovie(channel,imdbID)
await self.bot.other.bedreNetflix.addMovie(channel,imdbID)
elif bedreNetflixMessage and not addMovie:
showPick = emojiToCommand(reaction.emoji)
await message.delete()
@@ -38,9 +38,9 @@ class ReactionCog(commands.Cog):
imdbName = None
else:
imdbName = imdbIds[showPick-1]
await self.client.bedreNetflix.addShow(channel,imdbName)
elif self.client.funcs.hangmanReactionTest(channel,message) and ord(reaction.emoji) in range(127462,127488):
await self.bot.other.bedreNetflix.addShow(channel,imdbName)
elif self.bot.databaseFuncs.hangmanReactionTest(channel,message) and ord(reaction.emoji) in range(127462,127488):
guess = chr(ord(reaction.emoji)-127397)
await self.client.gameLoops.runHangman(channel,"#"+str(user.id),command="guess "+guess)
def setup(client):
client.add_cog(ReactionCog(client))
await self.bot.games.gameLoops.runHangman(channel,"#"+str(user.id),command="guess "+guess)
def setup(bot):
bot.add_cog(ReactionCog(bot))