Skip to content

feat: Add support for editing member flags #1601

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions interactions/api/http/http_requests/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ async def modify_guild_member(
deaf: bool | None = None,
channel_id: "Snowflake_Type | MISSING" = MISSING,
communication_disabled_until: str | datetime | Timestamp | None | Missing = MISSING,
flags: int | Missing = MISSING,
reason: str | None = None,
) -> discord_typings.GuildMemberData:
"""
Expand All @@ -96,6 +97,7 @@ async def modify_guild_member(
deaf: Whether the user is deafened in voice channels
channel_id: id of channel to move user to (if they are connected to voice)
communication_disabled_until: when the user's timeout will expire and the user will be able to communicate in the guild again
flags: Represents the guild member flags
reason: An optional reason for the audit log

Returns:
Expand All @@ -118,6 +120,8 @@ async def modify_guild_member(
payload["nick"] = nickname
if not isinstance(communication_disabled_until, Missing):
payload["communication_disabled_until"] = communication_disabled_until
if not isinstance(flags, Missing):
payload["flags"] = flags

result = await self.request(
Route("PATCH", "/guilds/{guild_id}/members/{user_id}", guild_id=guild_id, user_id=user_id),
Expand Down
3 changes: 3 additions & 0 deletions interactions/models/discord/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ async def edit(
deaf: Absent[bool] = MISSING,
channel_id: Absent["Snowflake_Type"] = MISSING,
communication_disabled_until: Absent[Union["Timestamp", None]] = MISSING,
flags: Absent[int] = MISSING,
reason: Absent[str] = MISSING,
) -> None:
"""
Expand All @@ -652,6 +653,7 @@ async def edit(
deaf: Whether the user is deafened in voice channels
channel_id: id of channel to move user to (if they are connected to voice)
communication_disabled_until: when the user's timeout will expire and the user will be able to communicate in the guild again
flags: Represents the guild member flags
reason: An optional reason for the audit log
"""
await self._client.http.modify_guild_member(
Expand All @@ -663,6 +665,7 @@ async def edit(
deaf=deaf,
channel_id=channel_id,
communication_disabled_until=communication_disabled_until,
flags=flags,
reason=reason,
)

Expand Down
1 change: 1 addition & 0 deletions interactions/models/discord/user.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class Member(FakeUserMixin):
deaf: Absent[bool] = ...,
channel_id: Absent["Snowflake_Type"] = ...,
communication_disabled_until: Absent[Union["Timestamp", None]] = ...,
flags: Absent[int] = ...,
reason: Absent[str] = ...
) -> None: ...
async def kick(self, reason: Absent[str] = ...) -> None: ...
Expand Down