Skip to content
New issue

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

By clicking “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? Sign in to your account

feat: Add slowmode_delay attribute to discord.VoiceChannel #2112

Merged
merged 13 commits into from
Nov 29, 2023
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2206](https://github.com/Pycord-Development/pycord/pull/2206))
- Added function `Guild.delete_auto_moderation_rule`.
([#2153](https://github.com/Pycord-Development/pycord/pull/2153))
- Added `slowmode_delay` support to `VoiceChannel`.
its-darsh marked this conversation as resolved.
Show resolved Hide resolved
([#2112](https://github.com/Pycord-Development/pycord/pull/2112))

### Changed

Expand Down
10 changes: 10 additions & 0 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,7 @@ class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hasha
"user_limit",
"_state",
"position",
"slowmode_delay",
"_overwrites",
"category_id",
"rtc_region",
Expand Down Expand Up @@ -1376,6 +1377,7 @@ def _update(
data, "last_message_id"
)
self.position: int = data.get("position")
self.slowmode_delay = data.get("rate_limit_per_user", 0)
self.bitrate: int = data.get("bitrate")
self.user_limit: int = data.get("user_limit")
self.flags: ChannelFlags = ChannelFlags._from_value(data.get("flags", 0))
Expand Down Expand Up @@ -1483,6 +1485,13 @@ class VoiceChannel(discord.abc.Messageable, VocalGuildChannel):
The ID of the last message sent to this channel. It may not always point to an existing or valid message.

.. versionadded:: 2.0
its-darsh marked this conversation as resolved.
Show resolved Hide resolved
slowmode_delay: :class:`int`
The number of seconds a member must wait between sending messages
in this channel. A value of `0` denotes that it is disabled.
Bots and users with :attr:`~Permissions.manage_channels` or
:attr:`~Permissions.manage_messages` bypass slowmode.

its-darsh marked this conversation as resolved.
Show resolved Hide resolved
.. versionadded:: 2.5
flags: :class:`ChannelFlags`
Extra features of the channel.

Expand Down Expand Up @@ -1791,6 +1800,7 @@ async def edit(
overwrites: Mapping[Role | Member, PermissionOverwrite] = ...,
rtc_region: VoiceRegion | None = ...,
video_quality_mode: VideoQualityMode = ...,
slowmode_delay: int = ...,
Dorukyum marked this conversation as resolved.
Show resolved Hide resolved
reason: str | None = ...,
) -> VoiceChannel | None:
...
Expand Down