mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-25 02:23:04 +00:00 
			
		
		
		
	| @@ -611,7 +611,7 @@ class GuildChannel: | |||||||
|         base_attrs['name'] = name or self.name |         base_attrs['name'] = name or self.name | ||||||
|         guild_id = self.guild.id |         guild_id = self.guild.id | ||||||
|         cls = self.__class__ |         cls = self.__class__ | ||||||
|         data = await self._state.http.create_channel(guild_id, self._type, reason=reason, **base_attrs) |         data = await self._state.http.create_channel(guild_id, self.type.value, reason=reason, **base_attrs) | ||||||
|         obj = cls(state=self._state, guild=self.guild, data=data) |         obj = cls(state=self._state, guild=self.guild, data=data) | ||||||
|  |  | ||||||
|         # temporarily add it to the cache |         # temporarily add it to the cache | ||||||
|   | |||||||
| @@ -133,6 +133,11 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable): | |||||||
|     async def _get_channel(self): |     async def _get_channel(self): | ||||||
|         return self |         return self | ||||||
|  |  | ||||||
|  |     @property | ||||||
|  |     def type(self): | ||||||
|  |         """:class:`ChannelType`: The channel's Discord type.""" | ||||||
|  |         return try_enum(ChannelType, self._type) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _sorting_bucket(self): |     def _sorting_bucket(self): | ||||||
|         return ChannelType.text.value |         return ChannelType.text.value | ||||||
| @@ -516,8 +521,9 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable): | |||||||
|         return self.guild.id, self.id |         return self.guild.id, self.id | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _type(self): |     def type(self): | ||||||
|         return ChannelType.voice.value |         """:class:`ChannelType`: The channel's Discord type.""" | ||||||
|  |         return ChannelType.voice | ||||||
|  |  | ||||||
|     def _update(self, guild, data): |     def _update(self, guild, data): | ||||||
|         self.guild = guild |         self.guild = guild | ||||||
| @@ -660,8 +666,9 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable): | |||||||
|         return ChannelType.category.value |         return ChannelType.category.value | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _type(self): |     def type(self): | ||||||
|         return ChannelType.category.value |         """:class:`ChannelType`: The channel's Discord type.""" | ||||||
|  |         return ChannelType.category | ||||||
|  |  | ||||||
|     def is_nsfw(self): |     def is_nsfw(self): | ||||||
|         """Checks if the category is NSFW.""" |         """Checks if the category is NSFW.""" | ||||||
| @@ -819,8 +826,9 @@ class StoreChannel(discord.abc.GuildChannel, Hashable): | |||||||
|         return ChannelType.text.value |         return ChannelType.text.value | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _type(self): |     def type(self): | ||||||
|         return ChannelType.store.value |         """:class:`ChannelType`: The channel's Discord type.""" | ||||||
|  |         return ChannelType.store | ||||||
|  |  | ||||||
|     def permissions_for(self, member): |     def permissions_for(self, member): | ||||||
|         base = super().permissions_for(member) |         base = super().permissions_for(member) | ||||||
| @@ -928,8 +936,9 @@ class DMChannel(discord.abc.Messageable, Hashable): | |||||||
|         return '<DMChannel id={0.id} recipient={0.recipient!r}>'.format(self) |         return '<DMChannel id={0.id} recipient={0.recipient!r}>'.format(self) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _type(self): |     def type(self): | ||||||
|         return ChannelType.private.value |         """:class:`ChannelType`: The channel's Discord type.""" | ||||||
|  |         return ChannelType.private | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def created_at(self): |     def created_at(self): | ||||||
| @@ -1041,8 +1050,9 @@ class GroupChannel(discord.abc.Messageable, Hashable): | |||||||
|         return '<GroupChannel id={0.id} name={0.name!r}>'.format(self) |         return '<GroupChannel id={0.id} name={0.name!r}>'.format(self) | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def _type(self): |     def type(self): | ||||||
|         return ChannelType.group.value |         """:class:`ChannelType`: The channel's Discord type.""" | ||||||
|  |         return ChannelType.group | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def icon_url(self): |     def icon_url(self): | ||||||
|   | |||||||
| @@ -367,7 +367,7 @@ class ConnectionState: | |||||||
|         message = Message(channel=channel, data=data, state=self) |         message = Message(channel=channel, data=data, state=self) | ||||||
|         self.dispatch('message', message) |         self.dispatch('message', message) | ||||||
|         self._messages.append(message) |         self._messages.append(message) | ||||||
|         if channel and channel._type in (0, 5): |         if channel and channel.__class__ is TextChannel: | ||||||
|             channel.last_message_id = message.id |             channel.last_message_id = message.id | ||||||
|  |  | ||||||
|     def parse_message_delete(self, data): |     def parse_message_delete(self, data): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user