lint: refactor SlowMode -> SlowModeInterval

this was the name change i always wanted
This commit is contained in:
Christopher F
2018-09-11 18:28:31 -04:00
parent 97d17cfdda
commit 232f525b59
8 changed files with 11 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ namespace Discord
string Topic { get; } string Topic { get; }
///<summary> Gets the current slow-mode delay for this channel. 0 if disabled. </summary> ///<summary> Gets the current slow-mode delay for this channel. 0 if disabled. </summary>
int SlowMode { get; } int SlowModeInterval { get; }
/// <summary> Bulk deletes multiple messages. </summary> /// <summary> Bulk deletes multiple messages. </summary>
Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null); Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null);

View File

@@ -22,6 +22,6 @@ namespace Discord
/// Users with <see cref="ChannelPermission.ManageMessages"/> will be exempt from slow-mode. /// Users with <see cref="ChannelPermission.ManageMessages"/> will be exempt from slow-mode.
/// </remarks> /// </remarks>
/// <exception cref="ArgumentOutOfRangeException">Throws ArgummentOutOfRange if the value does not fall within [0, 120]</exception> /// <exception cref="ArgumentOutOfRangeException">Throws ArgummentOutOfRange if the value does not fall within [0, 120]</exception>
public Optional<int> SlowMode { get; set; } public Optional<int> SlowModeInterval { get; set; }
} }
} }

View File

@@ -11,6 +11,6 @@ namespace Discord.API.Rest
[JsonProperty("nsfw")] [JsonProperty("nsfw")]
public Optional<bool> IsNsfw { get; set; } public Optional<bool> IsNsfw { get; set; }
[JsonProperty("rate_limit_per_user")] [JsonProperty("rate_limit_per_user")]
public Optional<int> SlowMode { get; set; } public Optional<int> SlowModeInterval { get; set; }
} }
} }

View File

@@ -356,8 +356,8 @@ namespace Discord.API
Preconditions.NotNull(args, nameof(args)); Preconditions.NotNull(args, nameof(args));
Preconditions.AtLeast(args.Position, 0, nameof(args.Position)); Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name)); Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
Preconditions.AtLeast(args.SlowMode, 0, nameof(args.SlowMode)); Preconditions.AtLeast(args.SlowModeInterval, 0, nameof(args.SlowModeInterval));
Preconditions.AtMost(args.SlowMode, 120, nameof(args.SlowMode)); Preconditions.AtMost(args.SlowModeInterval, 120, nameof(args.SlowModeInterval));
options = RequestOptions.CreateOrClone(options); options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(channelId: channelId); var ids = new BucketIds(channelId: channelId);

View File

@@ -46,7 +46,7 @@ namespace Discord.Rest
CategoryId = args.CategoryId, CategoryId = args.CategoryId,
Topic = args.Topic, Topic = args.Topic,
IsNsfw = args.IsNsfw, IsNsfw = args.IsNsfw,
SlowMode = args.SlowMode, SlowModeInterval = args.SlowModeInterval,
}; };
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false); return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
} }

View File

@@ -12,7 +12,7 @@ namespace Discord.Rest
public class RestTextChannel : RestGuildChannel, IRestMessageChannel, ITextChannel public class RestTextChannel : RestGuildChannel, IRestMessageChannel, ITextChannel
{ {
public string Topic { get; private set; } public string Topic { get; private set; }
public int SlowMode { get; private set; } public int SlowModeInterval { get; private set; }
public ulong? CategoryId { get; private set; } public ulong? CategoryId { get; private set; }
public string Mention => MentionUtils.MentionChannel(Id); public string Mention => MentionUtils.MentionChannel(Id);
@@ -35,7 +35,7 @@ namespace Discord.Rest
base.Update(model); base.Update(model);
CategoryId = model.CategoryId; CategoryId = model.CategoryId;
Topic = model.Topic.Value; Topic = model.Topic.Value;
SlowMode = model.SlowMode.Value; SlowModeInterval = model.SlowMode.Value;
_nsfw = model.Nsfw.GetValueOrDefault(); _nsfw = model.Nsfw.GetValueOrDefault();
} }

View File

@@ -156,7 +156,7 @@ namespace Discord.Rest
{ {
CategoryId = props.CategoryId, CategoryId = props.CategoryId,
Topic = props.Topic, Topic = props.Topic,
IsNsfw = props.IsNsfw IsNsfw = props.IsNsfw,
}; };
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false); var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestTextChannel.Create(client, guild, model); return RestTextChannel.Create(client, guild, model);

View File

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