Fixed a few bugs (#72)

This commit is contained in:
Flame442
2019-10-09 21:32:39 -04:00
committed by aikaterna
parent 82c33359b1
commit 85dee0ad8b

View File

@@ -32,16 +32,16 @@ class PressF(commands.Cog):
except asyncio.TimeoutError:
return await ctx.send("You took too long to reply.")
answer = pressf.content
answer = pressf.content[:1900]
message = await ctx.send(
f"Everyone, let's pay respects to **{answer}**! Press the f reaction on the this message to pay respects."
)
await message.add_reaction("\U0001f1eb")
self.channels[str(ctx.channel.id)] = []
self.channels[str(ctx.channel.id)] = {'msg_id': message.id, 'reacted': []}
await asyncio.sleep(120)
await message.delete()
amount = len(self.channels[str(ctx.channel.id)])
amount = len(self.channels[str(ctx.channel.id)]['reacted'])
word = "person has" if amount == 1 else "people have"
await ctx.channel.send(f"**{amount}** {word} paid respects to **{answer}**.")
del self.channels[str(ctx.channel.id)]
@@ -50,9 +50,11 @@ class PressF(commands.Cog):
async def on_reaction_add(self, reaction, user):
if str(reaction.message.channel.id) not in self.channels:
return
if self.channels[str(reaction.message.channel.id)]['msg_id'] != reaction.message.id:
return
if user.id == self.bot.user.id:
return
if str(user.id) not in self.channels[str(reaction.message.channel.id)]:
if user.id not in self.channels[str(reaction.message.channel.id)]['reacted']:
if str(reaction.emoji) == "\U0001f1eb":
await reaction.message.channel.send(f"**{user.display_name}** has paid respects.")
self.channels[str(reaction.message.channel.id)].append(user.id)
self.channels[str(reaction.message.channel.id)]['reacted'].append(user.id)