Skip to content

Commit

Permalink
feat: add util method
Browse files Browse the repository at this point in the history
Signed-off-by: plun1331 <[email protected]>
  • Loading branch information
plun1331 authored Sep 20, 2024
1 parent bef59ac commit e93caa4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -4145,3 +4145,25 @@ def entitlements(
guild_id=self.id,
exclude_ended=exclude_ended,
)

async def add_member_roles(self, member: int, role: Role, *, reason: str | None = None) -> None:
"""|coro|
Adds a role to a guild member with the specified ID.
Parameters
----------
member: :class:`int`
The member's ID.
role: :class:`Role`
The role to add.
reason: Optional[:class:`str`]
The reason for doing this action. Shows up on the audit log.
Raises
------
Forbidden
You do not have the proper permissions to add the role.
HTTPException
Role adding failed.
"""
await self._state.http.add_role(self.id, member, role.id, reason=reason)

0 comments on commit e93caa4

Please sign in to comment.