Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
Update discord.py version
Browse files Browse the repository at this point in the history
There were some breaking changes to on_raw_reaction_add that needed
to be addressed.
  • Loading branch information
jgayfer committed May 26, 2018
1 parent eb19985 commit 93760fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cogs/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,34 +145,34 @@ async def list_events(self, guild):
await events_channel.send("There are no upcoming events.")


async def on_raw_reaction_add(self, emoji, message_id, channel_id, user_id):
async def on_raw_reaction_add(self, payload):
"""If a reaction represents a user RSVP, update the DB and event message"""
channel = self.bot.get_channel(channel_id)
channel = self.bot.get_channel(payload.channel_id)
if isinstance(channel, discord.abc.PrivateChannel):
return
try:
message = await channel.get_message(message_id)
message = await channel.get_message(payload.message_id)
except:
return

guild = channel.guild
member = guild.get_member(user_id)
member = guild.get_member(payload.user_id)
deleted = None

# We check that the user is not the message author as to not count
# the initial reactions added by the bot as being indicative of attendance
if is_event(message) and member != message.author:
title = message.embeds[0].title
if emoji.name == "\N{WHITE HEAVY CHECK MARK}":
if payload.emoji.name == "\N{WHITE HEAVY CHECK MARK}":
await self.set_attendance(member, guild, 1, title, message)
elif emoji.name == "\N{CROSS MARK}":
elif payload.emoji.name == "\N{CROSS MARK}":
await self.set_attendance(member, guild, 0, title, message)
elif emoji.name == "\N{SKULL}":
elif payload.emoji.name == "\N{SKULL}":
deleted = await self.delete_event(guild, title, member, channel)

if not deleted:
try:
await message.remove_reaction(emoji, member)
await message.remove_reaction(payload.emoji, member)
except:
pass

Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ pymysql==0.7.11
pytz==2017.2
psutil==5.3.1
aioredis==0.3.5
yarl<1.2
-e git://github.com/rapptz/discord.py.git@6b75179c1fed1aac0304526d130e93ad21dc84c3#egg=discord.py

0 comments on commit 93760fe

Please sign in to comment.