diff --git a/interactions/client/utils/misc_utils.py b/interactions/client/utils/misc_utils.py old mode 100644 new mode 100755 diff --git a/interactions/models/discord/role.py b/interactions/models/discord/role.py index 5161f912d..2f81a0f92 100644 --- a/interactions/models/discord/role.py +++ b/interactions/models/discord/role.py @@ -2,12 +2,12 @@ from typing import Any, TYPE_CHECKING import attrs - from interactions.client.const import MISSING, T, Missing from interactions.client.utils import nulled_boolean_get from interactions.client.utils.attr_converters import optional as optional_c -from interactions.client.utils.serializer import dict_filter +from interactions.client.utils.serializer import dict_filter, to_image_data from interactions.models.discord.asset import Asset +from interactions.models.discord.file import UPLOADABLE_TYPE from interactions.models.discord.color import COLOR_TYPES, Color, process_color from interactions.models.discord.emoji import PartialEmoji from interactions.models.discord.enums import Permissions @@ -187,6 +187,8 @@ async def edit( color: Color | COLOR_TYPES | None = None, hoist: bool | None = None, mentionable: bool | None = None, + icon: bytes | UPLOADABLE_TYPE | None = None, + unicode_emoji: str | None = None, ) -> "Role": """ Edit this role, all arguments are optional. @@ -197,6 +199,8 @@ async def edit( color: The color of the role hoist: whether the role should be displayed separately in the sidebar mentionable: whether the role should be mentionable + icon: (Guild Level 2+) Bytes-like object representing the icon; supports PNG, JPEG and WebP + unicode_emoji: (Guild Level 2+) Unicode emoji for the role; can't be used with icon Returns: Role with updated information @@ -204,6 +208,11 @@ async def edit( """ color = process_color(color) + if icon and unicode_emoji: + raise ValueError("Cannot pass both icon and unicode_emoji") + if icon: + icon = to_image_data(icon) + payload = dict_filter( { "name": name, @@ -211,6 +220,8 @@ async def edit( "color": color, "hoist": hoist, "mentionable": mentionable, + "icon": icon, + "unicode_emoji": unicode_emoji, } ) diff --git a/pyproject.toml b/pyproject.toml index 68778cfea..1d28bd18b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "interactions.py" -version = "5.9.2" +version = "5.10.0" description = "Easy, simple, scalable and modular: a Python API wrapper for interactions." authors = [ "LordOfPolls ",