Bugfix if guild not initialized yet and no reactions

This commit is contained in:
Jeremy Zhang 2019-01-05 20:54:50 +00:00
parent ec80761a5f
commit e566276fc4
2 changed files with 7 additions and 3 deletions

View File

@ -229,6 +229,7 @@ class Titan(discord.AutoShardedClient):
me = channel.guild.get_member(self.user.id) me = channel.guild.get_member(self.user.id)
if channel.permissions_for(me).read_messages: if channel.permissions_for(me).read_messages:
message = await channel.get_message(message_id) message = await channel.get_message(message_id)
if len(message.reactions):
await self.on_reaction_add(message.reactions[0], None) await self.on_reaction_add(message.reactions[0], None)
async def on_raw_reaction_remove(self, payload): async def on_raw_reaction_remove(self, payload):

View File

@ -139,8 +139,11 @@ class RedisQueue:
guild = self.bot.get_guild(int(params["guild_id"])) guild = self.bot.get_guild(int(params["guild_id"]))
query = params["query"] query = params["query"]
result = None result = None
if guild:
members = guild.members members = guild.members
if len(query) > 5 and query[-5] == '#': else:
members = None
if members and len(query) > 5 and query[-5] == '#':
potential_discriminator = query[-4:] potential_discriminator = query[-4:]
result = discord.utils.get(members, name=query[:-5], discriminator=potential_discriminator) result = discord.utils.get(members, name=query[:-5], discriminator=potential_discriminator)
if not result: if not result: