mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Adjust BASE urls to have no trailing slash (consistency)
This commit is contained in:
parent
f5ebf42e1f
commit
bf9b9c5879
@ -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."""
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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|
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user