From bd100dd1b615fae4714a79fe515a73dd5c38043a Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Sun, 2 Jan 2022 04:17:52 -0500 Subject: [PATCH 01/23] :bug: message update no longer causes bug --- pincer/commands/commands.py | 2 +- pincer/objects/message/user_message.py | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pincer/commands/commands.py b/pincer/commands/commands.py index 9dbbac90..5050acab 100644 --- a/pincer/commands/commands.py +++ b/pincer/commands/commands.py @@ -486,7 +486,7 @@ async def test_message_command( def register_command( - func=None, # Missing typehint? + func: function=None, # Missing typehint? *, app_command_type: Optional[AppCommandType] = None, name: Optional[str] = None, diff --git a/pincer/objects/message/user_message.py b/pincer/objects/message/user_message.py index d022b693..8b42ba9f 100644 --- a/pincer/objects/message/user_message.py +++ b/pincer/objects/message/user_message.py @@ -327,20 +327,24 @@ class UserMessage(APIObject, GuildProperty, ChannelProperty): # noqa: E501 + # Always gaurenteed id: Snowflake channel_id: Snowflake - author: User - content: str - timestamp: Timestamp - tts: bool - mention_everyone: bool - mentions: List[GuildMember] - mention_roles: List[Role] - attachments: List[Attachment] - embeds: List[Embed] - pinned: bool - type: MessageType + # Only gaurenteed in Message Create event + author: APINullable[User] = MISSING + content: APINullable[str] = MISSING + timestamp: APINullable[Timestamp] = MISSING + tts: APINullable[bool] = MISSING + mention_everyone: APINullable[bool] = MISSING + mentions: APINullable[List[GuildMember]] = MISSING + mention_roles: APINullable[List[Role]] = MISSING + attachments: APINullable[List[Attachment]] = MISSING + embeds: APINullable[List[Embed]] = MISSING + pinned: APINullable[bool] = MISSING + type: APINullable[MessageType] = MISSING + + # Never gaurenteed edited_timestamp: APINullable[Timestamp] = MISSING mention_channels: APINullable[List[ChannelMention]] = MISSING guild_id: APINullable[Snowflake] = MISSING From accc63f66f96fc46cef9d6d0eb5b52a169f9a69b Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Sun, 2 Jan 2022 04:19:33 -0500 Subject: [PATCH 02/23] :art: fixed where # noqa is --- pincer/commands/commands.py | 2 +- pincer/objects/message/user_message.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pincer/commands/commands.py b/pincer/commands/commands.py index 5050acab..9dbbac90 100644 --- a/pincer/commands/commands.py +++ b/pincer/commands/commands.py @@ -486,7 +486,7 @@ async def test_message_command( def register_command( - func: function=None, # Missing typehint? + func=None, # Missing typehint? *, app_command_type: Optional[AppCommandType] = None, name: Optional[str] = None, diff --git a/pincer/objects/message/user_message.py b/pincer/objects/message/user_message.py index 8b42ba9f..633f9f86 100644 --- a/pincer/objects/message/user_message.py +++ b/pincer/objects/message/user_message.py @@ -323,9 +323,7 @@ class UserMessage(APIObject, GuildProperty, ChannelProperty): action rows, or other interactive components sticker_items: APINullable[List[:class:`~pincer.objects.message.sticker.StickerItem`]] Sent if the message contains stickers - """ - - # noqa: E501 + """ # noqa: E501 # Always gaurenteed id: Snowflake From 1fd6901e44e88109827aadbaec44933815b4d385 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Sun, 2 Jan 2022 04:23:08 -0500 Subject: [PATCH 03/23] :skull: fix spelling --- pincer/objects/message/user_message.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pincer/objects/message/user_message.py b/pincer/objects/message/user_message.py index 633f9f86..2770811e 100644 --- a/pincer/objects/message/user_message.py +++ b/pincer/objects/message/user_message.py @@ -325,11 +325,11 @@ class UserMessage(APIObject, GuildProperty, ChannelProperty): Sent if the message contains stickers """ # noqa: E501 - # Always gaurenteed + # Always guaranteed id: Snowflake channel_id: Snowflake - # Only gaurenteed in Message Create event + # Only guaranteed in Message Create event author: APINullable[User] = MISSING content: APINullable[str] = MISSING timestamp: APINullable[Timestamp] = MISSING @@ -342,7 +342,7 @@ class UserMessage(APIObject, GuildProperty, ChannelProperty): pinned: APINullable[bool] = MISSING type: APINullable[MessageType] = MISSING - # Never gaurenteed + # Never guaranteed edited_timestamp: APINullable[Timestamp] = MISSING mention_channels: APINullable[List[ChannelMention]] = MISSING guild_id: APINullable[Snowflake] = MISSING From 09f6250daa7aaa8aabd7ab26ef67500d29526629 Mon Sep 17 00:00:00 2001 From: sigmanificient Date: Sun, 2 Jan 2022 22:05:28 +0100 Subject: [PATCH 04/23] :sparkles: Adding Interaction Flag support for list to message --- pincer/utils/convert_message.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pincer/utils/convert_message.py b/pincer/utils/convert_message.py index 7dd16e3b..a3d94c2a 100644 --- a/pincer/utils/convert_message.py +++ b/pincer/utils/convert_message.py @@ -3,6 +3,7 @@ from __future__ import annotations +from collections.abc import Iterable from typing import TYPE_CHECKING, Tuple, List from typing import Union @@ -71,3 +72,5 @@ def list_to_message_dict(item, kwargs): kwargs["components"].append(item) elif isinstance(item, str): kwargs["content"] = item + elif isinstance(item, InteractionFlags): + kwargs["flags"] = item From 5151045716126e0089c5e4761a3f2e21d3c5955e Mon Sep 17 00:00:00 2001 From: sigmanificient Date: Sun, 2 Jan 2022 22:06:06 +0100 Subject: [PATCH 05/23] :recycle: Using collection to improve convert_message --- pincer/utils/convert_message.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pincer/utils/convert_message.py b/pincer/utils/convert_message.py index a3d94c2a..e56408ba 100644 --- a/pincer/utils/convert_message.py +++ b/pincer/utils/convert_message.py @@ -3,6 +3,7 @@ from __future__ import annotations +from collections import defaultdict from collections.abc import Iterable from typing import TYPE_CHECKING, Tuple, List from typing import Union @@ -42,8 +43,8 @@ def convert_message(client: Client, message: MessageConvertable) -> Message: :class:`~pincer.objects.message.message.Message` The message object to be sent """ - if message and isinstance(message, (tuple, list)): - kwargs = {"attachments": [], "embeds": [], "components": []} + if message and isinstance(message, Iterable): + kwargs = defaultdict(list) for item in message: list_to_message_dict(item, kwargs) message = Message(**kwargs) From fa6bfc70774e29ea10fea9ad3c8cf8c41d8882bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jan 2022 13:35:25 +0000 Subject: [PATCH 06/23] :arrow_up: Bump pillow from 8.4.0 to 9.0.0 Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.4.0 to 9.0.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](https://github.com/python-pillow/Pillow/compare/8.4.0...9.0.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Pipfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pipfile b/Pipfile index f3681f0f..78ac8801 100644 --- a/Pipfile +++ b/Pipfile @@ -6,7 +6,7 @@ name = "pypi" [packages] websockets = ">=10.0" aiohttp = ">=3.7.4post0,<4.1.0" -Pillow = "==8.4.0" +Pillow = "==9.0.0" [dev-packages] flake8 = "==4.0.1" From 70e7485803ab95c19bd94ca4a8bbe489919bee86 Mon Sep 17 00:00:00 2001 From: drawbu <69208565+drawbu@users.noreply.github.com> Date: Tue, 4 Jan 2022 22:39:19 +0100 Subject: [PATCH 07/23] :sparkles: Adding Pillow Images support for list to message --- pincer/utils/convert_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pincer/utils/convert_message.py b/pincer/utils/convert_message.py index e56408ba..85e53dce 100644 --- a/pincer/utils/convert_message.py +++ b/pincer/utils/convert_message.py @@ -67,7 +67,7 @@ def convert_message(client: Client, message: MessageConvertable) -> Message: def list_to_message_dict(item, kwargs): if isinstance(item, Embed): kwargs["embeds"].append(item) - elif PILLOW_IMPORT and isinstance(item, File): + elif isinstance(item, File) or (PILLOW_IMPORT and isinstance(item, Image)): kwargs["attachments"].append(item) elif isinstance(item, MessageComponent): kwargs["components"].append(item) From 1054872c33cc5453d53277a6761a28ec12a884f4 Mon Sep 17 00:00:00 2001 From: David L <48654552+DarviL82@users.noreply.github.com> Date: Wed, 5 Jan 2022 03:03:15 +0100 Subject: [PATCH 08/23] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Added=20query=20para?= =?UTF-8?q?ms=20parameter=20to=20HTTP=20get=20requests=20(#343)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ♻️ Added query params parameter to http get requests * ♻️ moved `remove_none()` to the http class * 💬 Using `Dict` instead `dict` typehint * ♻️ Added `remove_none()` for headers too --- pincer/core/http.py | 78 +++++++++++++++++--------- pincer/objects/guild/channel.py | 43 ++++++++------ pincer/objects/guild/guild.py | 58 ++++++++++--------- pincer/objects/guild/webhook.py | 4 +- pincer/objects/message/sticker.py | 2 +- pincer/objects/message/user_message.py | 4 +- 6 files changed, 117 insertions(+), 72 deletions(-) diff --git a/pincer/core/http.py b/pincer/core/http.py index d302bd8a..c8c831cb 100644 --- a/pincer/core/http.py +++ b/pincer/core/http.py @@ -19,6 +19,7 @@ ForbiddenError, MethodNotAllowedError, RateLimitError, ServerError, HTTPError ) +from ..utils.conversion import remove_none if TYPE_CHECKING: from typing import Any, Dict, Optional, Union @@ -114,28 +115,40 @@ async def __send( content_type: str = "application/json", data: Optional[Union[Dict, str, Payload]] = None, headers: Optional[Dict[str, Any]] = None, + params: Optional[Dict] = None, __ttl: int = None ) -> Optional[Dict]: """ Send an api request to the Discord REST API. - method: + Parameters + ---------- + + method: :class:`aiohttp.ClientSession.request` The method for the request. (e.g. GET or POST) - endpoint: + endpoint: :class:`str` The endpoint to which the request will be sent. - Keyword Arguments: - - content_type: + content_type: :class:`str` The request's content type. - data: + data: Optional[Union[:class:`Dict`, :class:`str`, :class:`aiohttp.payload.Payload`]] The data which will be added to the request. + |default| :data:`None` + + headers: Optional[:class:`Dict`] + The request headers. + |default| :data:`None` + + params: Optional[:class:`Dict`] + The query parameters to add to the request. + |default| :data:`None` - __ttl: + __ttl: Optional[:class:`int`] Private param used for recursively setting the retry amount. (Eg set to 1 for 1 max retry) + |default| :data:`None` """ ttl = __ttl or self.max_ttl @@ -166,8 +179,9 @@ async def __send( data=data, headers={ "Content-Type": content_type, - **(headers or {}) - } + **(remove_none(headers) or {}) + }, + params=remove_none(params) ) as res: return await self.__handle_response( res, method, endpoint, content_type, data, ttl @@ -188,22 +202,25 @@ async def __handle_response( Side effects: If a 5xx error code is returned it will retry the request. - res: + Parameters + ---------- + + res: :class:`aiohttp.ClientResponse` The response from the discord API. - method: + method: :class:`aiohttp.ClientSession.request` The method which was used to call the endpoint. - endpoint: + endpoint: :class:`str` The endpoint to which the request was sent. - content_type: + content_type: :class:`str` The request's content type. - data: + data: Optional[:class:`str`] The data which was added to the request. - __ttl: + __ttl: :class:`int` Private param used for recursively setting the retry amount. (Eg set to 1 for 1 max retry) """ @@ -292,7 +309,7 @@ async def delete( Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] The response from discord. """ return await self.__send( @@ -301,7 +318,11 @@ async def delete( headers=headers ) - async def get(self, route: str) -> Optional[Dict]: + async def get( + self, + route: str, + params: Optional[Dict] = None + ) -> Optional[Dict]: """|coro| Sends a get request to a Discord REST endpoint. @@ -310,13 +331,20 @@ async def get(self, route: str) -> Optional[Dict]: ---------- route : :class:`str` The Discord REST endpoint to send a get request to. + params: Optional[:class:`Dict`] + The query parameters to add to the request. + |default| :data:`None` Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] The response from discord. """ - return await self.__send(self.__session.get, route) + return await self.__send( + self.__session.get, + route, + params=params + ) async def head(self, route: str) -> Optional[Dict]: """|coro| @@ -330,7 +358,7 @@ async def head(self, route: str) -> Optional[Dict]: Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] The response from discord. """ return await self.__send(self.__session.head, route) @@ -347,7 +375,7 @@ async def options(self, route: str) -> Optional[Dict]: Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] The response from discord. """ return await self.__send(self.__session.options, route) @@ -367,7 +395,7 @@ async def patch( ---------- route : :class:`str` The Discord REST endpoint to send a patch request to. - data : :class:`dict` + data : :class:`Dict` The update data for the patch request. content_type: :class:`str` Body content type. @@ -377,7 +405,7 @@ async def patch( Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] JSON response from the discord API. """ return await self.__send( @@ -412,7 +440,7 @@ async def post( Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] JSON response from the discord API. """ return await self.__send( @@ -447,7 +475,7 @@ async def put( Returns ------- - Optional[:class:`dict`] + Optional[:class:`Dict`] JSON response from the discord API. """ return await self.__send( diff --git a/pincer/objects/guild/channel.py b/pincer/objects/guild/channel.py index d105c615..c7ca6bf9 100644 --- a/pincer/objects/guild/channel.py +++ b/pincer/objects/guild/channel.py @@ -303,7 +303,7 @@ async def edit_permissions( """ await self._http.put( f"channels/{self.id}/permissions/{overwrite.id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, data={"allow": allow, "deny": deny, "type": type}, ) @@ -323,7 +323,7 @@ async def delete_permission( """ await self._http.delete( f"channels/{self.id}/permissions/{overwrite.id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def follow_news_channel( @@ -389,7 +389,7 @@ async def pin_message( """ await self._http.put( f"channels/{self.id}/pins/{message.id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def unpin_message( @@ -400,7 +400,7 @@ async def unpin_message( """ await self._http.delete( f"channels/{self.id}/pins/{message.id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def group_dm_add_recipient( @@ -459,7 +459,7 @@ async def bulk_delete_messages( """ await self._http.post( f"channels/{self.id}/messages/bulk_delete", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, data={"messages": messages}, ) @@ -484,7 +484,7 @@ async def delete( await self._http.delete( f"channels/{channel_id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def __post_send_handler(self, message: UserMessage): @@ -621,7 +621,7 @@ async def create_invite( self._client, await self._http.post( f"channels/{self.id}/invites", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, data={ "max_age": max_age, "max_uses": max_uses, @@ -681,9 +681,12 @@ async def list_public_archived_threads( construct_client_dict( self._client, await self._http.get( - f"channels/{self.id}/threads/archived/public?" - + urlencode(remove_none({"before": before, "limit": limit})) - ), + f"channels/{self.id}/threads/archived/public", + params={ + "before": before, + "limit": limit + } + ) ) ) @@ -714,9 +717,12 @@ async def list_private_archived_threads( construct_client_dict( self._client, await self._http.get( - f"channels/{self.id}/threads/archived/private?" - + urlencode(remove_none({"before": before, "limit": limit})) - ), + f"channels/{self.id}/threads/archived/private", + params={ + "before": before, + "limit": limit + } + ) ) ) @@ -748,8 +754,11 @@ async def list_joined_private_archived_threads( construct_client_dict( self._client, self._http.get( - f"channels/{self.id}/users/@me/threads/archived/private?" - + urlencode(remove_none({"before": before, "limit": limit})) + f"channels/{self.id}/users/@me/threads/archived/private", + params={ + "before": before, + "limit": limit + } ), ) ) @@ -946,7 +955,7 @@ async def start( self._client, await self._http.post( f"channels/{self.id}/threads", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, data={ "name": name, "auto_archive_duration": auto_archive_duration, @@ -1009,7 +1018,7 @@ async def start_with_message( self._client, await self._http.post( f"channels/{self.id}/messages/{message.id}/threads", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, data={ "name": name, "auto_archive_duration": auto_archive_duration, diff --git a/pincer/objects/guild/guild.py b/pincer/objects/guild/guild.py index f0655bb5..4e58f852 100644 --- a/pincer/objects/guild/guild.py +++ b/pincer/objects/guild/guild.py @@ -502,7 +502,7 @@ async def modify_member(self, _id: int, reason=None, **kwargs) -> GuildMember: data = await self._http.patch( f"guilds/{self.id}/members/{_id}", data=kwargs, - headers=remove_none({"X-Audit-Log-Reason": reason}) + headers={"X-Audit-Log-Reason": reason} ) return GuildMember.from_dict(construct_client_dict(self._client, data)) @@ -568,7 +568,7 @@ async def create_channel( data = await self._http.post( f"guilds/{self.id}/channels", data=kwargs, - headers=remove_none({"X-Audit-Log-Reason": reason}) + headers={"X-Audit-Log-Reason": reason} ) return Channel.from_dict(construct_client_dict(self._client, data)) @@ -594,7 +594,7 @@ async def modify_channel_positions( await self._http.patch( f"guilds/{self.id}/channels", data=channel, - headers=remove_none({"X-Audit-Log-Reason":reason}) + headers={"X-Audit-Log-Reason":reason} ) async def list_active_threads(self) -> Tuple[ @@ -643,7 +643,11 @@ async def list_guild_members( """ members = await self._http.get( - f"guilds/{self.id}/members?{limit=}&{after=}" + f"guilds/{self.id}/members", + params={ + "limit": limit, + "after": after + } ) for member in members: @@ -675,8 +679,11 @@ async def search_guild_members( """ data = await self._http.get( - f"guilds/{id}/members/search?{query=!s}" - + (f"&{limit=}" if limit else "") + f"guilds/{self.id}/members/search", + params={ + "query": query, + "limit": limit + } ) for member in data: @@ -731,7 +738,7 @@ async def add_guild_member( data = await self._http.put( f"guilds/{self.id}/members/{user_id}", data=kwargs, - headers=remove_none({"X-Audit-Log-Reason": reason}) + headers={"X-Audit-Log-Reason": reason} ) return GuildMember.from_dict( @@ -760,7 +767,7 @@ async def modify_current_member( data = self._http.patch( f"guilds/{self.id}/members/@me", {"nick": nick}, - headers=remove_none({"X-Audit-Log-Reason":reason}) + headers={"X-Audit-Log-Reason":reason} ) return GuildMember.from_dict(construct_client_dict(self._client, data)) @@ -784,7 +791,7 @@ async def add_guild_member_role( """ data = await self._http.put( f"guilds/{self.id}/{user_id}/roles/{role_id}", - headers=remove_none({"X-Audit-Log-Reason": reason}) + headers={"X-Audit-Log-Reason": reason} ) async def remove_guild_member_role( @@ -807,7 +814,7 @@ async def remove_guild_member_role( """ await self._http.delete( f"guilds/{self.id}/{user_id}/roles/{role_id}", - headers=remove_none({"X-Audit-Log-Reason": reason}) + headers={"X-Audit-Log-Reason": reason} ) async def remove_guild_member( @@ -827,7 +834,7 @@ async def remove_guild_member( """ await self._http.delete( f"guilds/{self.id}/members/{user_id}", - headers=remove_none({"X-Audit-Log-Reason": reason}) + headers={"X-Audit-Log-Reason": reason} ) async def ban( @@ -948,7 +955,7 @@ async def create_role(self, reason: Optional[str] = None, **kwargs) -> Role: await self._http.post( f"guilds/{self.id}/roles", data=kwargs, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ), ) ) @@ -979,7 +986,7 @@ async def edit_role_position( data = await self._http.patch( f"guilds/{self.id}/roles", data={"id": id, "position": position}, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) for role_data in data: yield Role.from_dict(construct_client_dict(self._client, role_data)) @@ -1043,7 +1050,7 @@ async def edit_role( await self._http.patch( f"guilds/{self.id}/roles/{id}", data=kwargs, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ), ) ) @@ -1062,7 +1069,7 @@ async def delete_role(self, id: Snowflake, reason: Optional[str] = None): """ await self._http.delete( f"guilds/{self.id}/roles/{id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def get_bans(self) -> AsyncGenerator[Ban, None]: @@ -1112,7 +1119,7 @@ async def unban(self, id: Snowflake, reason: Optional[str] = None): """ await self._http.delete( f"guilds/{self.id}/bans/{id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) @overload @@ -1243,7 +1250,8 @@ async def prune_count( The number of members that would be removed. """ return await self._http.get( - f"guilds/{self.id}/prune?{days=}&{include_roles=!s}" + f"guilds/{self.id}/prune", + params={"days": days, "include_roles": include_roles}, )["pruned"] async def prune( @@ -1282,7 +1290,7 @@ async def prune( "compute_prune_days": compute_prune_days, "include_roles": include_roles, }, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, )["pruned"] async def get_voice_regions(self) -> AsyncGenerator[VoiceRegion, None]: @@ -1348,7 +1356,7 @@ async def delete_integration( """ await self._http.delete( f"guilds/{self.id}/integrations/{integration.id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def get_widget_settings(self) -> GuildWidget: @@ -1389,7 +1397,7 @@ async def modify_widget( data = await self._http.patch( f"guilds/{self.id}/widget", data=kwargs, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) return GuildWidget.from_dict(construct_client_dict(self._client, data)) @@ -1501,7 +1509,7 @@ async def modify_welcome_screen( "welcome_channels": welcome_channels, "description": description, }, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) return WelcomeScreen.from_dict( construct_client_dict(self._client, data) @@ -1664,7 +1672,7 @@ async def create_emoji( data = await self._http.post( f"guilds/{self.id}/emojis", data={"name": name, "image": image.uri, "roles": roles}, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) return Emoji.from_dict(construct_client_dict(self._client, data)) @@ -1699,7 +1707,7 @@ async def edit_emoji( data = await self._http.patch( f"guilds/{self.id}/emojis/{id}", data={"name": name, "roles": roles}, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) return Emoji.from_dict(construct_client_dict(self._client, data)) @@ -1719,7 +1727,7 @@ async def delete_emoji( """ await self._http.delete( f"guilds/{self.id}/emojis/{id}", - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) async def get_templates(self) -> AsyncIterator[GuildTemplate]: @@ -1923,7 +1931,7 @@ async def create_sticker( sticker = await self._http.post( f"guilds/{self.id}/stickers", data=payload, - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, content_type=payload.content_type ) diff --git a/pincer/objects/guild/webhook.py b/pincer/objects/guild/webhook.py index 91c72173..1a3c7174 100644 --- a/pincer/objects/guild/webhook.py +++ b/pincer/objects/guild/webhook.py @@ -323,8 +323,8 @@ async def get_message( construct_client_dict( self._client, await self._http.get( - f"webhooks/{self.id}/{self.token}/messages/{message_id}" - + (f"?{thread_id=}" if thread_id else "") + f"webhooks/{self.id}/{self.token}/messages/{message_id}", + params={"thread_id": thread_id} ) ) ) diff --git a/pincer/objects/message/sticker.py b/pincer/objects/message/sticker.py index 56a3cf73..a0a907c4 100644 --- a/pincer/objects/message/sticker.py +++ b/pincer/objects/message/sticker.py @@ -147,7 +147,7 @@ async def modify( data=remove_none( {"name": name, "description": description, "tags": tags} ), - headers=remove_none({"X-Audit-Log-Reason": reason}), + headers={"X-Audit-Log-Reason": reason}, ) return Sticker.from_dict(sticker) diff --git a/pincer/objects/message/user_message.py b/pincer/objects/message/user_message.py index 2770811e..9f7fa078 100644 --- a/pincer/objects/message/user_message.py +++ b/pincer/objects/message/user_message.py @@ -480,8 +480,8 @@ async def get_reactions( """ for user in await self._http.get( - f"/channels/{self.channel_id}/messages/{self.id}/reactions/{emoji}" - f"?after={after}&limit={limit}" + f"/channels/{self.channel_id}/messages/{self.id}/reactions/{emoji}", + params={"after": after, "limit": limit} ): yield User.from_dict(user) From 7fa2f529bb80430275d9bf9455c4fb7603938dbb Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Tue, 4 Jan 2022 21:22:59 -0500 Subject: [PATCH 09/23] :bug: fix return str would only post one letter message --- pincer/utils/convert_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pincer/utils/convert_message.py b/pincer/utils/convert_message.py index e56408ba..728f071d 100644 --- a/pincer/utils/convert_message.py +++ b/pincer/utils/convert_message.py @@ -43,7 +43,7 @@ def convert_message(client: Client, message: MessageConvertable) -> Message: :class:`~pincer.objects.message.message.Message` The message object to be sent """ - if message and isinstance(message, Iterable): + if message and isinstance(message, Iterable) and not isinstance(message, str): kwargs = defaultdict(list) for item in message: list_to_message_dict(item, kwargs) From cc92e0ef3de50c38b123ac3025c14b9421e8c807 Mon Sep 17 00:00:00 2001 From: Lunarmagpie <65521138+Lunarmagpie@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:57:53 -0500 Subject: [PATCH 10/23] :bug: fix GuildFeatures not existing (#352) * :bug: fix GuildFeatures not existing * :memo: added str typehints to docs Signed-off-by: Lunarmagpie --- pincer/objects/guild/features.py | 86 ++++++++++++++++---------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/pincer/objects/guild/features.py b/pincer/objects/guild/features.py index 7ede5c48..911d1915 100644 --- a/pincer/objects/guild/features.py +++ b/pincer/objects/guild/features.py @@ -11,68 +11,68 @@ class GuildFeature(Enum): Attributes ---------- - ANIMATED_ICON: + ANIMATED_ICON : str Guild can have an animated icon. - BANNER: + BANNER : str Guild can have a banner. - COMMERCE: + COMMERCE : str Guild can have commerce. - COMMUNITY: + COMMUNITY : str Guild is a community. - DISCOVERABLE: + DISCOVERABLE : str Guild can be discovered. - FEATURABLE: + FEATURABLE : str Guild can be featureurable.Guild can have an invite splash. - INVITE_SPLASH: + INVITE_SPLASH : str Guild can be featureurable. - MEMBER_VERIFICATION_GATE_ENABLED: + MEMBER_VERIFICATION_GATE_ENABLED : str Guild has member verification enabled. - NEWS: + NEWS : str Guild has a news channel. - PARTNERED: + PARTNERED : str Guild is a partner. - PREVIEW_ENABLED: + PREVIEW_ENABLED : str Guild has preview enabled. - VANITY_URL: + VANITY_URL : str Guild has a vanity url. - VERIFIED: + VERIFIED : str Guild is verified. - VIP_REGIONS: + VIP_REGIONS : str Guild can have VIP regions. - WELCOME_SCREEN_ENABLED: + WELCOME_SCREEN_ENABLED : str Guild has welcome screen enabled. - TICKETED_EVENTS_ENABLED: + TICKETED_EVENTS_ENABLED : str Guild has ticketed events enabled. - MONETIZATION_ENABLED: + MONETIZATION_ENABLED : str Guild has monetization enabled. - MORE_STICKERS: + MORE_STICKERS : str Guild can have more stickers. - THREE_DAY_THREAD_ARCHIVE: + THREE_DAY_THREAD_ARCHIVE : str Guild can have three day archive time for threads. - SEVEN_DAY_THREAD_ARCHIVE: + SEVEN_DAY_THREAD_ARCHIVE : str Guild can have seven day archive time for threads. - PRIVATE_THREADS: + PRIVATE_THREADS : str Guild can have private threads. """ - ANIMATED_ICON = auto() - BANNER = auto() - COMMERCE = auto() - COMMUNITY = auto() - DISCOVERABLE = auto() - FEATURABLE = auto() - INVITE_SPLASH = auto() - MEMBER_VERIFICATION_GATE_ENABLED = auto() - NEWS = auto() - PARTNERED = auto() - PREVIEW_ENABLED = auto() - VANITY_URL = auto() - VERIFIED = auto() - VIP_REGIONS = auto() - WELCOME_SCREEN_ENABLED = auto() - TICKETED_EVENTS_ENABLED = auto() - MONETIZATION_ENABLED = auto() - MORE_STICKERS = auto() - THREE_DAY_THREAD_ARCHIVE = auto() - SEVEN_DAY_THREAD_ARCHIVE = auto() - PRIVATE_THREADS = auto() - NEW_THREAD_PERMISSIONS = auto() + ANIMATED_ICON = "ANIMATED_ICON" + BANNER = "BANNER" + COMMERCE = "COMMERCE" + COMMUNITY = "COMMUNITY" + DISCOVERABLE = "DISCOVERABLE" + FEATURABLE = "FEATURABLE" + INVITE_SPLASH = "INVITE_SPLASH" + MEMBER_VERIFICATION_GATE_ENABLED = "MEMBER_VERIFICATION_GATE_ENABLED" + NEWS = "NEWS" + PARTNERED = "PARTNERED" + PREVIEW_ENABLED = "PREVIEW_ENABLED" + VANITY_URL = "VANITY_URL" + VERIFIED = "VERIFIED" + VIP_REGIONS = "VIP_REGIONS" + WELCOME_SCREEN_ENABLED = "WELCOME_SCREEN_ENABLED" + TICKETED_EVENTS_ENABLED = "TICKETED_EVENTS_ENABLED" + MONETIZATION_ENABLED = "MONETIZATION_ENABLED" + MORE_STICKERS = "MORE_STICKERS" + THREE_DAY_THREAD_ARCHIVE = "THREE_DAY_THREAD_ARCHIVE" + SEVEN_DAY_THREAD_ARCHIVE = "SEVEN_DAY_THREAD_ARCHIVE" + PRIVATE_THREADS = "PRIVATE_THREADS" + NEW_THREAD_PERMISSIONS = "NEW_THREAD_PERMISSIONS" From 6a51ca7a085a469451ca43983bebc0526bc3d0c3 Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Wed, 5 Jan 2022 15:49:54 -0500 Subject: [PATCH 11/23] :bug: change default encoding to zlip-payload --- pincer/_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pincer/_config.py b/pincer/_config.py index 57707144..1500bc11 100644 --- a/pincer/_config.py +++ b/pincer/_config.py @@ -13,7 +13,7 @@ class GatewayConfig: MAX_RETRIES: int = 5 version: int = 9 encoding: str = "json" - compression: str = "zlib-stream" + compression: str = "zlib-payload" @classmethod def make_uri(cls, uri) -> str: From 6f2b9f68ec4bf9e3cbc594e9a3ecb77f7fc8f01e Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 18:27:08 -0800 Subject: [PATCH 12/23] :wrench: Added more info to `CONTRIBUTING.md` and add issue forms (#349) * :wrench: Created a bug report form * :wrench: Removed bug report file * :wrench: update bug-report.yml * :wrench: Update * :wrench: Final update * :wrench: Create a form for feature requests * :wrench: Update * :wrench: Update * :wrench: Updated `CONTRIBUTING.md` --- .github/ISSUE_TEMPLATE/BUG-REPORT.md | 38 ---------------------- .github/ISSUE_TEMPLATE/BUG-REPORT.yml | 36 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/FEATURE-REQUEST.md | 20 ------------ .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml | 29 +++++++++++++++++ docs/CONTRIBUTING.md | 28 +++++++++++----- 5 files changed, 84 insertions(+), 67 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/BUG-REPORT.md create mode 100644 .github/ISSUE_TEMPLATE/BUG-REPORT.yml delete mode 100644 .github/ISSUE_TEMPLATE/FEATURE-REQUEST.md create mode 100644 .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.md b/.github/ISSUE_TEMPLATE/BUG-REPORT.md deleted file mode 100644 index 7531b0dc..00000000 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] - -**Smartphone (please complete the following information):** -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml new file mode 100644 index 00000000..299c0bc6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml @@ -0,0 +1,36 @@ +name: Bug Report +title: ":bug: " +description: "Create A bug report" +labels: ["bug"] +body: + - type: textarea + id: bug-occured + attributes: + label: Describe the bug + placeholder: A clear and concise description of what the bug is. + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Steps to Reproduce + placeholder: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + render: markdown + - type: textarea + id: terminal + attributes: + label: Relavant console output + description: Paste the console output that is relavant to the error + - type: input + id: version + attributes: + label: Pincer Version used + description: Can be found with `python -c "print(__import__('pincer').__version__)"` in the terminal + placeholder: 0.14.0 or git + validations: + required: true + diff --git a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md deleted file mode 100644 index bbcbbe7d..00000000 --- a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml new file mode 100644 index 00000000..32c7d807 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml @@ -0,0 +1,29 @@ +name: Feature Request +title: "TITLE" +description: Suggest an idea for this project +labels: ["enhancement"] +body: + - type: textarea + id: problem + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. + placeholder: | + Ex. I'm always frustrated when [...] + - type: textarea + id: solution + attributes: + label: Describe the solution you would like + description: A clear and concise description of what you want to happen. + validations: + reqiured: true + - type: textarea + id: alternative + attributes: + label: Describe alternatives you have considered + description: A clear and concise description of any alternative solutions or features you have considered. + - type: textarea + id: other-info + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 657f1322..23796195 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,19 +1,29 @@ -# Contributing to this repository +# :tada: Contributing to this repository -## Getting Started +## 🏁 Getting Started Before you begin: -* Make sure to have the right python version +* Make sure to have the right python version (≥3.8) and the project dependencies installed. -## Don't see your issue? Open one +## :v: There are 2 main ways to contribute: -If you spot something new, open an issue using the template. +### :bug: Fix a bug +Do you think you would be able to fix a bug? +- If there is an open issue and no one is assigned feel free to claim it by commenting. +Someone will assign you can you can begin working on it. +- If there is no issue open, open one using the bug report issue form and describe the bug. We'll use the issue to have a conversation about the problem you found. -## Make your update +### :sparkles: Add a new feature +Whether you are a first time contributer or a frequent contributer, this is greatly appreciated. +- Looking for something to contribute? Find an open issue with the tag [_enhancement_](https://github.com/Pincer-org/Pincer/labels/enhancement) in which that feature is not assigned. +For people who just want to get their feet wet, browse issues with the [_easy_](https://github.com/Pincer-org/Pincer/labels/easy) tag. +We are also really looking for people to help with isse [#265 *Implement Every Single Endpoint*](https://github.com/Pincer-org/Pincer/issues/265) +- Do you have a feature in mind that should be added and does not have an issue? Open one using the Feature Request issue form and fill out the relavant information. +## :arrow_up: Make your update Make your changes to the file(s) you'd like to update to solve an issue or add a new feature. When writing docstrings, please use the [numpydocs](https://numpydoc.readthedocs.io/en/latest/format.html) style guide. @@ -21,8 +31,7 @@ or add a new feature. When writing docstrings, please use the When contributing, make sure to use [Gitmoji](https://gitmoji.dev/) for your commits as it helps to organize them by categories. -## Open a pull request - +## :envelope_with_arrow: Open a pull request When you're done making changes, and you'd like to propose them for review, use the pull request template to open your PR (pull request). @@ -31,6 +40,7 @@ use the pull request template to open your PR (pull request). * If you remove any feature, or don't pass the basic tests and code style your pull request might not get approved and will be asked for modifications. * Make sure to respect the pep8 rules (including E501), or will be requested. +* Make sure that there is an issue opened for what you are contributing and that it is assigned to you -If you are on our discord, a successful pull request will give you the +If you are on our [discord](https://discord.gg/pincer), a successful pull request will give you the contributor role! (except for typos pr's/small contributions) From 11b80bcc652fb90688d32ee9f1ddbbfae8a77b6d Mon Sep 17 00:00:00 2001 From: Lunarmagpie Date: Wed, 5 Jan 2022 21:49:40 -0500 Subject: [PATCH 13/23] :speech_balloon: fix spelling --- .github/ISSUE_TEMPLATE/BUG-REPORT.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml index 299c0bc6..83e636ca 100644 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yml @@ -23,8 +23,8 @@ body: - type: textarea id: terminal attributes: - label: Relavant console output - description: Paste the console output that is relavant to the error + label: Relevant console output + description: Paste the console output that is relevant to the error - type: input id: version attributes: From 94096bc105e26f3dd05618e4489771ee60e8dceb Mon Sep 17 00:00:00 2001 From: Lunarmagpie <65521138+Lunarmagpie@users.noreply.github.com> Date: Wed, 5 Jan 2022 21:53:17 -0500 Subject: [PATCH 14/23] :speech_balloon: fix another typo :skull: --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 23796195..8e679304 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -20,7 +20,7 @@ We'll use the issue to have a conversation about the problem you found. Whether you are a first time contributer or a frequent contributer, this is greatly appreciated. - Looking for something to contribute? Find an open issue with the tag [_enhancement_](https://github.com/Pincer-org/Pincer/labels/enhancement) in which that feature is not assigned. For people who just want to get their feet wet, browse issues with the [_easy_](https://github.com/Pincer-org/Pincer/labels/easy) tag. -We are also really looking for people to help with isse [#265 *Implement Every Single Endpoint*](https://github.com/Pincer-org/Pincer/issues/265) +We are also really looking for people to help with issue [#265 *Implement Every Single Endpoint*](https://github.com/Pincer-org/Pincer/issues/265) - Do you have a feature in mind that should be added and does not have an issue? Open one using the Feature Request issue form and fill out the relavant information. ## :arrow_up: Make your update From 41d8c66e75e4e655e15ef00e4f9d7c30c2e41375 Mon Sep 17 00:00:00 2001 From: Yohann Boniface Date: Thu, 6 Jan 2022 04:04:57 +0100 Subject: [PATCH 15/23] :recycle: small improvements (#347) * :art: Improving pep8ness * :fire: `code` is already `1000` by default * :fire: Has been moved to component * :bug: Missing `await` * :recycle: Optimized imports * :art: Automatic sorting * :recycle: asked changes * Merge remote-tracking branch 'origin/main' * :art: requsted changes * :speech_balloon: fix spelling Co-authored-by: GitHub Actions Co-authored-by: Lunarmagpie Co-authored-by: Lunarmagpie <65521138+Lunarmagpie@users.noreply.github.com> --- docs/CONTRIBUTING.md | 6 +++--- pincer/_config.py | 1 - pincer/core/gateway.py | 4 ++-- pincer/middleware/activity_join_request.py | 4 ++-- pincer/middleware/error.py | 2 +- pincer/middleware/guild_create.py | 2 +- pincer/middleware/guild_member_remove.py | 1 - pincer/middleware/guild_members_chunk.py | 1 - pincer/middleware/guild_role_create.py | 1 - pincer/middleware/guild_stickers_update.py | 1 - pincer/middleware/interaction_create.py | 2 +- pincer/middleware/message_create.py | 2 +- pincer/middleware/message_delete.py | 2 +- .../message_reaction_remove_emoji.py | 1 - pincer/middleware/message_update.py | 2 +- pincer/middleware/payload.py | 2 +- pincer/middleware/presence_update.py | 1 - pincer/middleware/resumed.py | 2 +- pincer/middleware/stage_instance_update.py | 3 +-- pincer/middleware/thread_create.py | 2 +- pincer/middleware/thread_list_sync.py | 2 -- pincer/middleware/typing_start.py | 1 - pincer/middleware/voice_state_delete.py | 1 - pincer/objects/__init__.py | 4 ++-- pincer/objects/app/command.py | 1 - pincer/objects/app/interactions.py | 1 - pincer/objects/app/mentionable.py | 1 - pincer/objects/app/throttling.py | 2 -- pincer/objects/guild/channel.py | 1 - pincer/objects/guild/guild.py | 18 ++++++++---------- pincer/objects/message/context.py | 2 +- pincer/objects/message/file.py | 2 +- pincer/objects/message/user_message.py | 2 +- pincer/utils/__init__.py | 6 ++---- pincer/utils/api_object.py | 3 +-- pincer/utils/conversion.py | 5 +---- pincer/utils/types.py | 4 +--- 37 files changed, 35 insertions(+), 63 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 8e679304..cc2e81e5 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -17,11 +17,11 @@ Someone will assign you can you can begin working on it. We'll use the issue to have a conversation about the problem you found. ### :sparkles: Add a new feature -Whether you are a first time contributer or a frequent contributer, this is greatly appreciated. +Whether you are a first time contributor or a frequent contributor, this is greatly appreciated. - Looking for something to contribute? Find an open issue with the tag [_enhancement_](https://github.com/Pincer-org/Pincer/labels/enhancement) in which that feature is not assigned. For people who just want to get their feet wet, browse issues with the [_easy_](https://github.com/Pincer-org/Pincer/labels/easy) tag. -We are also really looking for people to help with issue [#265 *Implement Every Single Endpoint*](https://github.com/Pincer-org/Pincer/issues/265) -- Do you have a feature in mind that should be added and does not have an issue? Open one using the Feature Request issue form and fill out the relavant information. +We are also really looking for people to help with isse [#265 *Implement Every Single Endpoint*](https://github.com/Pincer-org/Pincer/issues/265) +- Do you have a feature in mind that should be added and does not have an issue? Open one using the Feature Request issue form and fill out the relevant information. ## :arrow_up: Make your update Make your changes to the file(s) you'd like to update to solve an issue diff --git a/pincer/_config.py b/pincer/_config.py index 1500bc11..a5361080 100644 --- a/pincer/_config.py +++ b/pincer/_config.py @@ -2,7 +2,6 @@ # Full MIT License can be found in `LICENSE` at the project root. from dataclasses import dataclass -from typing import Optional @dataclass(repr=False) diff --git a/pincer/core/gateway.py b/pincer/core/gateway.py index a8cd7cb3..0addb7e8 100644 --- a/pincer/core/gateway.py +++ b/pincer/core/gateway.py @@ -259,7 +259,7 @@ async def event_loop(self): self.shard_key ) self.__should_reconnect = True - self.start_loop() + await self.start_loop() async def handle_data(self, data: Dict[Any]): """|coro| @@ -310,7 +310,7 @@ async def handle_reconnect(self, payload: GatewayDispatch): self.shard_key ) - await self.__socket.close(code=1000) + await self.__socket.close() self.__should_reconnect = True await self.start_loop() diff --git a/pincer/middleware/activity_join_request.py b/pincer/middleware/activity_join_request.py index c0ee0435..259e76e3 100644 --- a/pincer/middleware/activity_join_request.py +++ b/pincer/middleware/activity_join_request.py @@ -5,12 +5,12 @@ from __future__ import annotations +from typing import TYPE_CHECKING + from ..objects.user.user import User from ..utils.conversion import construct_client_dict from ..utils.types import Coro -from typing import TYPE_CHECKING - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/error.py b/pincer/middleware/error.py index 5a451e03..f6b9a2d5 100644 --- a/pincer/middleware/error.py +++ b/pincer/middleware/error.py @@ -14,7 +14,7 @@ from ..utils.types import Coro if TYPE_CHECKING: - from typing import List, Tuple + from typing import Tuple from ..client import Client from ..core.gateway import Gateway from ..core.gateway import GatewayDispatch diff --git a/pincer/middleware/guild_create.py b/pincer/middleware/guild_create.py index 6c9dafb9..cfc18ed7 100644 --- a/pincer/middleware/guild_create.py +++ b/pincer/middleware/guild_create.py @@ -10,7 +10,7 @@ from ..utils.conversion import construct_client_dict if TYPE_CHECKING: - from typing import List, Tuple + from typing import Tuple from ..client import Client from ..core.gateway import Gateway from ..core.gateway import GatewayDispatch diff --git a/pincer/middleware/guild_member_remove.py b/pincer/middleware/guild_member_remove.py index eebf9b10..fb2dbbf8 100644 --- a/pincer/middleware/guild_member_remove.py +++ b/pincer/middleware/guild_member_remove.py @@ -13,7 +13,6 @@ from ..utils import Coro from ..utils.conversion import construct_client_dict - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/guild_members_chunk.py b/pincer/middleware/guild_members_chunk.py index 1018c543..8041463a 100644 --- a/pincer/middleware/guild_members_chunk.py +++ b/pincer/middleware/guild_members_chunk.py @@ -14,7 +14,6 @@ from ..utils import Coro from ..utils.conversion import construct_client_dict - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/guild_role_create.py b/pincer/middleware/guild_role_create.py index 1f91b8ed..1a9fa3ac 100644 --- a/pincer/middleware/guild_role_create.py +++ b/pincer/middleware/guild_role_create.py @@ -11,7 +11,6 @@ from ..utils import Coro from ..utils.conversion import construct_client_dict - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/guild_stickers_update.py b/pincer/middleware/guild_stickers_update.py index 879534e0..1c84df5c 100644 --- a/pincer/middleware/guild_stickers_update.py +++ b/pincer/middleware/guild_stickers_update.py @@ -11,7 +11,6 @@ from ..utils import Coro from ..utils.conversion import construct_client_dict - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/interaction_create.py b/pincer/middleware/interaction_create.py index 56da0bbc..dcef2183 100644 --- a/pincer/middleware/interaction_create.py +++ b/pincer/middleware/interaction_create.py @@ -3,8 +3,8 @@ from __future__ import annotations -from contextlib import suppress import logging +from contextlib import suppress from inspect import isasyncgenfunction, _empty from typing import Dict, Any from typing import TYPE_CHECKING diff --git a/pincer/middleware/message_create.py b/pincer/middleware/message_create.py index 55c39d93..110d269d 100644 --- a/pincer/middleware/message_create.py +++ b/pincer/middleware/message_create.py @@ -10,7 +10,7 @@ from ..utils.conversion import construct_client_dict if TYPE_CHECKING: - from typing import List, Tuple + from typing import Tuple from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/message_delete.py b/pincer/middleware/message_delete.py index 2663e91d..5a367820 100644 --- a/pincer/middleware/message_delete.py +++ b/pincer/middleware/message_delete.py @@ -10,7 +10,7 @@ from ..utils.conversion import construct_client_dict if TYPE_CHECKING: - from typing import List, Tuple + from typing import Tuple from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/message_reaction_remove_emoji.py b/pincer/middleware/message_reaction_remove_emoji.py index 29a7b09f..7017f111 100644 --- a/pincer/middleware/message_reaction_remove_emoji.py +++ b/pincer/middleware/message_reaction_remove_emoji.py @@ -13,7 +13,6 @@ from ..objects.events.message import MessageReactionRemoveEmojiEvent from ..utils.conversion import construct_client_dict - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/message_update.py b/pincer/middleware/message_update.py index 35afa918..7cf5b60e 100644 --- a/pincer/middleware/message_update.py +++ b/pincer/middleware/message_update.py @@ -11,7 +11,7 @@ from ..utils.conversion import construct_client_dict if TYPE_CHECKING: - from typing import List, Tuple + from typing import Tuple from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/payload.py b/pincer/middleware/payload.py index 6614d463..c903cf02 100644 --- a/pincer/middleware/payload.py +++ b/pincer/middleware/payload.py @@ -6,7 +6,7 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: - from typing import List, Tuple + from typing import Tuple from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/presence_update.py b/pincer/middleware/presence_update.py index 13347378..364b7ee5 100644 --- a/pincer/middleware/presence_update.py +++ b/pincer/middleware/presence_update.py @@ -11,7 +11,6 @@ from ..utils.conversion import construct_client_dict from ..utils.types import Coro - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/resumed.py b/pincer/middleware/resumed.py index ab01de29..d1b1e429 100644 --- a/pincer/middleware/resumed.py +++ b/pincer/middleware/resumed.py @@ -7,8 +7,8 @@ """ from __future__ import annotations -from typing import TYPE_CHECKING import logging +from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Tuple diff --git a/pincer/middleware/stage_instance_update.py b/pincer/middleware/stage_instance_update.py index 61a65bb0..5fd12a07 100644 --- a/pincer/middleware/stage_instance_update.py +++ b/pincer/middleware/stage_instance_update.py @@ -8,8 +8,7 @@ from typing import TYPE_CHECKING from ..objects import StageInstance -from ..utils.conversion import construct_client_dict -from ..utils import Coro, replace +from ..utils import Coro, replace, construct_client_dict if TYPE_CHECKING: from ..client import Client diff --git a/pincer/middleware/thread_create.py b/pincer/middleware/thread_create.py index 5bd73ef5..8afc398e 100644 --- a/pincer/middleware/thread_create.py +++ b/pincer/middleware/thread_create.py @@ -7,8 +7,8 @@ from typing import TYPE_CHECKING -from ..utils.conversion import construct_client_dict from ..objects import Channel +from ..utils.conversion import construct_client_dict if TYPE_CHECKING: from ..client import Client diff --git a/pincer/middleware/thread_list_sync.py b/pincer/middleware/thread_list_sync.py index 47b08222..f400f83f 100644 --- a/pincer/middleware/thread_list_sync.py +++ b/pincer/middleware/thread_list_sync.py @@ -5,8 +5,6 @@ from __future__ import annotations -from typing import List - from typing import TYPE_CHECKING from ..objects.events.thread import ThreadListSyncEvent diff --git a/pincer/middleware/typing_start.py b/pincer/middleware/typing_start.py index 2a0786f2..0f81b717 100644 --- a/pincer/middleware/typing_start.py +++ b/pincer/middleware/typing_start.py @@ -11,7 +11,6 @@ from ..utils.conversion import construct_client_dict from ..utils.types import Coro - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/middleware/voice_state_delete.py b/pincer/middleware/voice_state_delete.py index 3e4c9c51..ee5e260d 100644 --- a/pincer/middleware/voice_state_delete.py +++ b/pincer/middleware/voice_state_delete.py @@ -11,7 +11,6 @@ from ..utils.conversion import construct_client_dict from ..utils.types import Coro - if TYPE_CHECKING: from ..client import Client from ..core.gateway import Gateway diff --git a/pincer/objects/__init__.py b/pincer/objects/__init__.py index 9d8e9999..0e25d8a3 100644 --- a/pincer/objects/__init__.py +++ b/pincer/objects/__init__.py @@ -111,8 +111,8 @@ "AppCommandOption", "AppCommandOptionChoice", "AppCommandOptionType", "AppCommandType", "Application", "Attachment", "AuditEntryInfo", "AuditLog", "AuditLogChange", "AuditLogEntry", "AuditLogEvent", "Ban", - "BaseMember", "Button", "ButtonStyle", "CallbackType", "CategoryChannel", - "Channel", "ChannelMention", "ChannelPinsUpdateEvent", "ChannelType", + "BaseMember", "CallbackType", "CategoryChannel", "Channel", + "ChannelMention", "ChannelPinsUpdateEvent", "ChannelType", "ClientCommandStructure", "ClientStatus", "ComponentType", "Connection", "DefaultMessageNotificationLevel", "DefaultThrottleHandler", "DiscordError", "Embed", "EmbedAuthor", "EmbedField", "EmbedFooter", diff --git a/pincer/objects/app/command.py b/pincer/objects/app/command.py index dfa970d0..088d383f 100644 --- a/pincer/objects/app/command.py +++ b/pincer/objects/app/command.py @@ -6,7 +6,6 @@ from dataclasses import dataclass from typing import List, Union, TYPE_CHECKING - from .command_types import AppCommandOptionType, AppCommandType from ...objects.guild.channel import ChannelType from ...utils.api_object import APIObject, GuildProperty diff --git a/pincer/objects/app/interactions.py b/pincer/objects/app/interactions.py index a95ee992..5d54b87a 100644 --- a/pincer/objects/app/interactions.py +++ b/pincer/objects/app/interactions.py @@ -8,7 +8,6 @@ from typing import Any, Dict, TYPE_CHECKING, Union, Optional, List from pincer.utils.api_object import ChannelProperty, GuildProperty - from .command_types import AppCommandOptionType from .interaction_base import InteractionType, CallbackType from .mentionable import Mentionable diff --git a/pincer/objects/app/mentionable.py b/pincer/objects/app/mentionable.py index 41877dae..696c64ff 100644 --- a/pincer/objects/app/mentionable.py +++ b/pincer/objects/app/mentionable.py @@ -4,7 +4,6 @@ from dataclasses import dataclass from typing import Optional - from ...objects.guild.role import Role from ...objects.user.user import User diff --git a/pincer/objects/app/throttling.py b/pincer/objects/app/throttling.py index ac3ecc19..e35cda2e 100644 --- a/pincer/objects/app/throttling.py +++ b/pincer/objects/app/throttling.py @@ -5,7 +5,6 @@ from abc import ABC, abstractmethod from typing import TYPE_CHECKING - from .throttle_scope import ThrottleScope from ..app.command import ClientCommandStructure from ...exceptions import CommandCooldownError @@ -15,7 +14,6 @@ from typing import Dict, Optional from ...utils.types import Coro - from ..message.context import MessageContext class ThrottleInterface(ABC): diff --git a/pincer/objects/guild/channel.py b/pincer/objects/guild/channel.py index c7ca6bf9..b911fb01 100644 --- a/pincer/objects/guild/channel.py +++ b/pincer/objects/guild/channel.py @@ -17,7 +17,6 @@ from ...utils.convert_message import convert_message from ...utils.types import MISSING - if TYPE_CHECKING: from typing import AsyncGenerator, Dict, List, Optional, Union diff --git a/pincer/objects/guild/guild.py b/pincer/objects/guild/guild.py index 4e58f852..b6a0f595 100644 --- a/pincer/objects/guild/guild.py +++ b/pincer/objects/guild/guild.py @@ -22,7 +22,7 @@ from collections.abc import AsyncIterator from .audit_log import AuditLog from .ban import Ban - from .channel import PublicThread, PrivateThread, ChannelType + from .channel import ChannelType from .member import GuildMember from .features import GuildFeature from .invite import Invite @@ -506,7 +506,6 @@ async def modify_member(self, _id: int, reason=None, **kwargs) -> GuildMember: ) return GuildMember.from_dict(construct_client_dict(self._client, data)) - @overload async def create_channel( self, @@ -594,11 +593,11 @@ async def modify_channel_positions( await self._http.patch( f"guilds/{self.id}/channels", data=channel, - headers={"X-Audit-Log-Reason":reason} + headers={"X-Audit-Log-Reason": reason} ) async def list_active_threads(self) -> Tuple[ - Generator[Thread], Generator[GuildMember]]: + Generator[Thread], Generator[GuildMember]]: """|coro| Returns all active threads in the guild, including public and private threads. @@ -655,7 +654,6 @@ async def list_guild_members( construct_client_dict(self._client, member) ) - async def search_guild_members( self, query: str, @@ -712,13 +710,13 @@ async def add_guild_member( an oauth2 access token granted with the guilds.join to the bot's application for the user you want to add to the guild nick : Optional[str] - value to set users nickname to + value to set users nickname to roles : Optional[List[:class:`~pincer.utils.snowflake.Snowflake`]] - array of role ids the member is assigned + array of role ids the member is assigned mute : Optional[bool] - whether the user is muted in voice channels + whether the user is muted in voice channels deaf : Optional[bool] - whether the user is deafened in voice channels + whether the user is deafened in voice channels reason : Optional[:class:`str`] audit log reason |default| :data:`None` Returns @@ -767,7 +765,7 @@ async def modify_current_member( data = self._http.patch( f"guilds/{self.id}/members/@me", {"nick": nick}, - headers={"X-Audit-Log-Reason":reason} + headers={"X-Audit-Log-Reason": reason} ) return GuildMember.from_dict(construct_client_dict(self._client, data)) diff --git a/pincer/objects/message/context.py b/pincer/objects/message/context.py index b11aac9c..9288230d 100644 --- a/pincer/objects/message/context.py +++ b/pincer/objects/message/context.py @@ -9,7 +9,7 @@ from typing import Optional, Union from .user_message import UserMessage - from ..app import ClientCommandStructure, Interaction + from ..app import Interaction from ..app.interaction_flags import InteractionFlags from ..guild.member import GuildMember from ..user.user import User diff --git a/pincer/objects/message/file.py b/pincer/objects/message/file.py index 28d7cab4..72d6b254 100644 --- a/pincer/objects/message/file.py +++ b/pincer/objects/message/file.py @@ -3,8 +3,8 @@ from __future__ import annotations -from base64 import b64encode import os +from base64 import b64encode from dataclasses import dataclass from io import BytesIO from json import dumps diff --git a/pincer/objects/message/user_message.py b/pincer/objects/message/user_message.py index 9f7fa078..268b4cad 100644 --- a/pincer/objects/message/user_message.py +++ b/pincer/objects/message/user_message.py @@ -3,10 +3,10 @@ from __future__ import annotations +from collections import defaultdict from dataclasses import dataclass from enum import Enum, IntEnum from typing import TYPE_CHECKING, DefaultDict -from collections import defaultdict from .attachment import Attachment from .component import MessageComponent diff --git a/pincer/utils/__init__.py b/pincer/utils/__init__.py index a373ffe1..1c063394 100644 --- a/pincer/utils/__init__.py +++ b/pincer/utils/__init__.py @@ -4,21 +4,19 @@ from .api_object import APIObject, HTTPMeta, ChannelProperty, GuildProperty from .color import Color from .conversion import construct_client_dict -from .event_mgr import EventMgr -from .replace import replace from .directory import chdir +from .event_mgr import EventMgr from .extraction import get_index from .insertion import should_pass_cls, should_pass_ctx +from .replace import replace from .signature import get_params, get_signature_and_params from .snowflake import Snowflake from .tasks import Task, TaskScheduler from .timestamp import Timestamp - from .types import ( APINullable, Coro, MISSING, MissingType, choice_value_types, CheckFunction ) - __all__ = ( "APINullable", "APIObject", "ChannelProperty", "CheckFunction", "Color", "Coro", "EventMgr", "GuildProperty", "HTTPMeta", "MISSING", diff --git a/pincer/utils/api_object.py b/pincer/utils/api_object.py index 263ae2c4..babf8ea9 100644 --- a/pincer/utils/api_object.py +++ b/pincer/utils/api_object.py @@ -13,8 +13,7 @@ List, get_type_hints, get_origin, get_args ) -from pincer.utils.conversion import construct_client_dict - +from .conversion import construct_client_dict from .types import MissingType, MISSING, TypeCache from ..exceptions import InvalidArgumentAnnotation diff --git a/pincer/utils/conversion.py b/pincer/utils/conversion.py index 913a0904..6d5929b2 100644 --- a/pincer/utils/conversion.py +++ b/pincer/utils/conversion.py @@ -3,14 +3,11 @@ from __future__ import annotations -from inspect import getfullargspec from typing import TYPE_CHECKING -from .types import T, MISSING - if TYPE_CHECKING: from ..client import Client - from typing import Any, Callable, Dict, List, Optional, Set, Union, Tuple + from typing import Dict, List, Set, Union, Tuple def construct_client_dict(client: Client, data: Dict) -> Dict: diff --git a/pincer/utils/types.py b/pincer/utils/types.py index 3adf1043..96f36bb9 100644 --- a/pincer/utils/types.py +++ b/pincer/utils/types.py @@ -3,9 +3,7 @@ from __future__ import annotations from sys import modules -from typing import ( - TYPE_CHECKING, TypeVar, Callable, Coroutine, Any, Union, Optional -) +from typing import TypeVar, Callable, Coroutine, Any, Union, Optional class MissingType: From e26400fb7ce10b676bd9c408324f2c0bdaf51a5f Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 19:56:02 -0800 Subject: [PATCH 16/23] :bug: Fixed issue with API docs not building due to remove item --- docs/api/objects/guild.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/api/objects/guild.rst b/docs/api/objects/guild.rst index cd7a15cb..90905883 100644 --- a/docs/api/objects/guild.rst +++ b/docs/api/objects/guild.rst @@ -199,13 +199,6 @@ InviteStageInstance .. autoclass:: InviteStageInstance() -InviteMetadata -~~~~~~~~~~~~~~ - -.. attributetable:: InviteMetadata - -.. autoclass:: InviteMetadata() - Invite ~~~~~~ From 78693ad24a379b6ceb08f07c8af606be3ee92d6d Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:13:04 -0800 Subject: [PATCH 17/23] :memo: Moved things around to fix building issue --- docs/api/commands.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/commands.rst b/docs/api/commands.rst index 10e7ad58..98a62fb9 100644 --- a/docs/api/commands.rst +++ b/docs/api/commands.rst @@ -46,8 +46,12 @@ Message Components .. autoclass:: ButtonStyle() .. autoclass:: SelectMenu() .. autoclass:: SelectOption() + +.. currentmodule:: pincer.commands.components._component .. autoclass:: _Component() +.. currentmodule:: pincer.commands.components + .. autofunction:: button :decorator: .. autofunction:: select_menu From 70c3a6e81e360437ee4a46944c75a686ab490c8e Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:33:24 -0800 Subject: [PATCH 18/23] :memo: Another docs issue because use of a python 3.9 feature --- pincer/utils/insertion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pincer/utils/insertion.py b/pincer/utils/insertion.py index 51aed2a5..5e207ad3 100644 --- a/pincer/utils/insertion.py +++ b/pincer/utils/insertion.py @@ -8,13 +8,13 @@ from ..objects.message.context import MessageContext -def should_pass_cls(call: Union[Coro, Callable[..., Any]]) -> bool: +def should_pass_cls(call: Union[Coro, Callable[[...], Any]]) -> bool: """ Checks whether a callable requires a self/cls as first parameter. Parameters ---------- - call: Union[Coro, Callable[..., Any]] + call: Union[Coro, Callable[[...], Any]] The callable to check. Returns From fe278c9ff706f3f4a4f0ba5c3bdb2c9fabb107cc Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:34:42 -0800 Subject: [PATCH 19/23] :memo: Another doc issue fixed --- pincer/utils/insertion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pincer/utils/insertion.py b/pincer/utils/insertion.py index 5e207ad3..a78b5327 100644 --- a/pincer/utils/insertion.py +++ b/pincer/utils/insertion.py @@ -26,13 +26,13 @@ def should_pass_cls(call: Union[Coro, Callable[[...], Any]]) -> bool: return len(args) >= 1 and args[0] in ["self", "cls"] -def should_pass_gateway(call: Union[Coro, Callable[..., Any]]) -> bool: +def should_pass_gateway(call: Union[Coro, Callable[[...], Any]]) -> bool: """ Checks whether a callable requires a dispatcher as last parameter. Parameters ---------- - call: Union[:class:`~pincer.utils.types.Coro`, Callable[..., Any]] + call: Union[:class:`~pincer.utils.types.Coro`, Callable[[...], Any]] The callable to check. Returns From 7fa47e78ff70f76cde047bcc2fb93563c6cc06c7 Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:39:03 -0800 Subject: [PATCH 20/23] :memo: removed `...` from Callable --- pincer/utils/insertion.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pincer/utils/insertion.py b/pincer/utils/insertion.py index a78b5327..d877efbe 100644 --- a/pincer/utils/insertion.py +++ b/pincer/utils/insertion.py @@ -8,13 +8,13 @@ from ..objects.message.context import MessageContext -def should_pass_cls(call: Union[Coro, Callable[[...], Any]]) -> bool: +def should_pass_cls(call: Union[Coro, Callable[[Any], Any]]) -> bool: """ Checks whether a callable requires a self/cls as first parameter. Parameters ---------- - call: Union[Coro, Callable[[...], Any]] + call: Union[Coro, Callable[[Any], Any]] The callable to check. Returns @@ -26,13 +26,13 @@ def should_pass_cls(call: Union[Coro, Callable[[...], Any]]) -> bool: return len(args) >= 1 and args[0] in ["self", "cls"] -def should_pass_gateway(call: Union[Coro, Callable[[...], Any]]) -> bool: +def should_pass_gateway(call: Union[Coro, Callable[[Any], Any]]) -> bool: """ Checks whether a callable requires a dispatcher as last parameter. Parameters ---------- - call: Union[:class:`~pincer.utils.types.Coro`, Callable[[...], Any]] + call: Union[:class:`~pincer.utils.types.Coro`, Callable[[Any], Any]] The callable to check. Returns From 0ef2f918e5d98629db6355e4a3766e18e4285aa4 Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:46:29 -0800 Subject: [PATCH 21/23] :memo: Update to reflect gateway changes --- docs/api/core.rst | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/docs/api/core.rst b/docs/api/core.rst index d42318f6..a8f20396 100644 --- a/docs/api/core.rst +++ b/docs/api/core.rst @@ -18,24 +18,20 @@ GatewayDispatch Gateway ------- -Dispatcher +Gateway ~~~~~~~~~~ -.. attributetable:: Dispatcher +.. attributetable:: Gateway -.. autoclass:: Dispatcher() - :exclude-members: __handler_manager, __dispatcher +.. autoclass:: Gateway() -Heartbeat ---------- +GatewayInfo +~~~~~~~~~~ -Heartbeat -~~~~~~~~~ +.. attributetable:: GatewayInfo -.. attributetable:: Heartbeat +.. autoclass:: GatewayInfo() -.. autoclass:: Heartbeat() - :exclude-members: __send Http ---- From e8ad7b278f7356689db26261313e1b806b867b62 Mon Sep 17 00:00:00 2001 From: Yohann Boniface Date: Thu, 6 Jan 2022 10:39:07 +0100 Subject: [PATCH 22/23] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=200.15.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pincer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pincer/__init__.py b/pincer/__init__.py index 082b9b58..5955eae4 100644 --- a/pincer/__init__.py +++ b/pincer/__init__.py @@ -55,7 +55,7 @@ def __repr__(self) -> str: ) -version_info = VersionInfo(0, 15, 0) +version_info = VersionInfo(0, 15, 1) __version__ = repr(version_info) __all__ = ( From 255cc3ad9aa4c756a1595a351dc65df71bc1c4d5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 6 Jan 2022 09:39:34 +0000 Subject: [PATCH 23/23] :hammer: Automatic update of setup.cfg --- VERSION | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 7092c7c4..8076af51 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.15.0 \ No newline at end of file +0.15.1 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index adb4b440..3d29b370 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pincer -version = 0.15.0 +version = 0.15.1 description = Discord API wrapper rebuild from scratch. long_description = file: docs/PYPI.md long_description_content_type = text/markdown