Initial support for channel categories

This commit is contained in:
Jeremy Zhang
2017-09-09 21:46:00 +00:00
parent 1dad3f1d3a
commit 25cd964403
7 changed files with 86 additions and 17 deletions

View File

@ -149,7 +149,7 @@ class SocketIOInterface:
await self.io.emit('CHANNEL_CREATE', data=chan, room=str("GUILD_"+channel.server.id), namespace='/gateway')
async def on_channel_update(self, channel):
if str(channel.type) != "text":
if str(channel.type) not in ["text", "category"]:
return
chan = self.get_formatted_channel(channel)
await self.io.emit('CHANNEL_UPDATE', data=chan, room=str("GUILD_"+channel.server.id), namespace='/gateway')

View File

@ -64,7 +64,7 @@ def get_roles_list(guildroles):
def get_channels_list(guildchannels):
channels = []
for channel in guildchannels:
if str(channel.type) == "text":
if str(channel.type) in ["text", "category"]:
overwrites = []
for target, overwrite in channel.overwrites:
if isinstance(target, discord.Role):
@ -80,14 +80,17 @@ def get_channels_list(guildchannels):
"allow": allow,
"deny": deny,
})
parent = channel.parent
if parent:
parent = parent.id
channels.append({
"id": channel.id,
"name": channel.name,
"topic": channel.topic,
"position": channel.position,
"type": str(channel.type),
"permission_overwrites": overwrites
"permission_overwrites": overwrites,
"parent_id": parent,
})
return channels