From e971e2f16cba22decd25db6b44e9cc84adf08555 Mon Sep 17 00:00:00 2001 From: Nadir Chowdhury Date: Wed, 1 Jul 2020 04:35:42 +0100 Subject: Allow more methods to set an audit log reason --- discord/channel.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'discord/channel.py') 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): -- cgit v1.2.3