diff options
| author | Rapptz <[email protected]> | 2016-10-17 01:10:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-03 09:51:52 -0500 |
| commit | 53ab2631252bf0977446d762f07b3821edb151ee (patch) | |
| tree | abb8a2e7a966aadb22df8a3ca2220b646eae3765 /discord/server.py | |
| parent | [commands] Bot skip check now works with the new __eq__ changes. (diff) | |
| download | discord.py-53ab2631252bf0977446d762f07b3821edb151ee.tar.xz discord.py-53ab2631252bf0977446d762f07b3821edb151ee.zip | |
Split channel types.
This splits them into the following:
* DMChannel
* GroupChannel
* VoiceChannel
* TextChannel
This also makes the channels "stateful".
Diffstat (limited to 'discord/server.py')
| -rw-r--r-- | discord/server.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/discord/server.py b/discord/server.py index 7d4cb468..d1523d6f 100644 --- a/discord/server.py +++ b/discord/server.py @@ -29,8 +29,8 @@ from .role import Role from .member import Member, VoiceState from .emoji import Emoji from .game import Game -from .channel import Channel -from .enums import ServerRegion, Status, try_enum, VerificationLevel +from .channel import * +from .enums import ServerRegion, Status, ChannelType, try_enum, VerificationLevel from .mixins import Hashable import copy @@ -273,7 +273,11 @@ class Server(Hashable): if 'channels' in data: channels = data['channels'] for c in channels: - channel = Channel(server=self, data=c, state=self._state) + if c['type'] == ChannelType.text.value: + channel = TextChannel(server=self, data=c, state=self._state) + else: + channel = VoiceChannel(server=self, data=c, state=self._state) + self._add_channel(channel) @utils.cached_slot_property('_default_role') |