From 7420d170b764027e99aaf0a9a8ed727bd34467ad Mon Sep 17 00:00:00 2001
From: Justin <14909116+ThatGuyJustin@users.noreply.github.com>
Date: Sun, 5 May 2019 14:13:24 -0400
Subject: [PATCH] Add slowmode property/set method to channel type (#139)

* Add slowmode property/set method to channel type

* Update emoji url too

* Revert emoji url change
---
 disco/types/channel.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/disco/types/channel.py b/disco/types/channel.py
index 92e04d8..f656e3a 100644
--- a/disco/types/channel.py
+++ b/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`