Files
Gwendolyn/cogs/ReactionCog.py
NikolajDanger 05fe122777 🗃️ Moves gameLoops.py
2020-08-06 23:38:14 +02:00

28 lines
1.0 KiB
Python

from discord.ext import commands
from funcs import logThis, fiarReactionTest, monopolyReactionTest, emojiToCommand, fiar, runMonopoly
class ReactionCog(commands.Cog):
def __init__(self, client):
"""Listens for reactions."""
self.client = client
@commands.Cog.listener()
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))
try:
fourInARowTheirTurn, piece = fiarReactionTest(channel,message,"#"+str(user.id))
except:
fourInARowTheirTurn = False
if fourInARowTheirTurn:
place = emojiToCommand(reaction.emoji)
await fiar(channel," place "+str(piece)+" "+str(place),user.id)
elif monopolyReactionTest(channel,message):
await runMonopoly(channel,"roll","#"+str(user.id))
def setup(client):
client.add_cog(ReactionCog(client))