aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorNadir Chowdhury <[email protected]>2020-07-01 04:35:42 +0100
committerGitHub <[email protected]>2020-06-30 23:35:42 -0400
commite971e2f16cba22decd25db6b44e9cc84adf08555 (patch)
tree7baf270018d377d4b4df49729cf4ecbdc93ce1e0 /discord/channel.py
parentAllow Webhook to be hashable and comparable (diff)
downloaddiscord.py-e971e2f16cba22decd25db6b44e9cc84adf08555.tar.xz
discord.py-e971e2f16cba22decd25db6b44e9cc84adf08555.zip
Allow more methods to set an audit log reason
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/discord/channel.py b/discord/channel.py
index a554d0d5..c02c00f3 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -471,7 +471,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
data = await self._state.http.create_webhook(self.id, name=str(name), avatar=avatar, reason=reason)
return Webhook.from_state(data, state=self._state)
- async def follow(self, *, destination):
+ async def follow(self, *, destination, reason=None):
"""
Follows a channel using a webhook.
@@ -488,6 +488,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
-----------
destination: :class:`TextChannel`
The channel you would like to follow from.
+ reason: Optional[:class:`str`]
+ The reason for following the channel. Shows up on the destination guild's audit log.
+
+ .. versionadded:: 1.4
Raises
-------
@@ -508,7 +512,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
if not isinstance(destination, TextChannel):
raise InvalidArgument('Expected TextChannel received {0.__name__}'.format(type(destination)))
- data = await self._state.http.follow_webhook(self.id, webhook_channel_id=destination.id)
+ data = await self._state.http.follow_webhook(self.id, webhook_channel_id=destination.id, reason=reason)
return Webhook._as_follower(data, channel=destination, user=self._state.user)
class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):