api: add slow mode

This adds the following property to ITextChannel
- SlowMode (int)

The SlowMode field defines the time in seconds users must wait between
sending messages; if zero, slow-mode is disabled.

Bots are not affected by slow-mode, and as such, no changes need to be
made to the REST client's internal ratelimiting. This is strictly a
read/write cosmetic property for bots.
This commit is contained in:
Christopher F
2018-09-11 18:21:22 -04:00
parent 9e9a11d4b0
commit 97d17cfdda
8 changed files with 30 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ namespace Discord.WebSocket
private readonly MessageCache _messages;
public string Topic { get; private set; }
public int SlowMode { get; private set; }
public ulong? CategoryId { get; private set; }
public ICategoryChannel Category
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;
@@ -47,6 +48,7 @@ namespace Discord.WebSocket
base.Update(state, model);
CategoryId = model.CategoryId;
Topic = model.Topic.Value;
SlowMode = model.SlowMode.GetValueOrDefault(); // some guilds haven't been patched to include this yet?
_nsfw = model.Nsfw.GetValueOrDefault();
}