diff --git a/src/Discord.Net.Core/Entities/Channels/ITextChannel.cs b/src/Discord.Net.Core/Entities/Channels/ITextChannel.cs
index 1f5496257..6c5d65501 100644
--- a/src/Discord.Net.Core/Entities/Channels/ITextChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/ITextChannel.cs
@@ -26,6 +26,9 @@ namespace Discord
///
string Topic { get; }
+ /// Gets the current slow-mode delay for this channel. 0 if disabled.
+ int SlowModeInterval { get; }
+
///
/// Bulk-deletes multiple messages.
///
diff --git a/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
index 471f74c7d..883493176 100644
--- a/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
+++ b/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
@@ -14,5 +14,15 @@ namespace Discord
/// Gets or sets whether this channel should be flagged as NSFW.
///
public Optional IsNsfw { get; set; }
+ ///
+ /// What the slow-mode ratelimit for this channel should be set to; 0 will disable slow-mode.
+ ///
+ ///
+ /// This value must fall within [0, 120]
+ ///
+ /// Users with will be exempt from slow-mode.
+ ///
+ /// Throws ArgummentOutOfRange if the value does not fall within [0, 120]
+ public Optional SlowModeInterval { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Common/Channel.cs b/src/Discord.Net.Rest/API/Common/Channel.cs
index 97c35a57b..57a5ce9ab 100644
--- a/src/Discord.Net.Rest/API/Common/Channel.cs
+++ b/src/Discord.Net.Rest/API/Common/Channel.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
using System;
@@ -33,6 +33,8 @@ namespace Discord.API
public Optional LastPinTimestamp { get; set; }
[JsonProperty("nsfw")]
public Optional Nsfw { get; set; }
+ [JsonProperty("rate_limit_per_user")]
+ public Optional SlowMode { get; set; }
//VoiceChannel
[JsonProperty("bitrate")]
diff --git a/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
index 9cabc67c1..94f149fc1 100644
--- a/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rest
@@ -10,5 +10,7 @@ namespace Discord.API.Rest
public Optional Topic { get; set; }
[JsonProperty("nsfw")]
public Optional IsNsfw { get; set; }
+ [JsonProperty("rate_limit_per_user")]
+ public Optional SlowModeInterval { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index 6e80f2c81..f41f55682 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -360,6 +360,8 @@ namespace Discord.API
Preconditions.NotNull(args, nameof(args));
Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
+ Preconditions.AtLeast(args.SlowModeInterval, 0, nameof(args.SlowModeInterval));
+ Preconditions.AtMost(args.SlowModeInterval, 120, nameof(args.SlowModeInterval));
options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(channelId: channelId);
diff --git a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
index 57ccd0207..716f3beaf 100644
--- a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
@@ -44,7 +44,8 @@ namespace Discord.Rest
Position = args.Position,
CategoryId = args.CategoryId,
Topic = args.Topic,
- IsNsfw = args.IsNsfw
+ IsNsfw = args.IsNsfw,
+ SlowModeInterval = args.SlowModeInterval,
};
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
}
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs
index 93fb116b1..4ccd35a3a 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestTextChannel.cs
@@ -16,6 +16,7 @@ namespace Discord.Rest
{
///
public string Topic { get; private set; }
+ public int SlowModeInterval { get; private set; }
///
public ulong? CategoryId { get; private set; }
@@ -40,6 +41,7 @@ namespace Discord.Rest
base.Update(model);
CategoryId = model.CategoryId;
Topic = model.Topic.Value;
+ SlowModeInterval = model.SlowMode.Value;
IsNsfw = model.Nsfw.GetValueOrDefault();
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index baf02414b..25f2f1fb4 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -158,7 +158,7 @@ namespace Discord.Rest
{
CategoryId = props.CategoryId,
Topic = props.Topic,
- IsNsfw = props.IsNsfw
+ IsNsfw = props.IsNsfw,
};
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestTextChannel.Create(client, guild, model);
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
index 59e9933c3..8faf1c6eb 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
@@ -20,6 +20,7 @@ namespace Discord.WebSocket
///
public string Topic { get; private set; }
+ public int SlowModeInterval { get; private set; }
///
public ulong? CategoryId { get; private set; }
///
@@ -62,6 +63,7 @@ namespace Discord.WebSocket
base.Update(state, model);
CategoryId = model.CategoryId;
Topic = model.Topic.Value;
+ SlowModeInterval = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet?
_nsfw = model.Nsfw.GetValueOrDefault();
}