aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2018-07-20 04:17:28 -0400
committerRapptz <[email protected]>2018-07-20 04:17:28 -0400
commit4aecdea0524e7b481f9750166bf9e9be287ec445 (patch)
tree5492ee117a40a0007fe94197382100950ce18e9b /discord/channel.py
parentFix crashing with wonky TYPING_START events. (diff)
downloaddiscord.py-4aecdea0524e7b481f9750166bf9e9be287ec445.tar.xz
discord.py-4aecdea0524e7b481f9750166bf9e9be287ec445.zip
Make TextChannel.create_webhook name parameter mandatory.
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 27b6301e..a79b3424 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -340,7 +340,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
data = await self._state.http.channel_webhooks(self.id)
return [Webhook.from_state(d, state=self._state) for d in data]
- async def create_webhook(self, *, name=None, avatar=None):
+ async def create_webhook(self, *, name, avatar=None):
"""|coro|
Creates a webhook for this channel.
@@ -349,7 +349,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
Parameters
-------------
- name: Optional[str]
+ name: str
The webhook's name.
avatar: Optional[bytes]
A *bytes-like* object representing the webhook's default avatar.
@@ -371,10 +371,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
if avatar is not None:
avatar = utils._bytes_to_base64_data(avatar)
- if name is not None:
- name = str(name)
-
- data = await self._state.http.create_webhook(self.id, name=name, avatar=avatar)
+ data = await self._state.http.create_webhook(self.id, name=str(name), avatar=avatar)
return Webhook.from_state(data, state=self._state)
class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):