aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-12-09 20:15:35 -0500
committerRapptz <[email protected]>2020-12-09 20:15:35 -0500
commit44dc7a8e0208b8e5bbec568accab9ab4de818300 (patch)
treeb725764729f6d07709105c3811eef8602076b8d0 /discord/channel.py
parentRevert Message.edit logic that deals with allowed_mentions (diff)
downloaddiscord.py-44dc7a8e0208b8e5bbec568accab9ab4de818300.tar.xz
discord.py-44dc7a8e0208b8e5bbec568accab9ab4de818300.zip
Add support for editing and deleting webhook messages.
Fix #6058
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 7568b404..9343b72c 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -34,7 +34,6 @@ from .mixins import Hashable
from . import utils
from .asset import Asset
from .errors import ClientException, NoMoreItems, InvalidArgument
-from .webhook import Webhook
__all__ = (
'TextChannel',
@@ -221,7 +220,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
A value of `0` disables slowmode. The maximum value possible is `21600`.
type: :class:`ChannelType`
Change the type of this text channel. Currently, only conversion between
- :attr:`ChannelType.text` and :attr:`ChannelType.news` is supported. This
+ :attr:`ChannelType.text` and :attr:`ChannelType.news` is supported. This
is only available to guilds that contain ``NEWS`` in :attr:`Guild.features`.
reason: Optional[:class:`str`]
The reason for editing this channel. Shows up on the audit log.
@@ -429,6 +428,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
The webhooks for this channel.
"""
+ from .webhook import Webhook
data = await self._state.http.channel_webhooks(self.id)
return [Webhook.from_state(d, state=self._state) for d in data]
@@ -465,6 +465,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
The created webhook.
"""
+ from .webhook import Webhook
if avatar is not None:
avatar = utils._bytes_to_base64_data(avatar)
@@ -512,6 +513,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)))
+ from .webhook import Webhook
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)