diff options
| author | NCPlayz <[email protected]> | 2019-03-21 19:59:58 +0000 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-04-06 19:12:50 -0400 |
| commit | be227ebcf0c8bad6b56798339b5414b8da414dc0 (patch) | |
| tree | c7ea93ffc51e9a490b42d36e5c734b6b19ec3909 /discord/channel.py | |
| parent | Propagate Cloudflare 429 HTML text. (diff) | |
| download | discord.py-be227ebcf0c8bad6b56798339b5414b8da414dc0.tar.xz discord.py-be227ebcf0c8bad6b56798339b5414b8da414dc0.zip | |
Redesign asset retrieval in the library.
Most assets now return a new class named `Asset`. This allows for the
assets to be consistently saved via a `save` method instead of special
casing for `Attachment`.
`AppInfo` is no longer a namedtuple it is a fully documented dataclass,
as well as having the state attached to it.
Fixes #1997
Diffstat (limited to 'discord/channel.py')
| -rw-r--r-- | discord/channel.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/discord/channel.py b/discord/channel.py index a64dd5ce..67b8981c 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -32,6 +32,7 @@ from .permissions import Permissions from .enums import ChannelType, try_enum from .mixins import Hashable from . import utils +from .asset import Asset from .errors import ClientException, NoMoreItems from .webhook import Webhook @@ -996,11 +997,8 @@ class GroupChannel(discord.abc.Messageable, Hashable): @property def icon_url(self): - """Returns the channel's icon URL if available or an empty string otherwise.""" - if self.icon is None: - return '' - - return 'https://cdn.discordapp.com/channel-icons/{0.id}/{0.icon}.jpg'.format(self) + """:class:`Asset`: Returns the channel's icon asset if available.""" + return Asset._from_icon(self._state, self, 'channel') @property def created_at(self): |