Skip to content

Commit

Permalink
feat: Add slowmode_delay attribute to discord.VoiceChannel (#2112)
Browse files Browse the repository at this point in the history
* feat: Add slowmode_delay attribute to discord.VoiceChannel

adds the `slowmode_delay` attribute to the `discord.VoiceChannel` class.

Signed-off-by: DARSH <[email protected]>

* Update CHANGELOG.md

Signed-off-by: DARSH <[email protected]>

* style(pre-commit): auto fixes from pre-commit.com hooks

* Fix duplicate changelog from pull from master

Signed-off-by: Middledot <[email protected]>

* added `versionadded` to docstr

Signed-off-by: The Darsh <[email protected]>

* Update CHANGELOG.md

Co-authored-by: plun1331 <[email protected]>
Signed-off-by: The Darsh <[email protected]>

* fix: `VoiceChannel` docstr

Signed-off-by: The Darsh <[email protected]>

* style(pre-commit): auto fixes from pre-commit.com hooks

* fix: VoiceChannel.slowmode_delay

Co-authored-by: Dorukyum <[email protected]>
Signed-off-by: The Darsh <[email protected]>

---------

Signed-off-by: DARSH <[email protected]>
Signed-off-by: Middledot <[email protected]>
Signed-off-by: The Darsh <[email protected]>
Co-authored-by: DARSH <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Middledot <[email protected]>
Co-authored-by: plun1331 <[email protected]>
Co-authored-by: Dorukyum <[email protected]>
Co-authored-by: Lala Sabathil <[email protected]>
  • Loading branch information
7 people authored Nov 29, 2023
1 parent ba5a52d commit 257d61a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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 `VoiceChannel.slowmode_delay`.
([#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
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.
.. 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 = ...,
reason: str | None = ...,
) -> VoiceChannel | None:
...
Expand Down

0 comments on commit 257d61a

Please sign in to comment.