From 96efb95f6469fe555b9e7ea577faa913447589df Mon Sep 17 00:00:00 2001 From: EdVraz <88881326+EdVraz@users.noreply.github.com> Date: Fri, 3 Jun 2022 08:57:27 +0200 Subject: [PATCH 1/6] refactor: add query parameters to `get_reactions_of_emoji` --- interactions/api/http/guild.pyi | 1 - interactions/api/http/reaction.py | 11 ++++++++++- interactions/api/http/reaction.pyi | 2 +- interactions/api/models/message.py | 21 +++++++++++++++++++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/interactions/api/http/guild.pyi b/interactions/api/http/guild.pyi index 07e4f24a7..121b3b7ee 100644 --- a/interactions/api/http/guild.pyi +++ b/interactions/api/http/guild.pyi @@ -84,7 +84,6 @@ class GuildRequest: async def remove_guild_ban( self, guild_id: int, user_id: int, reason: Optional[str] = None ) -> None: ... - async def get_guild_bans( self, guild_id: int, diff --git a/interactions/api/http/reaction.py b/interactions/api/http/reaction.py index 05c7ec6f7..86ae656df 100644 --- a/interactions/api/http/reaction.py +++ b/interactions/api/http/reaction.py @@ -110,7 +110,7 @@ async def remove_all_reactions_of_emoji( ) async def get_reactions_of_emoji( - self, channel_id: int, message_id: int, emoji: str + self, channel_id: int, message_id: int, emoji: str, limit: int = 25, after: int = None, ) -> List[dict]: """ Gets the users who reacted to the emoji. @@ -118,8 +118,16 @@ async def get_reactions_of_emoji( :param channel_id: Channel snowflake ID. :param message_id: Message snowflake ID. :param emoji: The emoji to get (format: `name:id`) + :param limit: Max number of users to return (1-100) + :param after: Get users after this user ID :return A list of users who sent that emoji. """ + + params = {"limit": limit} + + if after: + params["after"] = after + return await self._req.request( Route( "GET", @@ -127,5 +135,6 @@ async def get_reactions_of_emoji( channel_id=channel_id, message_id=message_id, emoji=emoji, + params=params, ) ) diff --git a/interactions/api/http/reaction.pyi b/interactions/api/http/reaction.pyi index f2da61de7..f34134539 100644 --- a/interactions/api/http/reaction.pyi +++ b/interactions/api/http/reaction.pyi @@ -20,5 +20,5 @@ class ReactionRequest: self, channel_id: int, message_id: int, emoji: str ) -> None: ... async def get_reactions_of_emoji( - self, channel_id: int, message_id: int, emoji: str + self, channel_id: int, message_id: int, emoji: str, limit: int = 25, after: int = None, ) -> List[dict]: ... diff --git a/interactions/api/models/message.py b/interactions/api/models/message.py index 9ab69a5b8..fc4f5fd03 100644 --- a/interactions/api/models/message.py +++ b/interactions/api/models/message.py @@ -727,18 +727,35 @@ async def get_users_from_reaction( if not self._client: raise AttributeError("HTTPClient not found!") + _all_users: List[User] = [] + _emoji = ( f":{emoji.name.replace(':', '')}:{emoji.id or ''}" if isinstance(emoji, Emoji) else emoji ) - res = await self._client.get_reactions_of_emoji( + res: List[dict] = await self._client.get_reactions_of_emoji( channel_id=int(self.channel_id), message_id=int(self.id), emoji=_emoji, + limit=100 ) - return [User(**_) for _ in res] + + while len(res) == 100: + _after = int(res[-1]["id"]) + _all_users.extend(User(**_) for _ in res) + res: List[dict] = await self._client.get_reactions_of_emoji( + channel_id=int(self.channel_id), + message_id=int(self.id), + emoji=_emoji, + limit=100, + after=_after, + ) + + _all_users.extend(User(**_) for _ in res) + + return _all_users @classmethod async def get_from_url(cls, url: str, client: "HTTPClient") -> "Message": # noqa, From 77e9105f4630ecee63fa962dd3d22d50ef02dab6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 07:01:40 +0000 Subject: [PATCH 2/6] ci: correct from checks. --- interactions/api/http/reaction.py | 7 ++++++- interactions/api/models/message.py | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/interactions/api/http/reaction.py b/interactions/api/http/reaction.py index 86ae656df..221e30710 100644 --- a/interactions/api/http/reaction.py +++ b/interactions/api/http/reaction.py @@ -110,7 +110,12 @@ async def remove_all_reactions_of_emoji( ) async def get_reactions_of_emoji( - self, channel_id: int, message_id: int, emoji: str, limit: int = 25, after: int = None, + self, + channel_id: int, + message_id: int, + emoji: str, + limit: int = 25, + after: int = None, ) -> List[dict]: """ Gets the users who reacted to the emoji. diff --git a/interactions/api/models/message.py b/interactions/api/models/message.py index fc4f5fd03..e6004257f 100644 --- a/interactions/api/models/message.py +++ b/interactions/api/models/message.py @@ -706,7 +706,6 @@ async def remove_reaction_from( if not self._client: raise AttributeError("HTTPClient not found!") - _user_id = user if isinstance(user, int) else user.id return await self._client.remove_user_reaction( channel_id=int(self.channel_id), message_id=int(self.id), user_id=_user_id, emoji=_emoji @@ -736,10 +735,7 @@ async def get_users_from_reaction( ) res: List[dict] = await self._client.get_reactions_of_emoji( - channel_id=int(self.channel_id), - message_id=int(self.id), - emoji=_emoji, - limit=100 + channel_id=int(self.channel_id), message_id=int(self.id), emoji=_emoji, limit=100 ) while len(res) == 100: From 7c838c67c4e0046b25f89ea1d0c3642ec71b5a5b Mon Sep 17 00:00:00 2001 From: EdVraz <88881326+EdVraz@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:20:43 +0200 Subject: [PATCH 3/6] test for params --- interactions/api/http/reaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interactions/api/http/reaction.py b/interactions/api/http/reaction.py index 221e30710..d073808a7 100644 --- a/interactions/api/http/reaction.py +++ b/interactions/api/http/reaction.py @@ -128,10 +128,10 @@ async def get_reactions_of_emoji( :return A list of users who sent that emoji. """ - params = {"limit": limit} + params = {"limit": str(limit)} if after: - params["after"] = after + params["after"] = str(after) return await self._req.request( Route( From cfe3920651aa8de81796c822432a12bb0d143a0e Mon Sep 17 00:00:00 2001 From: EdVraz <88881326+EdVraz@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:34:20 +0200 Subject: [PATCH 4/6] test for params --- interactions/api/http/reaction.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interactions/api/http/reaction.py b/interactions/api/http/reaction.py index d073808a7..4d60cabee 100644 --- a/interactions/api/http/reaction.py +++ b/interactions/api/http/reaction.py @@ -128,18 +128,18 @@ async def get_reactions_of_emoji( :return A list of users who sent that emoji. """ - params = {"limit": str(limit)} - - if after: - params["after"] = str(after) + params_set = { + f"after={after}" if after else None, + f"limit={limit}", + } + final = "&".join([item for item in params_set if item is not None]) return await self._req.request( Route( "GET", - "/channels/{channel_id}/messages/{message_id}/reactions/{emoji}", + "/channels/{channel_id}/messages/{message_id}/reactions/{emoji}" + f"{'?' + final if final is not None else ''}", channel_id=channel_id, message_id=message_id, emoji=emoji, - params=params, ) ) From dd020ff9f871af11fa70a503cef06adb2a3ba1ce Mon Sep 17 00:00:00 2001 From: EdVraz <88881326+EdVraz@users.noreply.github.com> Date: Thu, 9 Jun 2022 18:17:08 +0200 Subject: [PATCH 5/6] revert: remove duplicates I accidentally made during merge --- interactions/api/models/message.py | 631 ----------------------------- 1 file changed, 631 deletions(-) diff --git a/interactions/api/models/message.py b/interactions/api/models/message.py index 0f435ef32..6cf9541ae 100644 --- a/interactions/api/models/message.py +++ b/interactions/api/models/message.py @@ -1318,634 +1318,3 @@ def url(self) -> str: """ guild = self.guild_id or "@me" return f"https://discord.com/channels/{guild}/{self.channel_id}/{self.id}" - -@define() -class Emoji(DictSerializerMixin): - """ - A class objecting representing an emoji. - - :ivar Optional[Snowflake] id?: Emoji id - :ivar Optional[str] name?: Emoji name. - :ivar Optional[List[Role]] roles?: Roles allowed to use this emoji - :ivar Optional[User] user?: User that created this emoji - :ivar Optional[bool] require_colons?: Status denoting of this emoji must be wrapped in colons - :ivar Optional[bool] managed?: Status denoting if this emoji is managed (by an integration) - :ivar Optional[bool] animated?: Status denoting if this emoji is animated - :ivar Optional[bool] available?: Status denoting if this emoji can be used. (Can be false via server boosting) - """ - - __slots__ = ( - "_client", - "_json", - "id", - "name", - "roles", - "user", - "require_colons", - "managed", - "animated", - "available", - ) - - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.id = Snowflake(self.id) if self._json.get("id") else None - - @classmethod - async def get( - cls, - guild_id: int, - emoji_id: int, - client: "HTTPClient", # noqa - ) -> "Emoji": - """ - Gets an emoji. - - :param guild_id: The id of the guild of the emoji - :type guild_id: int - :param emoji_id: The id of the emoji - :type emoji_id: int - :param client: The HTTPClient of your bot. Equals to ``bot._http`` - :type client: HTTPClient - :return: The Emoji as object - :rtype: Emoji - """ - res = await client.get_guild_emoji(guild_id=guild_id, emoji_id=emoji_id) - return cls(**res, _client=client) - - @classmethod - async def get_all_of_guild( - cls, - guild_id: int, - client: "HTTPClient", # noqa - ) -> List["Emoji"]: - """ - Gets all emoji of a guild. - - :param guild_id: The id of the guild to get the emojis of - :type guild_id: int - :param client: The HTTPClient of your bot. Equals to ``bot._http`` - :type client: HTTPClient - :return: The Emoji as list - :rtype: List[Emoji] - """ - res = await client.get_all_emoji(guild_id=guild_id) - return [cls(**emoji, _client=client) for emoji in res] - - async def delete( - self, - guild_id: int, - reason: Optional[str] = None, - ) -> None: - """ - Deletes the emoji. - - :param guild_id: The guild id to delete the emoji from - :type guild_id: int - :param reason?: The reason of the deletion - :type reason?: Optional[str] - """ - if not self._client: - raise AttributeError("HTTPClient not found!") - return await self._client.delete_guild_emoji( - guild_id=guild_id, emoji_id=int(self.id), reason=reason - ) - - @property - def url(self) -> str: - """ - Returns the emoji's URL. - - :return: URL of the emoji - :rtype: str - """ - url = f"https://cdn.discordapp.com/emojis/{self.id}" - url += ".gif" if self.animated else ".png" - return url - - -class ReactionObject(DictSerializerMixin): - """The reaction object. - - :ivar int count: The amount of times this emoji has been used to react - :ivar bool me: A status denoting if the current user reacted using this emoji - :ivar Emoji emoji: Emoji information - """ - - __slots__ = ("_json", "count", "me", "bool") - - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.emoji = Emoji(**self.emoji) if self._json.get("emoji") else None - - -class PartialSticker(DictSerializerMixin): - """ - Partial object for a Sticker. - - :ivar int id: ID of the sticker - :ivar str name: Name of the sticker - :ivar int format_type: Type of sticker format - """ - - __slots__ = ("_json", "id", "name", "format_type") - - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.id = Snowflake(self.id) if self._json.get("id") else None - - -class Sticker(PartialSticker): - """ - A class object representing a full sticker apart from a partial. - - :ivar int id: ID of the sticker - :ivar Optional[Snowflake] pack_id?: ID of the pack the sticker is from. - :ivar str name: Name of the sticker - :ivar Optional[str] description?: Description of the sticker - :ivar str tags: Autocomplete/suggestion tags for the sticker (max 200 characters) - :ivar str asset: Previously a sticker asset hash, now an empty string. - :ivar int type: Type of sticker - :ivar int format_type: Type of sticker format - :ivar Optional[bool] available?: Status denoting if this sticker can be used. (Can be false via server boosting) - :ivar Optional[Snowflake] guild_id?: Guild ID that owns the sticker. - :ivar Optional[User] user?: The user that uploaded the sticker. - :ivar Optional[int] sort_value?: The standard sticker's sort order within its pack - """ - - __slots__ = ( - "_json", - "id", - "pack_id", - "name", - "description", - "tags", - "asset", - "type", - "format_type", - "available", - "guild_id", - "user", - "sort_value", - ) - - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.id = Snowflake(self.id) if self._json.get("id") else None - self.pack_id = Snowflake(self.pack_id) if self._json.get("pack_id") else None - self.user = User(**self.user) if self._json.get("user") else None - - -class EmbedImageStruct(DictSerializerMixin): - """ - A class object representing the structure of an image in an embed. - - The structure of an embed image: - - .. code-block:: python - - interactions.EmbedImageStruct( - url="https://example.com/", - height=300, - width=250, - ) - - :ivar str url: Source URL of the object. - :ivar Optional[str] proxy_url?: Proxied url of the object. - :ivar Optional[int] height?: Height of the object. - :ivar Optional[int] width?: Width of the object. - """ - - __slots__ = ("_json", "url", "proxy_url", "height", "width") - - def __setattr__(self, key, value) -> None: - super().__setattr__(key, value) - if key != "_json" and (key not in self._json or value != self._json.get(key)): - if value is not None and value is not MISSING: - self._json.update({key: value}) - - elif value is None and key in self._json.keys(): - del self._json[key] - - -class EmbedProvider(DictSerializerMixin): - """ - A class object representing the provider of an embed. - - :ivar Optional[str] name?: Name of provider - :ivar Optional[str] url?: URL of provider - """ - - __slots__ = ("_json", "url", "name") - - def __setattr__(self, key, value) -> None: - super().__setattr__(key, value) - if key != "_json" and (key not in self._json or value != self._json.get(key)): - if value is not None and value is not MISSING: - self._json.update({key: value}) - - elif value is None and key in self._json.keys(): - del self._json[key] - - -class EmbedAuthor(DictSerializerMixin): - """ - A class object representing the author of an embed. - - The structure of an embed author: - - .. code-block:: python - - interactions.EmbedAuthor( - name="fl0w#0001", - ) - - :ivar str name: Name of author - :ivar Optional[str] url?: URL of author - :ivar Optional[str] icon_url?: URL of author icon - :ivar Optional[str] proxy_icon_url?: Proxied URL of author icon - """ - - __slots__ = ("_json", "url", "proxy_icon_url", "icon_url", "name") - - def __setattr__(self, key, value) -> None: - super().__setattr__(key, value) - if key != "_json" and (key not in self._json or value != self._json.get(key)): - if value is not None and value is not MISSING: - self._json.update({key: value}) - - elif value is None and key in self._json.keys(): - del self._json[key] - - -class EmbedFooter(DictSerializerMixin): - """ - A class object representing the footer of an embed. - - The structure of an embed footer: - - .. code-block:: python - - interactions.EmbedFooter( - text="yo mama so short, she can fit in here", - ) - - :ivar str text: Footer text - :ivar Optional[str] icon_url?: URL of footer icon - :ivar Optional[str] proxy_icon_url?: Proxied URL of footer icon - """ - - __slots__ = ("_json", "text", "proxy_icon_url", "icon_url") - - def __setattr__(self, key, value) -> None: - super().__setattr__(key, value) - if key != "_json" and (key not in self._json or value != self._json.get(key)): - if value is not None and value is not MISSING: - self._json.update({key: value}) - - elif value is None and key in self._json.keys(): - del self._json[key] - - -class EmbedField(DictSerializerMixin): - """ - A class object representing the field of an embed. - - The structure of an embed field: - - .. code-block:: python - - interactions.EmbedField( - name="field title", - value="blah blah blah", - inline=False, - ) - - :ivar str name: Name of the field. - :ivar str value: Value of the field - :ivar Optional[bool] inline?: A status denoting if the field should be displayed inline. - """ - - __slots__ = ("_json", "name", "inline", "value") - - def __setattr__(self, key, value) -> None: - super().__setattr__(key, value) - if key != "_json" and (key not in self._json or value != self._json.get(key)): - if value is not None and value is not MISSING: - self._json.update({key: value}) - - elif value is None and key in self._json.keys(): - del self._json[key] - - -class Embed(DictSerializerMixin): - """ - A class object representing an embed. - - .. note:: - The example provided below is for a very basic - implementation of an embed. Embeds are more unique - than what is being shown. - - The structure for an embed: - - .. code-block:: python - - interactions.Embed( - title="Embed title", - fields=[interaction.EmbedField(...)], - ) - - :ivar Optional[str] title?: Title of embed - :ivar Optional[str] type?: Embed type, relevant by CDN file connected. This is only important to rendering. - :ivar Optional[str] description?: Embed description - :ivar Optional[str] url?: URL of embed - :ivar Optional[datetime] timestamp?: Timestamp of embed content - :ivar Optional[int] color?: Color code of embed - :ivar Optional[EmbedFooter] footer?: Footer information - :ivar Optional[EmbedImageStruct] image?: Image information - :ivar Optional[EmbedImageStruct] thumbnail?: Thumbnail information - :ivar Optional[EmbedImageStruct] video?: Video information - :ivar Optional[EmbedProvider] provider?: Provider information - :ivar Optional[EmbedAuthor] author?: Author information - :ivar Optional[List[EmbedField]] fields?: A list of fields denoting field information - """ - - __slots__ = ( - "_json", - "title", - "type", - "description", - "url", - "timestamp", - "color", - "footer", - "image", - "thumbnail", - "video", - "provider", - "author", - "fields", - ) - - def __init__(self, **kwargs): - super().__init__(**kwargs) - if isinstance(self._json.get("timestamp"), str): - self.timestamp = datetime.fromisoformat( - self._json.get("timestamp") - ) # readability on non `_json` attr. - - self.footer = EmbedFooter(**self.footer) if isinstance(self.footer, dict) else self.footer - self.image = EmbedImageStruct(**self.image) if isinstance(self.image, dict) else self.image - self.thumbnail = ( - EmbedImageStruct(**self.thumbnail) - if isinstance(self.thumbnail, dict) - else self.thumbnail - ) - self.video = EmbedImageStruct(**self.video) if isinstance(self.video, dict) else self.video - self.provider = ( - EmbedProvider(**self.provider) if isinstance(self.provider, dict) else self.provider - ) - self.author = EmbedAuthor(**self.author) if isinstance(self.author, dict) else self.author - self.fields = ( - [EmbedField(**field) if isinstance(field, dict) else field for field in self.fields] - if self._json.get("fields") - else None - ) - # (Complete partial fix.) - # The issue seems to be that this itself is not updating - # JSON result correctly. After numerous attempts I seem to - # have the attribute to do it, but _json won't budge at all. - # a genexpr is a poor way to go about this, but I know later - # on we'll be refactoring this anyhow. What the fuck is breaking - # it? - - # the __setattr__ method fixes this issue :) - - def __setattr__(self, key, value) -> None: - super().__setattr__(key, value) - if key != "_json" and ( - key not in self._json - or ( - value != self._json.get(key) - or not isinstance(value, dict) - # we don't need this instance check in components because serialisation works for them - ) - ): - if value is not None and value is not MISSING: - try: - value = [val._json for val in value] if isinstance(value, list) else value._json - except AttributeError: - if isinstance(value, datetime): - value = value.isoformat() - self._json.update({key: value}) - - elif value is None and key in self._json.keys(): - del self._json[key] - - def add_field(self, name: str, value: str, inline: Optional[bool] = False) -> None: - """ - Adds a field to the embed - - :param name: The name of the field - :type name: str - :param value: The value of the field - :type value: str - :param inline?: if the field is in the same line as the previous one - :type inline?: Optional[bool] - """ - - fields = self.fields or [] - fields.append(EmbedField(name=name, value=value, inline=inline)) - - self.fields = fields - # We must use "=" here to call __setattr__. Append does not call any magic, making it impossible to modify the - # json when using it, so the object what would be sent wouldn't be modified. - # Imo this is still better than doing a `self._json.update({"fields": [field._json for ...]})` - - def clear_fields(self) -> None: - """ - Clears all the fields of the embed - """ - - self.fields = [] - - def insert_field_at( - self, index: int, name: str = None, value: str = None, inline: Optional[bool] = False - ) -> None: - """ - Inserts a field in the embed at the specified index - - :param index: The new field's index - :type index: int - :param name: The name of the field - :type name: str - :param value: The value of the field - :type value: str - :param inline?: if the field is in the same line as the previous one - :type inline?: Optional[bool] - """ - - fields = self.fields or [] - fields.insert(index, EmbedField(name=name, value=value, inline=inline)) - self.fields = fields - - def set_field_at( - self, index: int, name: str, value: str, inline: Optional[bool] = False - ) -> None: - """ - Overwrites the field in the embed at the specified index - - :param index: The new field's index - :type index: int - :param name: The name of the field - :type name: str - :param value: The value of the field - :type value: str - :param inline?: if the field is in the same line as the previous one - :type inline?: Optional[bool] - """ - - try: - self.fields[index] = EmbedField(name=name, value=value, inline=inline) - - except AttributeError as e: - raise AttributeError("No fields found in Embed") from e - - except IndexError as e: - raise IndexError("No fields at this index") from e - - def remove_field(self, index: int) -> None: - """ - Remove field at the specified index - - :param index: The new field's index - :type index: int - """ - - try: - fields = self.fields - fields.pop(index) - self.fields = fields - - except AttributeError as e: - raise AttributeError("No fields found in Embed") from e - - except IndexError as e: - raise IndexError("Field not Found at index") from e - - def remove_author(self) -> None: - """ - Removes the embed's author - """ - - try: - del self.author - except AttributeError: - pass - - def set_author( - self, - name: str, - url: Optional[str] = None, - icon_url: Optional[str] = None, - proxy_icon_url: Optional[str] = None, - ) -> None: - """ - Sets the embed's author - - :param name: The name of the author - :type name: str - :param url?: Url of author - :type url?: Optional[str] - :param icon_url?: Url of author icon (only supports http(s) and attachments) - :type icon_url?: Optional[str] - :param proxy_icon_url?: A proxied url of author icon - :type proxy_icon_url?: Optional[str] - """ - - self.author = EmbedAuthor( - name=name, url=url, icon_url=icon_url, proxy_icon_url=proxy_icon_url - ) - - def set_footer( - self, text: str, icon_url: Optional[str] = None, proxy_icon_url: Optional[str] = None - ) -> None: - """ - Sets the embed's footer - - :param text: The text of the footer - :type text: str - :param icon_url?: Url of footer icon (only supports http(s) and attachments) - :type icon_url?: Optional[str] - :param proxy_icon_url?: A proxied url of footer icon - :type proxy_icon_url?: Optional[str] - """ - - self.footer = EmbedFooter(text=text, icon_url=icon_url, proxy_icon_url=proxy_icon_url) - - def set_image( - self, - url: str, - proxy_url: Optional[str] = None, - height: Optional[int] = None, - width: Optional[int] = None, - ) -> None: - """ - Sets the embed's image - - :param url: Url of the image - :type url: str - :param proxy_url?: A proxied url of the image - :type proxy_url?: Optional[str] - :param height?: The image's height - :type height?: Optional[int] - :param width?: The image's width - :type width?: Optional[int] - """ - - self.image = EmbedImageStruct(url=url, proxy_url=proxy_url, height=height, width=width) - - def set_video( - self, - url: str, - proxy_url: Optional[str] = None, - height: Optional[int] = None, - width: Optional[int] = None, - ) -> None: - """ - Sets the embed's video - - :param url: Url of the video - :type url: str - :param proxy_url?: A proxied url of the video - :type proxy_url?: Optional[str] - :param height?: The video's height - :type height?: Optional[int] - :param width?: The video's width - :type width?: Optional[int] - """ - - self.video = EmbedImageStruct(url=url, proxy_url=proxy_url, height=height, width=width) - - def set_thumbnail( - self, - url: str, - proxy_url: Optional[str] = None, - height: Optional[int] = None, - width: Optional[int] = None, - ) -> None: - """ - Sets the embed's thumbnail - - :param url: Url of the thumbnail - :type url: str - :param proxy_url?: A proxied url of the thumbnail - :type proxy_url?: Optional[str] - :param height?: The thumbnail's height - :type height?: Optional[int] - :param width?: The thumbnail's width - :type width?: Optional[int] - """ - - self.thumbnail = EmbedImageStruct(url=url, proxy_url=proxy_url, height=height, width=width) From 6cbe6ac085b049ada9d7a155c8d4a7c677461b76 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 9 Jun 2022 16:17:40 +0000 Subject: [PATCH 6/6] ci: correct from checks. --- interactions/api/http/reaction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interactions/api/http/reaction.py b/interactions/api/http/reaction.py index 9dae2642d..6701f621a 100644 --- a/interactions/api/http/reaction.py +++ b/interactions/api/http/reaction.py @@ -137,7 +137,8 @@ async def get_reactions_of_emoji( return await self._req.request( Route( "GET", - "/channels/{channel_id}/messages/{message_id}/reactions/{emoji}" + f"{'?' + final if final is not None else ''}", + "/channels/{channel_id}/messages/{message_id}/reactions/{emoji}" + + f"{'?' + final if final is not None else ''}", channel_id=channel_id, message_id=message_id, emoji=emoji,