diff --git a/discord/activity.py b/discord/activity.py index ae6061c0d..9a3d6b816 100644 --- a/discord/activity.py +++ b/discord/activity.py @@ -206,7 +206,7 @@ class Activity(_ActivityTag): except KeyError: return None else: - return Asset.BASE + 'app-assets/{0}/{1}.png'.format(self.application_id, large_image) + return Asset.BASE + '/app-assets/{0}/{1}.png'.format(self.application_id, large_image) @property def small_image_url(self): @@ -219,7 +219,7 @@ class Activity(_ActivityTag): except KeyError: return None else: - return Asset.BASE + 'app-assets/{0}/{1}.png'.format(self.application_id, small_image) + return Asset.BASE + '/app-assets/{0}/{1}.png'.format(self.application_id, small_image) @property def large_image_text(self): """Optional[:class:`str`]: Returns the large image asset hover text of this activity if applicable.""" diff --git a/discord/asset.py b/discord/asset.py index 0f612c1bb..f518beb0c 100644 --- a/discord/asset.py +++ b/discord/asset.py @@ -63,7 +63,7 @@ class Asset: """ __slots__ = ('_state', '_url') - BASE = 'https://cdn.discordapp.com/' + BASE = 'https://cdn.discordapp.com' def __init__(self, state, url=None): self._state = state @@ -86,14 +86,14 @@ class Asset: if format is None: format = 'gif' if user.is_avatar_animated() else static_format - return cls(state, 'avatars/{0.id}/{0.avatar}.{1}?size={2}'.format(user, format, size)) + return cls(state, '/avatars/{0.id}/{0.avatar}.{1}?size={2}'.format(user, format, size)) @classmethod def _from_icon(cls, state, object, path): if object.icon is None: return cls(state) - url = '{0}-icons/{1.id}/{1.icon}.jpg'.format(path, object) + url = '/{0}-icons/{1.id}/{1.icon}.jpg'.format(path, object) return cls(state, url) @classmethod @@ -101,7 +101,7 @@ class Asset: if obj.cover_image is None: return cls(state) - url = 'app-assets/{0.id}/store/{0.cover_image}.jpg'.format(obj) + url = '/app-assets/{0.id}/store/{0.cover_image}.jpg'.format(obj) return cls(state, url) @classmethod @@ -114,7 +114,7 @@ class Asset: if hash is None: return cls(state) - url = '{key}/{0}/{1}.{2}?size={3}' + url = '/{key}/{0}/{1}.{2}?size={3}' return cls(state, url.format(id, hash, format, size, key=key)) @classmethod @@ -134,7 +134,7 @@ class Asset: if format is None: format = 'gif' if guild.is_icon_animated() else static_format - return cls(state, 'icons/{0.id}/{0.icon}.{1}?size={2}'.format(guild, format, size)) + return cls(state, '/icons/{0.id}/{0.icon}.{1}?size={2}'.format(guild, format, size)) def __str__(self): diff --git a/discord/emoji.py b/discord/emoji.py index fcf112505..2429e0b2c 100644 --- a/discord/emoji.py +++ b/discord/emoji.py @@ -122,7 +122,7 @@ class PartialEmoji: return Asset(self._state) _format = 'gif' if self.animated else 'png' - url = "emojis/{0.id}.{1}".format(self, _format) + url = "/emojis/{0.id}.{1}".format(self, _format) return Asset(self._state, url) class Emoji: @@ -229,7 +229,7 @@ class Emoji: def url(self): """:class:`Asset`: Returns the asset of the emoji.""" _format = 'gif' if self.animated else 'png' - url = "emojis/{0.id}.{1}".format(self, _format) + url = "/emojis/{0.id}.{1}".format(self, _format) return Asset(self._state, url) @property diff --git a/discord/invite.py b/discord/invite.py index f4c8e1f2d..28458b7a7 100644 --- a/discord/invite.py +++ b/discord/invite.py @@ -256,7 +256,7 @@ class Invite(Hashable): 'temporary', 'max_uses', 'inviter', 'channel', '_state', 'approximate_member_count', 'approximate_presence_count' ) - BASE = 'https://discord.gg/' + BASE = 'https://discord.gg' def __init__(self, *, state, data): self._state = state @@ -311,7 +311,7 @@ class Invite(Hashable): @property def url(self): """:class:`str`: A property that retrieves the invite URL.""" - return self.BASE + self.code + return self.BASE + '/' + self.code async def delete(self, *, reason=None): """|coro| diff --git a/discord/user.py b/discord/user.py index bc4c1d9da..5c5a9de54 100644 --- a/discord/user.py +++ b/discord/user.py @@ -181,7 +181,7 @@ class BaseUser(_BaseUser): @property def default_avatar_url(self): """:class:`Asset`: Returns a URL for a user's default avatar.""" - return Asset(self._state, 'embed/avatars/{}.png'.format(self.default_avatar.value)) + return Asset(self._state, '/embed/avatars/{}.png'.format(self.default_avatar.value)) @property def colour(self): diff --git a/discord/webhook.py b/discord/webhook.py index 9ebc58d1b..44ca38fda 100644 --- a/discord/webhook.py +++ b/discord/webhook.py @@ -586,7 +586,7 @@ class Webhook: """ if self.avatar is None: # Default is always blurple apparently - return Asset(self._state, 'embed/avatars/0.png') + return Asset(self._state, '/embed/avatars/0.png') if not utils.valid_icon_size(size): raise InvalidArgument("size must be a power of 2 between 16 and 1024") @@ -596,7 +596,7 @@ class Webhook: if format not in ('png', 'jpg', 'jpeg'): raise InvalidArgument("format must be one of 'png', 'jpg', or 'jpeg'.") - url = 'avatars/{0.id}/{0.avatar}.{1}?size={2}'.format(self, format, size) + url = '/avatars/{0.id}/{0.avatar}.{1}?size={2}'.format(self, format, size) return Asset(self._state, url) def delete(self):