From 9b714d60063f0a562702648634271d333c3bbb54 Mon Sep 17 00:00:00 2001 From: mAxYoLo01 Date: Sat, 20 Aug 2022 11:03:38 +0200 Subject: [PATCH 1/7] ref!: set GuildMember as a subclass of Member --- interactions/api/models/gw.py | 343 ++-------------------------------- 1 file changed, 20 insertions(+), 323 deletions(-) diff --git a/interactions/api/models/gw.py b/interactions/api/models/gw.py index 61c09f1e3..b756cf10c 100644 --- a/interactions/api/models/gw.py +++ b/interactions/api/models/gw.py @@ -1,10 +1,7 @@ from datetime import datetime -from typing import Any, List, Optional, Union +from typing import Any, List, Optional -from ...client.models.component import ActionRow, Button, SelectMenu, _build_components -from ..error import LibraryException from .attrs_utils import ( - MISSING, ClientSerializerMixin, DictSerializerMixin, convert_list, @@ -15,13 +12,12 @@ from .emoji import Emoji from .guild import EventMetadata from .member import Member -from .message import Embed, Message, MessageInteraction, Sticker +from .message import Sticker from .misc import ( AutoModAction, AutoModTriggerMetadata, AutoModTriggerType, ClientStatus, - File, IDMixin, Snowflake, ) @@ -234,329 +230,30 @@ class GuildJoinRequest(DictSerializerMixin): @define() -class GuildMember(ClientSerializerMixin): +class GuildMember(Member): """ A class object representing the gateway events ``GUILD_MEMBER_ADD``, ``GUILD_MEMBER_UPDATE`` and ``GUILD_MEMBER_REMOVE``. - :ivar Snowflake guild_id: The guild ID of the event. - :ivar Optional[List[Role]] roles?: The roles of the event. - :ivar Optional[User] user?: The user of the event. - :ivar Optional[str] nick?: The nickname of the user of the event. - :ivar Optional[str] avatar?: The avatar URL of the user of the event. - :ivar Optional[datetime] joined_at?: The time that the user of the event joined at. - :ivar Optional[datetime] premium_since?: The time that the user of the event has since had "premium." - :ivar Optional[bool] deaf?: Whether the member of the event is deafened or not. - :ivar Optional[bool] mute?: Whether the member of the event is muted or not. - :ivar Optional[bool] pending?: Whether the member of the event is still pending -- pass membership screening -- or not. - :ivat Optional[datetime.isoformat] communication_disabled_until?: when the user's timeout will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out. + .. note:: + ``pending`` and ``permissions`` only apply for members retroactively + requiring to verify rules via. membership screening or lack permissions + to speak. + + :ivar Snowflake guild_id: The guild ID. + :ivar User user: The user of the guild. + :ivar str nick: The nickname of the member. + :ivar Optional[str] avatar?: The hash containing the user's guild avatar, if applicable. + :ivar List[int] roles: The list of roles of the member. + :ivar datetime joined_at: The timestamp the member joined the guild at. + :ivar datetime premium_since: The timestamp the member has been a server booster since. + :ivar bool deaf: Whether the member is deafened. + :ivar bool mute: Whether the member is muted. + :ivar Optional[bool] pending?: Whether the member is pending to pass membership screening. + :ivar Optional[Permissions] permissions?: Whether the member has permissions. + :ivar Optional[str] communication_disabled_until?: How long until they're unmuted, if any. """ guild_id: Snowflake = field(converter=Snowflake) - roles: Optional[List[str]] = field(default=None) - user: Optional[User] = field(converter=User, default=None, add_client=True) - nick: Optional[str] = field(default=None) - _avatar: Optional[str] = field(default=None, discord_name="avatar") - joined_at: Optional[datetime] = field(converter=datetime.fromisoformat, default=None) - premium_since: Optional[datetime] = field(converter=datetime.fromisoformat, default=None) - deaf: Optional[bool] = field(default=None) - mute: Optional[bool] = field(default=None) - pending: Optional[bool] = field(default=None) - communication_disabled_until: Optional[datetime.isoformat] = field( - converter=datetime.fromisoformat, default=None - ) - - def __str__(self) -> str: - return self.name or "" - - @property - def avatar(self) -> Optional[str]: - return self._avatar or getattr(self.user, "avatar", None) - - @property - def id(self) -> Optional[Snowflake]: - """ - Returns the ID of the user. - - :return: The ID of the user - :rtype: Snowflake - """ - return self.user.id if self.user else None - - @property - def name(self) -> Optional[str]: - """ - Returns the string of either the user's nickname or username. - - :return: The name of the member - :rtype: str - """ - return self.nick or (self.user.username if self.user else None) - - @property - def mention(self) -> str: - """ - Returns a string that allows you to mention the given member. - - :return: The string of the mentioned member. - :rtype: str - """ - return f"<@!{self.user.id}>" if self.nick else f"<@{self.user.id}>" - - async def ban( - self, - reason: Optional[str] = None, - delete_message_days: Optional[int] = 0, - ) -> None: - """ - Bans the member from a guild. - - :param reason?: The reason of the ban - :type reason?: Optional[str] - :param delete_message_days?: Number of days to delete messages, from 0 to 7. Defaults to 0 - :type delete_message_days?: Optional[int] - """ - await self._client.create_guild_ban( - guild_id=int(self.guild_id), - user_id=int(self.user.id), - reason=reason, - delete_message_days=delete_message_days, - ) - - async def kick( - self, - reason: Optional[str] = None, - ) -> None: - """ - Kicks the member from a guild. - - :param reason?: The reason for the kick - :type reason?: Optional[str] - """ - if not self._client: - raise LibraryException(code=13) - await self._client.create_guild_kick( - guild_id=int(self.guild_id), - user_id=int(self.user.id), - reason=reason, - ) - - async def add_role( - self, - role: Union[Role, int], - reason: Optional[str] = None, - ) -> None: - """ - This method adds a role to a member. - - :param role: The role to add. Either ``Role`` object or role_id - :type role: Union[Role, int] - :param reason?: The reason why the roles are added - :type reason?: Optional[str] - """ - if not self._client: - raise LibraryException(code=13) - if isinstance(role, Role): - await self._client.add_member_role( - guild_id=int(self.guild_id), - user_id=int(self.user.id), - role_id=int(role.id), - reason=reason, - ) - else: - await self._client.add_member_role( - guild_id=int(self.guild_id), - user_id=int(self.user.id), - role_id=role, - reason=reason, - ) - - async def remove_role( - self, - role: Union[Role, int], - reason: Optional[str] = None, - ) -> None: - """ - This method removes a role from a member. - - :param role: The role to remove. Either ``Role`` object or role_id - :type role: Union[Role, int] - :param reason?: The reason why the roles are removed - :type reason?: Optional[str] - """ - if not self._client: - raise LibraryException(code=13) - if isinstance(role, Role): - await self._client.remove_member_role( - guild_id=int(self.guild_id), - user_id=int(self.user.id), - role_id=int(role.id), - reason=reason, - ) - else: - await self._client.remove_member_role( - guild_id=int(self.guild_id), - user_id=int(self.user.id), - role_id=role, - reason=reason, - ) - - async def send( - self, - content: Optional[str] = MISSING, - *, - components: Optional[ - Union[ - ActionRow, - Button, - SelectMenu, - List[ActionRow], - List[Button], - List[SelectMenu], - ] - ] = MISSING, - tts: Optional[bool] = MISSING, - files: Optional[Union[File, List[File]]] = MISSING, - embeds: Optional[Union[Embed, List[Embed]]] = MISSING, - allowed_mentions: Optional[MessageInteraction] = MISSING, - ) -> Message: - """ - Sends a DM to the member. - - :param content?: The contents of the message as a string or string-converted value. - :type content?: Optional[str] - :param components?: A component, or list of components for the message. - :type components?: Optional[Union[ActionRow, Button, SelectMenu, List[Actionrow], List[Button], List[SelectMenu]]] - :param tts?: Whether the message utilizes the text-to-speech Discord programme or not. - :type tts?: Optional[bool] - :param files?: A file or list of files to be attached to the message. - :type files?: Optional[Union[File, List[File]]] - :param embeds?: An embed, or list of embeds for the message. - :type embeds?: Optional[Union[Embed, List[Embed]]] - :param allowed_mentions?: The message interactions/mention limits that the message can refer to. - :type allowed_mentions?: Optional[MessageInteraction] - :return: The sent message as an object. - :rtype: Message - """ - if not self._client: - raise LibraryException(code=13) - - _content: str = "" if content is MISSING else content - _tts: bool = False if tts is MISSING else tts - # _file = None if file is None else file - # _attachments = [] if attachments else None - _embeds: list = ( - [] - if not embeds or embeds is MISSING - else ([embed._json for embed in embeds] if isinstance(embeds, list) else [embeds._json]) - ) - _allowed_mentions: dict = {} if allowed_mentions is MISSING else allowed_mentions - if not components or components is MISSING: - _components = [] - else: - _components = _build_components(components=components) - - if not files or files is MISSING: - _files = [] - elif isinstance(files, list): - _files = [file._json_payload(id) for id, file in enumerate(files)] - else: - _files = [files._json_payload(0)] - files = [files] - - payload = dict( - content=_content, - tts=_tts, - attachments=_files, - embeds=_embeds, - components=_components, - allowed_mentions=_allowed_mentions, - ) - - channel = Channel( - **await self._client.create_dm(recipient_id=int(self.user.id)), _client=self._client - ) - res = await self._client.create_message( - channel_id=int(channel.id), payload=payload, files=files - ) - - return Message(**res, _client=self._client) - - async def modify( - self, - nick: Optional[str] = MISSING, - roles: Optional[List[int]] = MISSING, - mute: Optional[bool] = MISSING, - deaf: Optional[bool] = MISSING, - channel_id: Optional[int] = MISSING, - communication_disabled_until: Optional[datetime.isoformat] = MISSING, - reason: Optional[str] = None, - ) -> "GuildMember": - """ - Modifies the member of a guild. - - :param nick?: The nickname of the member - :type nick?: Optional[str] - :param roles?: A list of all role ids the member has - :type roles?: Optional[List[int]] - :param mute?: whether the user is muted in voice channels - :type mute?: Optional[bool] - :param deaf?: whether the user is deafened in voice channels - :type deaf?: Optional[bool] - :param channel_id?: id of channel to move user to (if they are connected to voice) - :type channel_id?: Optional[int] - :param communication_disabled_until?: when the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future) - :type communication_disabled_until?: Optional[datetime.isoformat] - :param reason?: The reason of the modifying - :type reason?: Optional[str] - :return: The modified member object - :rtype: Member - """ - if not self._client: - raise LibraryException(code=13) - payload = {} - if nick is not MISSING: - payload["nick"] = nick - - if roles is not MISSING: - payload["roles"] = roles - - if channel_id is not MISSING: - payload["channel_id"] = channel_id - - if mute is not MISSING: - payload["mute"] = mute - - if deaf is not MISSING: - payload["deaf"] = deaf - - if communication_disabled_until is not MISSING: - payload["communication_disabled_until"] = communication_disabled_until - - res = await self._client.modify_member( - user_id=int(self.user.id), - guild_id=int(self.guild_id), - payload=payload, - reason=reason, - ) - self.update(res) - return GuildMember(**res, _client=self._client, guild_id=self.guild_id) - - async def add_to_thread( - self, - thread_id: int, - ) -> None: - """ - Adds the member to a thread. - - :param thread_id: The id of the thread to add the member to - :type thread_id: int - """ - if not self._client: - raise LibraryException(code=13) - await self._client.add_member_to_thread( - user_id=int(self.user.id), - thread_id=thread_id, - ) @define() From 47274bab2e47c94229e66e613e0568a6ba31a714 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 20 Aug 2022 09:06:45 +0000 Subject: [PATCH 2/7] ci: correct from checks. --- interactions/api/models/gw.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/interactions/api/models/gw.py b/interactions/api/models/gw.py index b756cf10c..b85db29cc 100644 --- a/interactions/api/models/gw.py +++ b/interactions/api/models/gw.py @@ -1,13 +1,7 @@ from datetime import datetime from typing import Any, List, Optional -from .attrs_utils import ( - ClientSerializerMixin, - DictSerializerMixin, - convert_list, - define, - field, -) +from .attrs_utils import ClientSerializerMixin, DictSerializerMixin, convert_list, define, field from .channel import Channel, ThreadMember from .emoji import Emoji from .guild import EventMetadata From a0f5dd5aa48fd1c126c4965ccc1bbe68407235f1 Mon Sep 17 00:00:00 2001 From: mAxYoLo01 Date: Sat, 20 Aug 2022 11:18:46 +0200 Subject: [PATCH 3/7] revert: add back original functions --- .gitignore | 1 + docs/conf.py | 2 +- docs/locale/fr/LC_MESSAGES/api.http.po | 217 +++++++++-------- interactions/api/models/gw.py | 311 ++++++++++++++++++++++++- 4 files changed, 424 insertions(+), 107 deletions(-) diff --git a/.gitignore b/.gitignore index e61e0a37c..f0d487dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ __pycache__ *.token *.pypirc *.code-workspace +*.mo \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index c40b3032c..408cc4525 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,7 +66,7 @@ # Language is commented out because of PR reviews. In a RTD-hosted case, # the variable seems to be skipped. -# language = "de" +language = "fr" locale_dirs = ["locale/"] gettext_compact = True diff --git a/docs/locale/fr/LC_MESSAGES/api.http.po b/docs/locale/fr/LC_MESSAGES/api.http.po index b141f2d87..e07fb1420 100644 --- a/docs/locale/fr/LC_MESSAGES/api.http.po +++ b/docs/locale/fr/LC_MESSAGES/api.http.po @@ -2,7 +2,7 @@ # Copyright (C) 2022, goverfl0w # This file is distributed under the same license as the interactions.py # package. -# FIRST AUTHOR , 2022. +# mAxYoLo01 - maxyolo01.ytb@gmail.com - mAxYoLo01#4491, 2022. # #, fuzzy msgid "" @@ -11,12 +11,12 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-07-17 16:00-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Last-Translator: mAxYoLo01 - maxyolo01.ytb@gmail.com - mAxYoLo01#4491\n" +"Language-Team: None\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.9.1\n" +"Generated-By: mAxYoLo01\n" #: ../../api.http.rst:4 msgid "HTTP" @@ -24,33 +24,33 @@ msgstr "" #: interactions.api.http.route.Route:1 of msgid "A class representing how an HTTP route is structured." -msgstr "" +msgstr "Une classe représentant la structure d'une route HTTP." #: interactions.api.http.client.HTTPClient #: interactions.api.http.limiter.Limiter interactions.api.http.request._Request #: interactions.api.http.route.Route of msgid "Variables" -msgstr "" +msgstr "Variables" #: interactions.api.http.route.Route:3 of msgid "The HTTP route path." -msgstr "" +msgstr "Le chemin d'accès HTTP." #: interactions.api.http.route.Route:4 of msgid "The HTTP method." -msgstr "" +msgstr "La méthode HTTP." #: interactions.api.http.route.Route:5 of msgid "The URL path." -msgstr "" +msgstr "Le chemin URL." #: interactions.api.http.route.Route:6 of msgid "The channel ID from the bucket if given." -msgstr "" +msgstr "L'ID du canal du bucket, s'il est donné." #: interactions.api.http.route.Route:7 of msgid "The guild ID from the bucket if given." -msgstr "" +msgstr "L'ID du serveur du bucket, s'il est donné." #: interactions.api.http.channel.ChannelRequest.create_channel #: interactions.api.http.channel.ChannelRequest.create_channel_invite @@ -196,7 +196,7 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.get_webhook_message #: interactions.api.http.webhook.WebhookRequest.modify_webhook of msgid "Parameters" -msgstr "" +msgstr "Paramètres" #: interactions.api.http.channel.ChannelRequest #: interactions.api.http.channel.ChannelRequest.create_channel @@ -364,17 +364,19 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.get_webhook_message #: interactions.api.http.webhook.WebhookRequest.modify_webhook of msgid "Return type" -msgstr "" +msgstr "Type de retour" #: interactions.api.http.route.Route.get_bucket:1 of msgid "" "Returns the route's bucket. If shared_bucket is None, returns the path " "with major parameters. Otherwise, it relies on Discord's given bucket." msgstr "" +"Renvoie le bucket de la route. Si shared_bucket est None, renvoie le chemin" +"avec les paramètres majeurs. Sinon, il s'appuie sur le bucket donné par Discord." #: interactions.api.http.route.Route.get_bucket:4 of msgid "The bucket that Discord provides, if available." -msgstr "" +msgstr "Le bucket que Discord fournit, s'il y en a un." #: interactions.api.http.channel.ChannelRequest.create_channel #: interactions.api.http.channel.ChannelRequest.create_channel_invite @@ -474,146 +476,153 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.get_webhook_message #: interactions.api.http.webhook.WebhookRequest.modify_webhook of msgid "Returns" -msgstr "" +msgstr "Retourne" #: interactions.api.http.route.Route.get_bucket:7 of msgid "The route bucket." -msgstr "" +msgstr "Le bucket de la route." #: interactions.api.http.route.Route.endpoint:1 of msgid "Returns the route's endpoint." -msgstr "" +msgstr "Retourne l'endpoint de la route." #: interactions.api.http.route.Route.endpoint:3 of msgid "The route endpoint." -msgstr "" +msgstr "L'endpoint de la route." #: interactions.api.http.limiter.Limiter:1 of msgid "A class representing a limitation for an HTTP request." -msgstr "" +msgstr "Une classe représentatn une limitation pour une requête HTTP." #: interactions.api.http.limiter.Limiter:3 of msgid "The \"lock\" or controller of the request." -msgstr "" +msgstr "Le \"lock\" ou contrôleur de la requête." #: interactions.api.http.limiter.Limiter:4 of msgid "The remaining time before the request can be ran." -msgstr "" +msgstr "Le temps restant avant que la requête puisse être exécutée." #: interactions.api.http.request._Request:1 of msgid "A class representing how HTTP requests are sent/read." -msgstr "" +msgstr "Une classe représentant la façon dont les requêtes HTTP " +"sont lues/envoyées." #: interactions.api.http.request._Request:3 of msgid "The current application token." -msgstr "" +msgstr "Le token de l'application." #: interactions.api.http.request._Request:4 of msgid "The current coroutine event loop." -msgstr "" +msgstr "La boucle d'événement de la coroutine actuelle." #: interactions.api.http.request._Request:5 of msgid "The current per-route rate limiters from the API." -msgstr "" +msgstr "Les limiteurs par-route actuels de l'API." #: interactions.api.http.request._Request:6 of msgid "The current endpoint to shared_bucket cache from the API." -msgstr "" +msgstr "Le cache de l'API de l'endpoint actuel au shared_bucket." #: interactions.api.http.request._Request:7 of msgid "The current headers for an HTTP request." -msgstr "" +msgstr "Les headers actuels de la requête HTTP." #: interactions.api.http.request._Request:8 of msgid "The current session for making requests." -msgstr "" +msgstr "La session actuelle pour exécuter les requêtes." #: interactions.api.http.request._Request:9 of msgid "The global rate limiter." -msgstr "" +msgstr "Le limiteur global." #: interactions.api.http.request._Request._check_session:1 of msgid "Ensures that we have a valid connection session." -msgstr "" +msgstr "S'assure qu'il y a une session de connexion valide." #: interactions.api.http.request._Request._check_lock:1 of msgid "Checks the global lock for its current state." -msgstr "" +msgstr "Vérifie l'état actuel du lock global." #: interactions.api.http.request._Request.request:1 of msgid "Sends a request to the Discord API." -msgstr "" +msgstr "Envoie une requête à l'API Discord." #: interactions.api.http.request._Request.request:3 of msgid "The HTTP route to request." -msgstr "" +msgstr "La route HTTP de la requête." #: interactions.api.http.request._Request.request:5 of msgid "Optional keyword-only arguments to pass as information in the request." -msgstr "" +msgstr "Arguments nommés facultatifs à transmettre comme information dans la requête." #: interactions.api.http.request._Request.request:7 of msgid "The contents of the request if any." -msgstr "" +msgstr "Le contenu de la requête, s'il y en a." #: interactions.api.http.request._Request.close:1 of msgid "Closes the current session." -msgstr "" +msgstr "Ferme la session actuelle." #: interactions.api.http.client.HTTPClient:1 of msgid "The user-facing client of the Web API for individual endpoints." -msgstr "" +msgstr "Le client utilisateur de l'API Web pour les endpoints individuels." #: interactions.api.http.client.HTTPClient:3 of msgid "The token of the application." -msgstr "" +msgstr "Le token de l'application." #: interactions.api.http.client.HTTPClient:4 of msgid "The requesting interface for endpoints." -msgstr "" +msgstr "L'interface demandée pour les endpoints." #: interactions.api.http.client.HTTPClient:5 of msgid "The referenced cache." -msgstr "" +msgstr "Le cache référencé." #: interactions.api.http.client.HTTPClient.get_gateway:1 of msgid "" "This calls the Gateway endpoint and returns a v9 gateway link with JSON " "encoding." msgstr "" +"Appelle l'endpoint de la gateway et retourne un lien de la v9 avec un encodage" +"JSON." #: interactions.api.http.client.HTTPClient.get_bot_gateway:1 of msgid "This calls the BOT Gateway endpoint." -msgstr "" +msgstr "Appelle l'endpoint BOT de la gateway." #: interactions.api.http.client.HTTPClient.get_bot_gateway:3 of msgid "A tuple denoting (shard, gateway_url), url from API v9 and JSON encoding" -msgstr "" +msgstr "Un tuple indiquant (shard, gateway_url), URL de l'API v9 et encodage JSON." #: interactions.api.http.client.HTTPClient.login:1 of msgid "" "This 'logins' to the gateway, which makes it available to use any other " "endpoint." msgstr "" +"Se connecter à la geteway, ce qui la rend disponible pour utiliser" +"n'importe quel endpoint." #: interactions.api.http.client.HTTPClient.logout:1 of msgid "This 'log outs' the session." -msgstr "" +msgstr "Déconnecte la session." #: interactions.api.http.client.HTTPClient.get_current_bot_information:1 of msgid "Returns the bot user application object without flags." -msgstr "" +msgstr "Retourne l'Application du bot sans les flags." #: interactions.api.http.client.HTTPClient.get_current_authorisation_information:1 #: of msgid "Returns info about the current authorization of the bot user" -msgstr "" +msgstr "Retourne des informations sur les autorisations actuelle du bot" #: interactions.api.http.channel.ChannelRequest.get_channel:1 of msgid "" "Gets a channel by ID. If the channel is a thread, it also includes thread" " members (and other thread attributes)." msgstr "" +"Obtenir un canal via son ID. Si le canal est un thread, alors il inclut" +"également les membres du thread (et d'autres attributs d'un thread)." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:6 #: interactions.api.http.channel.ChannelRequest.create_stage_instance:3 @@ -634,55 +643,56 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.create_webhook:3 #: interactions.api.http.webhook.WebhookRequest.get_channel_webhooks:3 of msgid "Channel ID snowflake." -msgstr "" +msgstr "Snowflake de l'ID du canal." #: interactions.api.http.channel.ChannelRequest.get_channel:4 of msgid "Dictionary of the channel object." -msgstr "" +msgstr "Dictionnaire d'un canal." #: interactions.api.http.channel.ChannelRequest.delete_channel:1 of msgid "Deletes a channel." -msgstr "" +msgstr "Supprimer un canal." #: interactions.api.http.channel.ChannelRequest.delete_channel:3 of msgid "Channel ID snowflake" -msgstr "" +msgstr "Snowflake de l'ID du canal." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:1 of msgid "Get messages from a channel." -msgstr "" +msgstr "Obtenir les messages d'un canal." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:4 of msgid "around, before, and after arguments are mutually exclusive." -msgstr "" +msgstr "around, before, et after sont des argument qui s'excluent" +"mutuellement." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:7 of msgid "How many messages to get. Defaults to 50, the max is 100." -msgstr "" +msgstr "Combien de messages à obtenir. Par défaut à 50, le maximum est 100." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:8 of msgid "Get messages around this snowflake ID." -msgstr "" +msgstr "Obtenir des messages autour de cet ID." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:9 of msgid "Get messages before this snowflake ID." -msgstr "" +msgstr "Obtenir des messages avant cet ID." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:10 of msgid "Get messages after this snowflake ID." -msgstr "" +msgstr "Obtenir des messages après cet ID." #: interactions.api.http.channel.ChannelRequest.get_channel_messages:11 of msgid "An array of Message objects." -msgstr "" +msgstr "Un tableau de Messages." #: interactions.api.http.channel.ChannelRequest.create_channel:1 of msgid "Creates a channel within a guild." -msgstr "" +msgstr "Créer un canal dans une guilde." #: interactions.api.http.channel.ChannelRequest.create_channel:4 of msgid "This does not handle payload in this method. Tread carefully." -msgstr "" +msgstr "Cette méthode ne gère pas le payload. Faites attention." #: interactions.api.http.channel.ChannelRequest.create_channel:6 #: interactions.api.http.channel.ChannelRequest.move_channel:3 @@ -731,193 +741,196 @@ msgstr "" #: interactions.api.http.scheduledEvent.ScheduledEventRequest.modify_scheduled_event:3 #: of msgid "Guild ID snowflake." -msgstr "" +msgstr "Snowflake de l'ID de la guilde." #: interactions.api.http.channel.ChannelRequest.create_channel:7 of msgid "Payload data." -msgstr "" +msgstr "Données du payload." #: interactions.api.http.channel.ChannelRequest.create_channel:8 of msgid "Reason to show in audit log, if needed." -msgstr "" +msgstr "Raison à montrer dans l'audit log, si besoin." #: interactions.api.http.channel.ChannelRequest.create_channel:9 of msgid "Channel object as dictionary." -msgstr "" +msgstr "Objet de type Canal en tant que dictionnaire." #: interactions.api.http.channel.ChannelRequest.move_channel:1 of msgid "Moves a channel to a new position." -msgstr "" +msgstr "Déplace un canal à une nouvelle position." #: interactions.api.http.channel.ChannelRequest.move_channel:5 of msgid "The new channel position." -msgstr "" +msgstr "La nouvelle position du canal." #: interactions.api.http.channel.ChannelRequest.move_channel:6 of msgid "The category parent ID, if needed." -msgstr "" +msgstr "L'ID de la catégorie parente, si besoin." #: interactions.api.http.channel.ChannelRequest.move_channel:7 of msgid "" "Sync permissions with the parent associated with parent_id. Defaults to " "False." -msgstr "" +msgstr "Synchroniser les permissions avec le parent associé au parent_id. " +"Par défaut: False." #: interactions.api.http.channel.ChannelRequest.move_channel:8 of msgid "Reason to display to the audit log, if any." -msgstr "" +msgstr "Raison à montrer dans l'audit log, si besoin." #: interactions.api.http.channel.ChannelRequest.move_channel:9 #: interactions.api.http.webhook.WebhookRequest.execute_github_webhook:7 #: interactions.api.http.webhook.WebhookRequest.execute_slack_webhook:7 of msgid "?" -msgstr "" +msgstr "?" #: interactions.api.http.channel.ChannelRequest.modify_channel:1 of msgid "Update a channel's settings." -msgstr "" +msgstr "Mettre à jour les paramètres d'un canal." #: interactions.api.http.channel.ChannelRequest.modify_channel:4 of msgid "Data representing updated settings." -msgstr "" +msgstr "Données représentant les paramètres mis à jour." #: interactions.api.http.channel.ChannelRequest.modify_channel:5 of msgid "Reason, if any." -msgstr "" +msgstr "Raison, si besoin." #: interactions.api.http.channel.ChannelRequest.modify_channel:6 of msgid "Channel with updated attributes, if successful." -msgstr "" +msgstr "Canal avec les attributs à jour, en cas de réussite." #: interactions.api.http.channel.ChannelRequest.get_channel_invites:1 of msgid "Get the invites for the channel." -msgstr "" +msgstr "Obtenir les invitations pour un canal." #: interactions.api.http.channel.ChannelRequest.get_channel_invites:4 of msgid "List of invite objects" -msgstr "" +msgstr "Liste des objets de type Invitation." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:1 of msgid "Creates an invite for the given channel." -msgstr "" +msgstr "Créer une invitation pour un canal." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:4 of msgid "This method does not handle payload. It just sends it." -msgstr "" +msgstr "Cette méthode ne gère pas le payload. Elle l'envoie juste." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:7 of msgid "Data representing the payload/invite attributes." -msgstr "" +msgstr "Données représentant les attributs de l'invitation." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:8 of msgid "Reason to show in the audit log, if any." -msgstr "" +msgstr "Raison à montrer dans l'audit log, si besoin." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:9 of msgid "An invite object." -msgstr "" +msgstr "Un objet de type Invitation." #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:1 of msgid "" "Edits the channel's permission overwrites for a user or role in a given " "channel." -msgstr "" +msgstr "Editer les permissions pour un utilisateur ou un role dans un " +"certain canal." #: interactions.api.http.channel.ChannelRequest.delete_channel_permission:4 #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:4 of msgid "The ID of the overridden object." -msgstr "" +msgstr "L'ID de l'objet supprimé." #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:5 of msgid "the bitwise value of all allowed permissions" -msgstr "" +msgstr "La valeur binaire de toutes les permissions autorisées." #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:6 of msgid "the bitwise value of all disallowed permissions" -msgstr "" +msgstr "La valeur binaire de toutes les permissions non autorisées." #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:7 of msgid "0 for a role or 1 for a member" -msgstr "" +msgstr "0 pour un role et 1 pour un membre" #: interactions.api.http.channel.ChannelRequest.delete_channel_permission:5 #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:8 of msgid "Reason to display in the Audit Log, if given." -msgstr "" +msgstr "Raison à montrer dans l'audit log, si besoin." #: interactions.api.http.channel.ChannelRequest.delete_channel_permission:1 of msgid "Deletes a channel permission overwrite for a user or role in a channel." -msgstr "" +msgstr "Supprimer les permissions pour un utilisateur ou un role dans un canal." #: interactions.api.http.channel.ChannelRequest.trigger_typing:1 of msgid "Posts \"... is typing\" in a given channel." -msgstr "" +msgstr "Poste \"... est en train d'écrire\" dans un canal." #: interactions.api.http.channel.ChannelRequest.trigger_typing:4 of msgid "" "By default, this lib doesn't use this endpoint, however, this is listed " "for third-party implementation." -msgstr "" +msgstr "Par défaut, la librairie n'utilise pas cet endpoint, mais elle est " +"listée pour les implémentations tierces." #: interactions.api.http.channel.ChannelRequest.get_pinned_messages:1 of msgid "Get all pinned messages from a channel." -msgstr "" +msgstr "Obtenir tout les messages épinglés d'un canal." #: interactions.api.http.channel.ChannelRequest.get_pinned_messages:4 of msgid "A list of pinned message objects." -msgstr "" +msgstr "Une liste des messages épinglés." #: interactions.api.http.channel.ChannelRequest.create_stage_instance:1 of msgid "Create a new stage instance." -msgstr "" +msgstr "Créer une nouvelle instange de stage." #: interactions.api.http.channel.ChannelRequest.create_stage_instance:4 of msgid "The topic of the stage instance. Limited to 1-120 characters." -msgstr "" +msgstr "Le sujet du stage. Limité à 1-120 caractères." #: interactions.api.http.channel.ChannelRequest.create_stage_instance:5 of msgid "The privacy_level of the stage instance (defaults to guild-only \"1\")." -msgstr "" +msgstr "Le niveau de confidentialité du stage (par défaut réservé à une guilde \"1\")." #: interactions.api.http.channel.ChannelRequest.create_stage_instance:6 #: interactions.api.http.channel.ChannelRequest.delete_stage_instance:4 #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:6 of msgid "The reason for the creating the stage instance, if any." -msgstr "" +msgstr "La raison pour créer un stage, si besoin." #: interactions.api.http.channel.ChannelRequest.create_stage_instance:7 of msgid "The new stage instance" -msgstr "" +msgstr "Le nouveau stage" #: interactions.api.http.channel.ChannelRequest.get_stage_instance:1 of msgid "Get the stage instance associated with a given channel, if it exists." -msgstr "" +msgstr "Obtenir un stage associé à un canal, s'il existe." #: interactions.api.http.channel.ChannelRequest.get_stage_instance:4 of msgid "A stage instance." -msgstr "" +msgstr "Un stage." #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:1 of msgid "Update the fields of a given stage instance." -msgstr "" +msgstr "Mettre à jour les attributs d'un stage." #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:4 of msgid "" "The new topic of the stage instance, if given. Limited to 1-120 " "characters." -msgstr "" +msgstr "Le nouveau sujet du stage, si besoin. Limité à 1-120 caractères." #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:5 of msgid "The new privacy_level of the stage instance." -msgstr "" +msgstr "Le nouveau niveau de confidentialité du stage." #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:7 of msgid "The updated stage instance." -msgstr "" +msgstr "Le stage mis à jour." #: interactions.api.http.channel.ChannelRequest.delete_stage_instance:1 of msgid "Delete a stage instance." -msgstr "" +msgstr "Supprimer un stage." #: interactions.api.http.emoji.EmojiRequest.get_all_emoji:1 of msgid "Gets all emojis from a guild." diff --git a/interactions/api/models/gw.py b/interactions/api/models/gw.py index b85db29cc..05045ae1e 100644 --- a/interactions/api/models/gw.py +++ b/interactions/api/models/gw.py @@ -1,17 +1,27 @@ from datetime import datetime -from typing import Any, List, Optional - -from .attrs_utils import ClientSerializerMixin, DictSerializerMixin, convert_list, define, field +from typing import Any, List, Optional, Union + +from ...client.models.component import ActionRow, Button, SelectMenu, _build_components +from ..error import LibraryException +from .attrs_utils import ( + MISSING, + ClientSerializerMixin, + DictSerializerMixin, + convert_list, + define, + field, +) from .channel import Channel, ThreadMember from .emoji import Emoji from .guild import EventMetadata from .member import Member -from .message import Sticker +from .message import Embed, Message, MessageInteraction, Sticker from .misc import ( AutoModAction, AutoModTriggerMetadata, AutoModTriggerType, ClientStatus, + File, IDMixin, Snowflake, ) @@ -249,6 +259,299 @@ class GuildMember(Member): guild_id: Snowflake = field(converter=Snowflake) + def __str__(self) -> str: + return self.name or "" + + @property + def avatar(self) -> Optional[str]: + return self._avatar or getattr(self.user, "avatar", None) + + @property + def id(self) -> Optional[Snowflake]: + """ + Returns the ID of the user. + + :return: The ID of the user + :rtype: Snowflake + """ + return self.user.id if self.user else None + + @property + def name(self) -> Optional[str]: + """ + Returns the string of either the user's nickname or username. + + :return: The name of the member + :rtype: str + """ + return self.nick or (self.user.username if self.user else None) + + @property + def mention(self) -> str: + """ + Returns a string that allows you to mention the given member. + + :return: The string of the mentioned member. + :rtype: str + """ + return f"<@!{self.user.id}>" if self.nick else f"<@{self.user.id}>" + + async def ban( + self, + reason: Optional[str] = None, + delete_message_days: Optional[int] = 0, + ) -> None: + """ + Bans the member from a guild. + + :param reason?: The reason of the ban + :type reason?: Optional[str] + :param delete_message_days?: Number of days to delete messages, from 0 to 7. Defaults to 0 + :type delete_message_days?: Optional[int] + """ + await self._client.create_guild_ban( + guild_id=int(self.guild_id), + user_id=int(self.user.id), + reason=reason, + delete_message_days=delete_message_days, + ) + + async def kick( + self, + reason: Optional[str] = None, + ) -> None: + """ + Kicks the member from a guild. + + :param reason?: The reason for the kick + :type reason?: Optional[str] + """ + if not self._client: + raise LibraryException(code=13) + await self._client.create_guild_kick( + guild_id=int(self.guild_id), + user_id=int(self.user.id), + reason=reason, + ) + + async def add_role( + self, + role: Union[Role, int], + reason: Optional[str] = None, + ) -> None: + """ + This method adds a role to a member. + + :param role: The role to add. Either ``Role`` object or role_id + :type role: Union[Role, int] + :param reason?: The reason why the roles are added + :type reason?: Optional[str] + """ + if not self._client: + raise LibraryException(code=13) + if isinstance(role, Role): + await self._client.add_member_role( + guild_id=int(self.guild_id), + user_id=int(self.user.id), + role_id=int(role.id), + reason=reason, + ) + else: + await self._client.add_member_role( + guild_id=int(self.guild_id), + user_id=int(self.user.id), + role_id=role, + reason=reason, + ) + + async def remove_role( + self, + role: Union[Role, int], + reason: Optional[str] = None, + ) -> None: + """ + This method removes a role from a member. + + :param role: The role to remove. Either ``Role`` object or role_id + :type role: Union[Role, int] + :param reason?: The reason why the roles are removed + :type reason?: Optional[str] + """ + if not self._client: + raise LibraryException(code=13) + if isinstance(role, Role): + await self._client.remove_member_role( + guild_id=int(self.guild_id), + user_id=int(self.user.id), + role_id=int(role.id), + reason=reason, + ) + else: + await self._client.remove_member_role( + guild_id=int(self.guild_id), + user_id=int(self.user.id), + role_id=role, + reason=reason, + ) + + async def send( + self, + content: Optional[str] = MISSING, + *, + components: Optional[ + Union[ + ActionRow, + Button, + SelectMenu, + List[ActionRow], + List[Button], + List[SelectMenu], + ] + ] = MISSING, + tts: Optional[bool] = MISSING, + files: Optional[Union[File, List[File]]] = MISSING, + embeds: Optional[Union[Embed, List[Embed]]] = MISSING, + allowed_mentions: Optional[MessageInteraction] = MISSING, + ) -> Message: + """ + Sends a DM to the member. + + :param content?: The contents of the message as a string or string-converted value. + :type content?: Optional[str] + :param components?: A component, or list of components for the message. + :type components?: Optional[Union[ActionRow, Button, SelectMenu, List[Actionrow], List[Button], List[SelectMenu]]] + :param tts?: Whether the message utilizes the text-to-speech Discord programme or not. + :type tts?: Optional[bool] + :param files?: A file or list of files to be attached to the message. + :type files?: Optional[Union[File, List[File]]] + :param embeds?: An embed, or list of embeds for the message. + :type embeds?: Optional[Union[Embed, List[Embed]]] + :param allowed_mentions?: The message interactions/mention limits that the message can refer to. + :type allowed_mentions?: Optional[MessageInteraction] + :return: The sent message as an object. + :rtype: Message + """ + if not self._client: + raise LibraryException(code=13) + + _content: str = "" if content is MISSING else content + _tts: bool = False if tts is MISSING else tts + # _file = None if file is None else file + # _attachments = [] if attachments else None + _embeds: list = ( + [] + if not embeds or embeds is MISSING + else ([embed._json for embed in embeds] if isinstance(embeds, list) else [embeds._json]) + ) + _allowed_mentions: dict = {} if allowed_mentions is MISSING else allowed_mentions + if not components or components is MISSING: + _components = [] + else: + _components = _build_components(components=components) + + if not files or files is MISSING: + _files = [] + elif isinstance(files, list): + _files = [file._json_payload(id) for id, file in enumerate(files)] + else: + _files = [files._json_payload(0)] + files = [files] + + payload = dict( + content=_content, + tts=_tts, + attachments=_files, + embeds=_embeds, + components=_components, + allowed_mentions=_allowed_mentions, + ) + + channel = Channel( + **await self._client.create_dm(recipient_id=int(self.user.id)), _client=self._client + ) + res = await self._client.create_message( + channel_id=int(channel.id), payload=payload, files=files + ) + + return Message(**res, _client=self._client) + + async def modify( + self, + nick: Optional[str] = MISSING, + roles: Optional[List[int]] = MISSING, + mute: Optional[bool] = MISSING, + deaf: Optional[bool] = MISSING, + channel_id: Optional[int] = MISSING, + communication_disabled_until: Optional[datetime.isoformat] = MISSING, + reason: Optional[str] = None, + ) -> "GuildMember": + """ + Modifies the member of a guild. + + :param nick?: The nickname of the member + :type nick?: Optional[str] + :param roles?: A list of all role ids the member has + :type roles?: Optional[List[int]] + :param mute?: whether the user is muted in voice channels + :type mute?: Optional[bool] + :param deaf?: whether the user is deafened in voice channels + :type deaf?: Optional[bool] + :param channel_id?: id of channel to move user to (if they are connected to voice) + :type channel_id?: Optional[int] + :param communication_disabled_until?: when the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future) + :type communication_disabled_until?: Optional[datetime.isoformat] + :param reason?: The reason of the modifying + :type reason?: Optional[str] + :return: The modified member object + :rtype: Member + """ + if not self._client: + raise LibraryException(code=13) + payload = {} + if nick is not MISSING: + payload["nick"] = nick + + if roles is not MISSING: + payload["roles"] = roles + + if channel_id is not MISSING: + payload["channel_id"] = channel_id + + if mute is not MISSING: + payload["mute"] = mute + + if deaf is not MISSING: + payload["deaf"] = deaf + + if communication_disabled_until is not MISSING: + payload["communication_disabled_until"] = communication_disabled_until + + res = await self._client.modify_member( + user_id=int(self.user.id), + guild_id=int(self.guild_id), + payload=payload, + reason=reason, + ) + self.update(res) + return GuildMember(**res, _client=self._client, guild_id=self.guild_id) + + async def add_to_thread( + self, + thread_id: int, + ) -> None: + """ + Adds the member to a thread. + + :param thread_id: The id of the thread to add the member to + :type thread_id: int + """ + if not self._client: + raise LibraryException(code=13) + await self._client.add_member_to_thread( + user_id=int(self.user.id), + thread_id=thread_id, + ) + @define() class GuildMembers(DictSerializerMixin): From 2268114ac580b403b85934f4ee8a7a47a38f83b9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 20 Aug 2022 09:19:04 +0000 Subject: [PATCH 4/7] ci: correct from checks. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f0d487dfa..304e4fd30 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ __pycache__ *.token *.pypirc *.code-workspace -*.mo \ No newline at end of file +*.mo From de4d9d8813de34be2e82b1b8690540c6af41998f Mon Sep 17 00:00:00 2001 From: mAxYoLo01 Date: Sat, 20 Aug 2022 11:33:18 +0200 Subject: [PATCH 5/7] fix: remove other branch git sorcery --- .gitignore | 1 - docs/conf.py | 2 +- docs/locale/fr/LC_MESSAGES/api.http.po | 219 ++++++++++++------------- 3 files changed, 104 insertions(+), 118 deletions(-) diff --git a/.gitignore b/.gitignore index 304e4fd30..e61e0a37c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,3 @@ __pycache__ *.token *.pypirc *.code-workspace -*.mo diff --git a/docs/conf.py b/docs/conf.py index 408cc4525..1a03373e6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,7 +66,7 @@ # Language is commented out because of PR reviews. In a RTD-hosted case, # the variable seems to be skipped. -language = "fr" +language = "de" locale_dirs = ["locale/"] gettext_compact = True diff --git a/docs/locale/fr/LC_MESSAGES/api.http.po b/docs/locale/fr/LC_MESSAGES/api.http.po index e07fb1420..39de3aec9 100644 --- a/docs/locale/fr/LC_MESSAGES/api.http.po +++ b/docs/locale/fr/LC_MESSAGES/api.http.po @@ -2,7 +2,7 @@ # Copyright (C) 2022, goverfl0w # This file is distributed under the same license as the interactions.py # package. -# mAxYoLo01 - maxyolo01.ytb@gmail.com - mAxYoLo01#4491, 2022. +# FIRST AUTHOR , 2022. # #, fuzzy msgid "" @@ -11,12 +11,12 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-07-17 16:00-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: mAxYoLo01 - maxyolo01.ytb@gmail.com - mAxYoLo01#4491\n" -"Language-Team: None\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: mAxYoLo01\n" +"Generated-By: Babel 2.9.1\n" #: ../../api.http.rst:4 msgid "HTTP" @@ -24,33 +24,33 @@ msgstr "" #: interactions.api.http.route.Route:1 of msgid "A class representing how an HTTP route is structured." -msgstr "Une classe représentant la structure d'une route HTTP." +msgstr "" #: interactions.api.http.client.HTTPClient #: interactions.api.http.limiter.Limiter interactions.api.http.request._Request #: interactions.api.http.route.Route of msgid "Variables" -msgstr "Variables" +msgstr "" #: interactions.api.http.route.Route:3 of msgid "The HTTP route path." -msgstr "Le chemin d'accès HTTP." +msgstr "" #: interactions.api.http.route.Route:4 of msgid "The HTTP method." -msgstr "La méthode HTTP." +msgstr "" #: interactions.api.http.route.Route:5 of msgid "The URL path." -msgstr "Le chemin URL." +msgstr "" #: interactions.api.http.route.Route:6 of msgid "The channel ID from the bucket if given." -msgstr "L'ID du canal du bucket, s'il est donné." +msgstr "" #: interactions.api.http.route.Route:7 of msgid "The guild ID from the bucket if given." -msgstr "L'ID du serveur du bucket, s'il est donné." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel #: interactions.api.http.channel.ChannelRequest.create_channel_invite @@ -196,7 +196,7 @@ msgstr "L'ID du serveur du bucket, s'il est donné." #: interactions.api.http.webhook.WebhookRequest.get_webhook_message #: interactions.api.http.webhook.WebhookRequest.modify_webhook of msgid "Parameters" -msgstr "Paramètres" +msgstr "" #: interactions.api.http.channel.ChannelRequest #: interactions.api.http.channel.ChannelRequest.create_channel @@ -364,19 +364,17 @@ msgstr "Paramètres" #: interactions.api.http.webhook.WebhookRequest.get_webhook_message #: interactions.api.http.webhook.WebhookRequest.modify_webhook of msgid "Return type" -msgstr "Type de retour" +msgstr "" #: interactions.api.http.route.Route.get_bucket:1 of msgid "" "Returns the route's bucket. If shared_bucket is None, returns the path " "with major parameters. Otherwise, it relies on Discord's given bucket." msgstr "" -"Renvoie le bucket de la route. Si shared_bucket est None, renvoie le chemin" -"avec les paramètres majeurs. Sinon, il s'appuie sur le bucket donné par Discord." #: interactions.api.http.route.Route.get_bucket:4 of msgid "The bucket that Discord provides, if available." -msgstr "Le bucket que Discord fournit, s'il y en a un." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel #: interactions.api.http.channel.ChannelRequest.create_channel_invite @@ -476,153 +474,146 @@ msgstr "Le bucket que Discord fournit, s'il y en a un." #: interactions.api.http.webhook.WebhookRequest.get_webhook_message #: interactions.api.http.webhook.WebhookRequest.modify_webhook of msgid "Returns" -msgstr "Retourne" +msgstr "" #: interactions.api.http.route.Route.get_bucket:7 of msgid "The route bucket." -msgstr "Le bucket de la route." +msgstr "" #: interactions.api.http.route.Route.endpoint:1 of msgid "Returns the route's endpoint." -msgstr "Retourne l'endpoint de la route." +msgstr "" #: interactions.api.http.route.Route.endpoint:3 of msgid "The route endpoint." -msgstr "L'endpoint de la route." +msgstr "" #: interactions.api.http.limiter.Limiter:1 of msgid "A class representing a limitation for an HTTP request." -msgstr "Une classe représentatn une limitation pour une requête HTTP." +msgstr "" #: interactions.api.http.limiter.Limiter:3 of msgid "The \"lock\" or controller of the request." -msgstr "Le \"lock\" ou contrôleur de la requête." +msgstr "" #: interactions.api.http.limiter.Limiter:4 of msgid "The remaining time before the request can be ran." -msgstr "Le temps restant avant que la requête puisse être exécutée." +msgstr "" #: interactions.api.http.request._Request:1 of msgid "A class representing how HTTP requests are sent/read." -msgstr "Une classe représentant la façon dont les requêtes HTTP " -"sont lues/envoyées." +msgstr "" #: interactions.api.http.request._Request:3 of msgid "The current application token." -msgstr "Le token de l'application." +msgstr "" #: interactions.api.http.request._Request:4 of msgid "The current coroutine event loop." -msgstr "La boucle d'événement de la coroutine actuelle." +msgstr "" #: interactions.api.http.request._Request:5 of msgid "The current per-route rate limiters from the API." -msgstr "Les limiteurs par-route actuels de l'API." +msgstr "" #: interactions.api.http.request._Request:6 of msgid "The current endpoint to shared_bucket cache from the API." -msgstr "Le cache de l'API de l'endpoint actuel au shared_bucket." +msgstr "" #: interactions.api.http.request._Request:7 of msgid "The current headers for an HTTP request." -msgstr "Les headers actuels de la requête HTTP." +msgstr "" #: interactions.api.http.request._Request:8 of msgid "The current session for making requests." -msgstr "La session actuelle pour exécuter les requêtes." +msgstr "" #: interactions.api.http.request._Request:9 of msgid "The global rate limiter." -msgstr "Le limiteur global." +msgstr "" #: interactions.api.http.request._Request._check_session:1 of msgid "Ensures that we have a valid connection session." -msgstr "S'assure qu'il y a une session de connexion valide." +msgstr "" #: interactions.api.http.request._Request._check_lock:1 of msgid "Checks the global lock for its current state." -msgstr "Vérifie l'état actuel du lock global." +msgstr "" #: interactions.api.http.request._Request.request:1 of msgid "Sends a request to the Discord API." -msgstr "Envoie une requête à l'API Discord." +msgstr "" #: interactions.api.http.request._Request.request:3 of msgid "The HTTP route to request." -msgstr "La route HTTP de la requête." +msgstr "" #: interactions.api.http.request._Request.request:5 of msgid "Optional keyword-only arguments to pass as information in the request." -msgstr "Arguments nommés facultatifs à transmettre comme information dans la requête." +msgstr "" #: interactions.api.http.request._Request.request:7 of msgid "The contents of the request if any." -msgstr "Le contenu de la requête, s'il y en a." +msgstr "" #: interactions.api.http.request._Request.close:1 of msgid "Closes the current session." -msgstr "Ferme la session actuelle." +msgstr "" #: interactions.api.http.client.HTTPClient:1 of msgid "The user-facing client of the Web API for individual endpoints." -msgstr "Le client utilisateur de l'API Web pour les endpoints individuels." +msgstr "" #: interactions.api.http.client.HTTPClient:3 of msgid "The token of the application." -msgstr "Le token de l'application." +msgstr "" #: interactions.api.http.client.HTTPClient:4 of msgid "The requesting interface for endpoints." -msgstr "L'interface demandée pour les endpoints." +msgstr "" #: interactions.api.http.client.HTTPClient:5 of msgid "The referenced cache." -msgstr "Le cache référencé." +msgstr "" #: interactions.api.http.client.HTTPClient.get_gateway:1 of msgid "" "This calls the Gateway endpoint and returns a v9 gateway link with JSON " "encoding." msgstr "" -"Appelle l'endpoint de la gateway et retourne un lien de la v9 avec un encodage" -"JSON." #: interactions.api.http.client.HTTPClient.get_bot_gateway:1 of msgid "This calls the BOT Gateway endpoint." -msgstr "Appelle l'endpoint BOT de la gateway." +msgstr "" #: interactions.api.http.client.HTTPClient.get_bot_gateway:3 of msgid "A tuple denoting (shard, gateway_url), url from API v9 and JSON encoding" -msgstr "Un tuple indiquant (shard, gateway_url), URL de l'API v9 et encodage JSON." +msgstr "" #: interactions.api.http.client.HTTPClient.login:1 of msgid "" "This 'logins' to the gateway, which makes it available to use any other " "endpoint." msgstr "" -"Se connecter à la geteway, ce qui la rend disponible pour utiliser" -"n'importe quel endpoint." #: interactions.api.http.client.HTTPClient.logout:1 of msgid "This 'log outs' the session." -msgstr "Déconnecte la session." +msgstr "" #: interactions.api.http.client.HTTPClient.get_current_bot_information:1 of msgid "Returns the bot user application object without flags." -msgstr "Retourne l'Application du bot sans les flags." +msgstr "" #: interactions.api.http.client.HTTPClient.get_current_authorisation_information:1 #: of msgid "Returns info about the current authorization of the bot user" -msgstr "Retourne des informations sur les autorisations actuelle du bot" +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel:1 of msgid "" "Gets a channel by ID. If the channel is a thread, it also includes thread" " members (and other thread attributes)." msgstr "" -"Obtenir un canal via son ID. Si le canal est un thread, alors il inclut" -"également les membres du thread (et d'autres attributs d'un thread)." #: interactions.api.http.channel.ChannelRequest.create_channel_invite:6 #: interactions.api.http.channel.ChannelRequest.create_stage_instance:3 @@ -643,56 +634,55 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.create_webhook:3 #: interactions.api.http.webhook.WebhookRequest.get_channel_webhooks:3 of msgid "Channel ID snowflake." -msgstr "Snowflake de l'ID du canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel:4 of msgid "Dictionary of the channel object." -msgstr "Dictionnaire d'un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.delete_channel:1 of msgid "Deletes a channel." -msgstr "Supprimer un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.delete_channel:3 of msgid "Channel ID snowflake" -msgstr "Snowflake de l'ID du canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:1 of msgid "Get messages from a channel." -msgstr "Obtenir les messages d'un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:4 of msgid "around, before, and after arguments are mutually exclusive." -msgstr "around, before, et after sont des argument qui s'excluent" -"mutuellement." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:7 of msgid "How many messages to get. Defaults to 50, the max is 100." -msgstr "Combien de messages à obtenir. Par défaut à 50, le maximum est 100." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:8 of msgid "Get messages around this snowflake ID." -msgstr "Obtenir des messages autour de cet ID." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:9 of msgid "Get messages before this snowflake ID." -msgstr "Obtenir des messages avant cet ID." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:10 of msgid "Get messages after this snowflake ID." -msgstr "Obtenir des messages après cet ID." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_messages:11 of msgid "An array of Message objects." -msgstr "Un tableau de Messages." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel:1 of msgid "Creates a channel within a guild." -msgstr "Créer un canal dans une guilde." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel:4 of msgid "This does not handle payload in this method. Tread carefully." -msgstr "Cette méthode ne gère pas le payload. Faites attention." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel:6 #: interactions.api.http.channel.ChannelRequest.move_channel:3 @@ -741,196 +731,193 @@ msgstr "Cette méthode ne gère pas le payload. Faites attention." #: interactions.api.http.scheduledEvent.ScheduledEventRequest.modify_scheduled_event:3 #: of msgid "Guild ID snowflake." -msgstr "Snowflake de l'ID de la guilde." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel:7 of msgid "Payload data." -msgstr "Données du payload." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel:8 of msgid "Reason to show in audit log, if needed." -msgstr "Raison à montrer dans l'audit log, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel:9 of msgid "Channel object as dictionary." -msgstr "Objet de type Canal en tant que dictionnaire." +msgstr "" #: interactions.api.http.channel.ChannelRequest.move_channel:1 of msgid "Moves a channel to a new position." -msgstr "Déplace un canal à une nouvelle position." +msgstr "" #: interactions.api.http.channel.ChannelRequest.move_channel:5 of msgid "The new channel position." -msgstr "La nouvelle position du canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.move_channel:6 of msgid "The category parent ID, if needed." -msgstr "L'ID de la catégorie parente, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.move_channel:7 of msgid "" "Sync permissions with the parent associated with parent_id. Defaults to " "False." -msgstr "Synchroniser les permissions avec le parent associé au parent_id. " -"Par défaut: False." +msgstr "" #: interactions.api.http.channel.ChannelRequest.move_channel:8 of msgid "Reason to display to the audit log, if any." -msgstr "Raison à montrer dans l'audit log, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.move_channel:9 #: interactions.api.http.webhook.WebhookRequest.execute_github_webhook:7 #: interactions.api.http.webhook.WebhookRequest.execute_slack_webhook:7 of msgid "?" -msgstr "?" +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_channel:1 of msgid "Update a channel's settings." -msgstr "Mettre à jour les paramètres d'un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_channel:4 of msgid "Data representing updated settings." -msgstr "Données représentant les paramètres mis à jour." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_channel:5 of msgid "Reason, if any." -msgstr "Raison, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_channel:6 of msgid "Channel with updated attributes, if successful." -msgstr "Canal avec les attributs à jour, en cas de réussite." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_invites:1 of msgid "Get the invites for the channel." -msgstr "Obtenir les invitations pour un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_channel_invites:4 of msgid "List of invite objects" -msgstr "Liste des objets de type Invitation." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel_invite:1 of msgid "Creates an invite for the given channel." -msgstr "Créer une invitation pour un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel_invite:4 of msgid "This method does not handle payload. It just sends it." -msgstr "Cette méthode ne gère pas le payload. Elle l'envoie juste." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel_invite:7 of msgid "Data representing the payload/invite attributes." -msgstr "Données représentant les attributs de l'invitation." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel_invite:8 of msgid "Reason to show in the audit log, if any." -msgstr "Raison à montrer dans l'audit log, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_channel_invite:9 of msgid "An invite object." -msgstr "Un objet de type Invitation." +msgstr "" #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:1 of msgid "" "Edits the channel's permission overwrites for a user or role in a given " "channel." -msgstr "Editer les permissions pour un utilisateur ou un role dans un " -"certain canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.delete_channel_permission:4 #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:4 of msgid "The ID of the overridden object." -msgstr "L'ID de l'objet supprimé." +msgstr "" #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:5 of msgid "the bitwise value of all allowed permissions" -msgstr "La valeur binaire de toutes les permissions autorisées." +msgstr "" #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:6 of msgid "the bitwise value of all disallowed permissions" -msgstr "La valeur binaire de toutes les permissions non autorisées." +msgstr "" #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:7 of msgid "0 for a role or 1 for a member" -msgstr "0 pour un role et 1 pour un membre" +msgstr "" #: interactions.api.http.channel.ChannelRequest.delete_channel_permission:5 #: interactions.api.http.channel.ChannelRequest.edit_channel_permission:8 of msgid "Reason to display in the Audit Log, if given." -msgstr "Raison à montrer dans l'audit log, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.delete_channel_permission:1 of msgid "Deletes a channel permission overwrite for a user or role in a channel." -msgstr "Supprimer les permissions pour un utilisateur ou un role dans un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.trigger_typing:1 of msgid "Posts \"... is typing\" in a given channel." -msgstr "Poste \"... est en train d'écrire\" dans un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.trigger_typing:4 of msgid "" "By default, this lib doesn't use this endpoint, however, this is listed " "for third-party implementation." -msgstr "Par défaut, la librairie n'utilise pas cet endpoint, mais elle est " -"listée pour les implémentations tierces." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_pinned_messages:1 of msgid "Get all pinned messages from a channel." -msgstr "Obtenir tout les messages épinglés d'un canal." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_pinned_messages:4 of msgid "A list of pinned message objects." -msgstr "Une liste des messages épinglés." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_stage_instance:1 of msgid "Create a new stage instance." -msgstr "Créer une nouvelle instange de stage." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_stage_instance:4 of msgid "The topic of the stage instance. Limited to 1-120 characters." -msgstr "Le sujet du stage. Limité à 1-120 caractères." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_stage_instance:5 of msgid "The privacy_level of the stage instance (defaults to guild-only \"1\")." -msgstr "Le niveau de confidentialité du stage (par défaut réservé à une guilde \"1\")." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_stage_instance:6 #: interactions.api.http.channel.ChannelRequest.delete_stage_instance:4 #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:6 of msgid "The reason for the creating the stage instance, if any." -msgstr "La raison pour créer un stage, si besoin." +msgstr "" #: interactions.api.http.channel.ChannelRequest.create_stage_instance:7 of msgid "The new stage instance" -msgstr "Le nouveau stage" +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_stage_instance:1 of msgid "Get the stage instance associated with a given channel, if it exists." -msgstr "Obtenir un stage associé à un canal, s'il existe." +msgstr "" #: interactions.api.http.channel.ChannelRequest.get_stage_instance:4 of msgid "A stage instance." -msgstr "Un stage." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:1 of msgid "Update the fields of a given stage instance." -msgstr "Mettre à jour les attributs d'un stage." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:4 of msgid "" "The new topic of the stage instance, if given. Limited to 1-120 " "characters." -msgstr "Le nouveau sujet du stage, si besoin. Limité à 1-120 caractères." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:5 of msgid "The new privacy_level of the stage instance." -msgstr "Le nouveau niveau de confidentialité du stage." +msgstr "" #: interactions.api.http.channel.ChannelRequest.modify_stage_instance:7 of msgid "The updated stage instance." -msgstr "Le stage mis à jour." +msgstr "" #: interactions.api.http.channel.ChannelRequest.delete_stage_instance:1 of msgid "Delete a stage instance." -msgstr "Supprimer un stage." +msgstr "" #: interactions.api.http.emoji.EmojiRequest.get_all_emoji:1 of msgid "Gets all emojis from a guild." @@ -2755,4 +2742,4 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.delete_original_webhook_message:1 #: of msgid "Deletes the original message object sent." -msgstr "" +msgstr "" \ No newline at end of file From f4d0011b1f6b833c98a87ed39e094a90638ef6ab Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 20 Aug 2022 09:33:37 +0000 Subject: [PATCH 6/7] ci: correct from checks. --- docs/locale/fr/LC_MESSAGES/api.http.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/locale/fr/LC_MESSAGES/api.http.po b/docs/locale/fr/LC_MESSAGES/api.http.po index 39de3aec9..b141f2d87 100644 --- a/docs/locale/fr/LC_MESSAGES/api.http.po +++ b/docs/locale/fr/LC_MESSAGES/api.http.po @@ -2742,4 +2742,4 @@ msgstr "" #: interactions.api.http.webhook.WebhookRequest.delete_original_webhook_message:1 #: of msgid "Deletes the original message object sent." -msgstr "" \ No newline at end of file +msgstr "" From 34a6efbee8230870f604bb57ef32247723559fde Mon Sep 17 00:00:00 2001 From: mAxYoLo01 Date: Sat, 20 Aug 2022 11:35:55 +0200 Subject: [PATCH 7/7] fix: last github fix --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 1a03373e6..c40b3032c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,7 +66,7 @@ # Language is commented out because of PR reviews. In a RTD-hosted case, # the variable seems to be skipped. -language = "de" +# language = "de" locale_dirs = ["locale/"] gettext_compact = True