mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-09-22 19:22:01 +03:00
feat(guild): add list and get emoji
This commit is contained in:
parent
092d262f61
commit
e1da3ee781
3 changed files with 105 additions and 1 deletions
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
|
@ -10,4 +10,4 @@ liberapay: # Replace with a single Liberapay username
|
|||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: ['https://pay.cloudtips.ru/p/41f54886']
|
||||
custom: ['https://pay.cloudtips.ru/p/41f54886', 'https://sobe.ru/na/makaroni']
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...utils.types import APINullable
|
|||
|
||||
if TYPE_CHECKING:
|
||||
from .channel import ChannelType, Channel
|
||||
from .emoji import Emoji
|
||||
|
||||
|
||||
class DefaultMessageNotificationLevel(IntEnum):
|
||||
|
@ -620,6 +621,50 @@ class Guild(APIModelBase):
|
|||
|
||||
await self._client.rest.remove_guild_ban(self.id, user_id, reason=reason)
|
||||
|
||||
async def emojis(
|
||||
self
|
||||
):
|
||||
"""|coro|
|
||||
|
||||
Getting all emojis from guild
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
The request to perform the action failed with other http exception.
|
||||
ForbiddenError
|
||||
You do not have proper permissions to do the actions required.
|
||||
BadRequestError
|
||||
You provided a wrong guild
|
||||
"""
|
||||
|
||||
await self._client.rest.list_guild_emojis(self.id)
|
||||
|
||||
async def emoji(
|
||||
self,
|
||||
emoji_id: Union[Snowflake, str, int]
|
||||
):
|
||||
"""|coro|
|
||||
|
||||
Getting all emojis from guild
|
||||
|
||||
Parameters
|
||||
----------
|
||||
emoji_id: Union[:class:`int`, :class:`str`, :class:`~.melisa.utils.snowflake.Snowflake`]
|
||||
The ID of the emoji that we will get
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
The request to perform the action failed with other http exception.
|
||||
ForbiddenError
|
||||
You do not have proper permissions to do the actions required.
|
||||
BadRequestError
|
||||
You provided a wrong guild and emoji
|
||||
"""
|
||||
|
||||
await self._client.rest.get_guild_emoji(self.id, emoji_id)
|
||||
|
||||
|
||||
@dataclass(repr=False)
|
||||
class UnavailableGuild(APIModelBase):
|
||||
|
|
|
@ -666,6 +666,65 @@ class RESTApp:
|
|||
headers={"X-Audit-Log-Reason": reason},
|
||||
)
|
||||
|
||||
async def list_guild_emojis(
|
||||
self,
|
||||
guild_id: Union[Snowflake, str, int],
|
||||
):
|
||||
"""|coro|
|
||||
|
||||
[**REST API**] Getting all emojis from guild
|
||||
|
||||
Parameters
|
||||
----------
|
||||
guild_id: Union[:class:`int`, :class:`str`, :class:`~.melisa.utils.snowflake.Snowflake`]
|
||||
ID of the guild in which we will get the list emojis
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
The request to perform the action failed with other http exception.
|
||||
ForbiddenError
|
||||
You do not have proper permissions to do the actions required.
|
||||
BadRequestError
|
||||
You provided a wrong guild
|
||||
"""
|
||||
|
||||
await self._http.get(
|
||||
f"/guilds/{guild_id}/emojis"
|
||||
)
|
||||
|
||||
async def get_guild_emoji(
|
||||
self,
|
||||
guild_id: Union[Snowflake, str, int],
|
||||
emoji_id: Union[Snowflake, str, int]
|
||||
):
|
||||
"""|coro|
|
||||
|
||||
[**REST API**] Getting all emojis from guild
|
||||
|
||||
Parameters
|
||||
----------
|
||||
guild_id: Union[:class:`int`, :class:`str`, :class:`~.melisa.utils.snowflake.Snowflake`]
|
||||
The ID of the guild in which we will receive emojis
|
||||
emoji_id: Union[:class:`int`, :class:`str`, :class:`~.melisa.utils.snowflake.Snowflake`]
|
||||
The ID of the emoji that we will get
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
The request to perform the action failed with other http exception.
|
||||
ForbiddenError
|
||||
You do not have proper permissions to do the actions required.
|
||||
BadRequestError
|
||||
You provided a wrong guild and emoji
|
||||
"""
|
||||
|
||||
await self._http.get(
|
||||
f"/guilds/{guild_id}/emojis/{emoji_id}"
|
||||
)
|
||||
|
||||
#TODO: add create and delete emoji
|
||||
|
||||
async def get_global_application_commands(
|
||||
self,
|
||||
application_id: Union[int, str, Snowflake],
|
||||
|
|
Loading…
Reference in a new issue