Browse Source
Add slowmode property/set method to channel type
pull/139/head
Justin
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
11 additions and
0 deletions
-
disco/types/channel.py
|
|
@ -131,6 +131,7 @@ class Channel(SlottedModel, Permissible): |
|
|
|
type = Field(enum(ChannelType)) |
|
|
|
overwrites = AutoDictField(PermissionOverwrite, 'id', alias='permission_overwrites') |
|
|
|
parent_id = Field(snowflake) |
|
|
|
rate_limit_per_user = Field(int) |
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
super(Channel, self).__init__(*args, **kwargs) |
|
|
@ -475,6 +476,16 @@ class Channel(SlottedModel, Permissible): |
|
|
|
parent_id=to_snowflake(parent) if parent else parent, |
|
|
|
reason=reason) |
|
|
|
|
|
|
|
def set_slowmode(self, interval, reason=None): |
|
|
|
""" |
|
|
|
Sets the channels slowmode (rate_limit_per_user). |
|
|
|
""" |
|
|
|
assert (self.type == ChannelType.GUILD_TEXT) |
|
|
|
return self.client.api.channels_modify( |
|
|
|
self.id, |
|
|
|
rate_limit_per_user=interval, |
|
|
|
reason=reason) |
|
|
|
|
|
|
|
def create_text_channel(self, *args, **kwargs): |
|
|
|
""" |
|
|
|
Creates a sub-text-channel in this category. See `Guild.create_text_channel` |
|
|
|