aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2019-03-12 12:16:25 +0000
committerDanny <[email protected]>2019-03-12 08:16:25 -0400
commit999ac0a0e3322c02b43b470dcfdd427c33d408e4 (patch)
tree3d86e2c69b31b82e3b92fd37f2cc21d26dd2ad89
parent[commands] Refactor quoted_word free function to a StringView method. (diff)
downloaddiscord.py-999ac0a0e3322c02b43b470dcfdd427c33d408e4.tar.xz
discord.py-999ac0a0e3322c02b43b470dcfdd427c33d408e4.zip
Add Category.create_text_channel/Category.create_voice_channel (#1976)
Fixes #1971
-rw-r--r--discord/channel.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 84bee3a6..b1446c5b 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -648,6 +648,20 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
ret.sort(key=lambda c: (c.position, c.id))
return ret
+ async def create_text_channel(self, name, *, overwrites=None, reason=None, **options):
+ """|coro|
+
+ A shortcut method to :meth:`Guild.create_text_channel` to create a :class:`TextChannel` in the category.
+ """
+ return await self.guild.create_text_channel(name, overwrites=overwrites, category=self, reason=reason, **options)
+
+ async def create_voice_channel(self, name, *, overwrites=None, reason=None, **options):
+ """|coro|
+
+ A shortcut method to :meth:`Guild.create_voice_channel` to create a :class:`VoiceChannel` in the category.
+ """
+ return await self.guild.create_voice_channel(name, overwrites=overwrites, category=self, reason=reason, **options)
+
class DMChannel(discord.abc.Messageable, Hashable):
"""Represents a Discord direct message channel.