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 @@ -62,6 +62,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2086](https://github.com/Pycord-Development/pycord/pull/2086))
- Added new embedded activities, Gartic Phone and Jamspace.
([#2102](https://github.com/Pycord-Development/pycord/pull/2102))
- Added `slowmode_delay` attribute to `discord.VoiceChannel`.
its-darsh marked this conversation as resolved.
Show resolved Hide resolved
([#2112](https://github.com/Pycord-Development/pycord/pull/2112))

### Changed

Expand Down
9 changes: 9 additions & 0 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,7 @@
"user_limit",
"_state",
"position",
"slowmode_delay",
"_overwrites",
"category_id",
"rtc_region",
Expand Down Expand Up @@ -1376,6 +1377,7 @@
data, "last_message_id"
)
self.position: int = data.get("position")
self.slowmode_delay = data.get("rate_limit_per_user", 0)

Check warning on line 1380 in discord/channel.py

View check run for this annotation

Codecov / codecov/patch

discord/channel.py#L1380

Added line #L1380 was not covered by tests
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 @@ -1482,6 +1484,12 @@
last_message_id: Optional[:class:`int`]
The ID of the last message sent to this channel. It may not always point to an existing or valid message.

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.0
its-darsh marked this conversation as resolved.
Show resolved Hide resolved
its-darsh marked this conversation as resolved.
Show resolved Hide resolved
flags: :class:`ChannelFlags`
Extra features of the channel.
Expand Down Expand Up @@ -1791,6 +1799,7 @@
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