Fix channel update not responding

This commit is contained in:
Jeremy Zhang 2018-03-22 23:07:52 +00:00
parent 034e14bd2e
commit 00d9a9a356
2 changed files with 3 additions and 2 deletions

View File

@ -162,7 +162,7 @@ class Titan(discord.AutoShardedClient):
await self.database.update_guild(channel.guild) await self.database.update_guild(channel.guild)
await self.socketio.on_channel_create(channel) await self.socketio.on_channel_create(channel)
async def on_channel_update(self, channelbefore, channelafter): async def on_guild_channel_update(self, channelbefore, channelafter):
await self.database.update_guild(channelafter.guild) await self.database.update_guild(channelafter.guild)
await self.socketio.on_channel_update(channelafter) await self.socketio.on_channel_update(channelafter)

View File

@ -2,6 +2,7 @@ import socketio
from titanembeds.utils import get_message_author, get_message_mentions, get_roles_list, get_attachments_list, get_embeds_list from titanembeds.utils import get_message_author, get_message_mentions, get_roles_list, get_attachments_list, get_embeds_list
import time import time
from email import utils as emailutils from email import utils as emailutils
import discord
class SocketIOInterface: class SocketIOInterface:
def __init__(self, bot, redis_uri): def __init__(self, bot, redis_uri):
@ -155,7 +156,7 @@ class SocketIOInterface:
await self.io.emit('CHANNEL_CREATE', data=chan, room=str("GUILD_"+str(channel.guild.id)), namespace='/gateway') await self.io.emit('CHANNEL_CREATE', data=chan, room=str("GUILD_"+str(channel.guild.id)), namespace='/gateway')
async def on_channel_update(self, channel): async def on_channel_update(self, channel):
if str(channel.type) not in ["text", "category"]: if not isinstance(channel, discord.channel.TextChannel) and not isinstance(channel, discord.channel.CategoryChannel):
return return
chan = self.get_formatted_channel(channel) chan = self.get_formatted_channel(channel)
await self.io.emit('CHANNEL_UPDATE', data=chan, room=str("GUILD_"+str(channel.guild.id)), namespace='/gateway') await self.io.emit('CHANNEL_UPDATE', data=chan, room=str("GUILD_"+str(channel.guild.id)), namespace='/gateway')