Closed dacid44 closed 2 years ago
Discord's API spec (https://discord.com/developers/docs/resources/guild#modify-guild-role-positions) says that the JSON should be an array of objects (objects which look like what api.http.guild._GuildRequest.modify_guild_role_position()
gives it right now. All that probably needs to be changed is wrapping the JSON object in a list, but a core dev (@Astrea49 )in the Discord mentioned using that to make it possible to change multiple roles' positions at once. I can probably make a PR if that's what's wanted, it looks like an easy fix.
the current api.http.guild._GuildRequest.modify_guild_role_position()
function:
async def modify_guild_role_position(
self, guild_id: int, role_id: int, position: int, reason: Optional[str] = None
) -> List[dict]:
"""
Modify the position of a role in the guild.
:param guild_id: Guild ID snowflake.
:param role_id: Role ID snowflake.
:param position: The new position of the associated role.
:param reason: The reason for this action, if given.
:return: List of guild roles with updated hierarchy.
"""
return await self._req.request(
Route("PATCH", f"/guilds/{guild_id}/roles"),
json={"id": role_id, "position": position},
reason=reason,
)
Describe the bug.
When using the
Role.modify_position()
function, I get ainteractions.api.error.HTTPException: Invalid Form Body Error code: 50035
back.List the steps.
What you expected.
The role's position in the guild should be changed, and I should not see any errors.
What you saw.
Instead, I received this traceback error given from my Python terminal:
and this with debug logging enabled:
What version of the library did you use?
unstable
Version specification
4.1.1-rc.1
Code of Conduct