Add reason to TextChannel.create_webhook

The reason parameter does not work with webhook deletes or edits so
they're not added. Probably a Discord bug.
This commit is contained in:
Rapptz
2019-04-18 22:20:02 -04:00
parent f5c38c3559
commit eb4de55f6d
2 changed files with 10 additions and 4 deletions

View File

@ -537,14 +537,15 @@ class HTTPClient:
# Webhook management
def create_webhook(self, channel_id, *, name, avatar=None):
def create_webhook(self, channel_id, *, name, avatar=None, reason=None):
payload = {
'name': name
}
if avatar is not None:
payload['avatar'] = avatar
return self.request(Route('POST', '/channels/{channel_id}/webhooks', channel_id=channel_id), json=payload)
r = Route('POST', '/channels/{channel_id}/webhooks', channel_id=channel_id)
return self.request(r, json=payload, reason=reason)
def channel_webhooks(self, channel_id):
return self.request(Route('GET', '/channels/{channel_id}/webhooks', channel_id=channel_id))