mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-06 11:57:17 +00:00
[bugs] stop resolving Object for template/invite; remove dupe methods
This commit is contained in:
parent
b68cbb7a42
commit
ce03c62c6b
@ -1027,7 +1027,7 @@ class Client:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
code: :class:`str`
|
code: Union[:class:`.Template`, :class:`str`]
|
||||||
The Discord Template Code or URL (must be a discord.new URL).
|
The Discord Template Code or URL (must be a discord.new URL).
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
@ -1144,7 +1144,7 @@ class Client:
|
|||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
url: :class:`str`
|
url: Union[:class:`.Invite`, :class:`str`]
|
||||||
The Discord invite ID or URL (must be a discord.gg URL).
|
The Discord invite ID or URL (must be a discord.gg URL).
|
||||||
with_counts: :class:`bool`
|
with_counts: :class:`bool`
|
||||||
Whether to include count information in the invite. This fills the
|
Whether to include count information in the invite. This fills the
|
||||||
|
@ -1485,58 +1485,6 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
async def fetch_emojis(self):
|
|
||||||
r"""|coro|
|
|
||||||
|
|
||||||
Retrieves all custom :class:`Emoji`\s from the guild.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This method is an API call. For general usage, consider :attr:`emojis` instead.
|
|
||||||
|
|
||||||
Raises
|
|
||||||
---------
|
|
||||||
HTTPException
|
|
||||||
An error occurred fetching the emojis.
|
|
||||||
|
|
||||||
Returns
|
|
||||||
--------
|
|
||||||
List[:class:`Emoji`]
|
|
||||||
The retrieved emojis.
|
|
||||||
"""
|
|
||||||
data = await self._state.http.get_all_custom_emojis(self.id)
|
|
||||||
return [Emoji(guild=self, state=self._state, data=d) for d in data]
|
|
||||||
|
|
||||||
async def fetch_emoji(self, emoji_id):
|
|
||||||
"""|coro|
|
|
||||||
|
|
||||||
Retrieves a custom :class:`Emoji` from the guild.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
This method is an API call.
|
|
||||||
For general usage, consider iterating over :attr:`emojis` instead.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
-------------
|
|
||||||
emoji_id: :class:`int`
|
|
||||||
The emoji's ID.
|
|
||||||
|
|
||||||
Raises
|
|
||||||
---------
|
|
||||||
NotFound
|
|
||||||
The emoji requested could not be found.
|
|
||||||
HTTPException
|
|
||||||
An error occurred fetching the emoji.
|
|
||||||
|
|
||||||
Returns
|
|
||||||
--------
|
|
||||||
:class:`Emoji`
|
|
||||||
The retrieved emoji.
|
|
||||||
"""
|
|
||||||
data = await self._state.http.get_custom_emoji(self.id, emoji_id)
|
|
||||||
return Emoji(guild=self, state=self._state, data=data)
|
|
||||||
|
|
||||||
async def create_integration(self, *, type, id):
|
async def create_integration(self, *, type, id):
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
@ -1589,9 +1537,13 @@ class Guild(Hashable):
|
|||||||
return [Integration(guild=self, data=d) for d in data]
|
return [Integration(guild=self, data=d) for d in data]
|
||||||
|
|
||||||
async def fetch_emojis(self):
|
async def fetch_emojis(self):
|
||||||
"""|coro|
|
r"""|coro|
|
||||||
|
|
||||||
Retrieves all custom :class:`Emoji`s from the guild.
|
Retrieves all custom :class:`Emoji`\s from the guild.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This method is an API call. For general usage, consider :attr:`emojis` instead.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
---------
|
---------
|
||||||
@ -1611,6 +1563,11 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
Retrieves a custom :class:`Emoji` from the guild.
|
Retrieves a custom :class:`Emoji` from the guild.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This method is an API call.
|
||||||
|
For general usage, consider iterating over :attr:`emojis` instead.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-------------
|
-------------
|
||||||
emoji_id: :class:`int`
|
emoji_id: :class:`int`
|
||||||
|
@ -70,7 +70,7 @@ class Integration:
|
|||||||
Where the integration is currently syncing.
|
Where the integration is currently syncing.
|
||||||
role: :class:`Role`
|
role: :class:`Role`
|
||||||
The role which the integration uses for subscribers.
|
The role which the integration uses for subscribers.
|
||||||
enable_emoticons: :class:`bool`
|
enable_emoticons: Optional[:class:`bool`]
|
||||||
Whether emoticons should be synced for this integration (currently twitch only).
|
Whether emoticons should be synced for this integration (currently twitch only).
|
||||||
expire_behaviour: :class:`ExpireBehaviour`
|
expire_behaviour: :class:`ExpireBehaviour`
|
||||||
The behaviour of expiring subscribers. Aliased to ``expire_behavior`` as well.
|
The behaviour of expiring subscribers. Aliased to ``expire_behavior`` as well.
|
||||||
|
@ -442,8 +442,8 @@ def resolve_invite(invite):
|
|||||||
The invite code.
|
The invite code.
|
||||||
"""
|
"""
|
||||||
from .invite import Invite # circular import
|
from .invite import Invite # circular import
|
||||||
if isinstance(invite, (Invite, Object)):
|
if isinstance(invite, Invite):
|
||||||
return invite.id
|
return invite.code
|
||||||
else:
|
else:
|
||||||
rx = r'(?:https?\:\/\/)?discord(?:\.gg|(?:app)?\.com\/invite)\/(.+)'
|
rx = r'(?:https?\:\/\/)?discord(?:\.gg|(?:app)?\.com\/invite)\/(.+)'
|
||||||
m = re.match(rx, invite)
|
m = re.match(rx, invite)
|
||||||
@ -453,8 +453,8 @@ def resolve_invite(invite):
|
|||||||
|
|
||||||
def resolve_template(code):
|
def resolve_template(code):
|
||||||
from .template import Template # circular import
|
from .template import Template # circular import
|
||||||
if isinstance(code, (Template, Object)):
|
if isinstance(code, Template):
|
||||||
return template.id
|
return template.code
|
||||||
else:
|
else:
|
||||||
rx = r'(?:https?\:\/\/)?discord(?:\.new|(?:app)?\.com\/template)\/(.+)'
|
rx = r'(?:https?\:\/\/)?discord(?:\.new|(?:app)?\.com\/template)\/(.+)'
|
||||||
m = re.match(rx, code)
|
m = re.match(rx, code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user