Fix swapped parameters in ArgumentException, ArgumentNullException cstrs (#1139)

* Fix swapped parameters in ArgumentException and ArgumentNullException cstrs

The constructors of ArgumentException and ArgumentNullException are inconsistent with each other, which results in their parameters being swapped here and there.

* Use named parameters for ArgumentException constructors

Cleans up some of the methods of EmbedBuilder to use simpler syntax as well
This commit is contained in:
Chris Johnston
2018-09-06 19:08:45 -07:00
committed by Christopher F
parent 272604f275
commit 9e9a11d4b0
9 changed files with 56 additions and 74 deletions

View File

@@ -147,7 +147,7 @@ namespace Discord.Rest
public static async Task<RestTextChannel> CreateTextChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options, Action<TextChannelProperties> func = null)
{
if (name == null) throw new ArgumentNullException(nameof(name));
if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var props = new TextChannelProperties();
func?.Invoke(props);
@@ -164,7 +164,7 @@ namespace Discord.Rest
public static async Task<RestVoiceChannel> CreateVoiceChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options, Action<VoiceChannelProperties> func = null)
{
if (name == null) throw new ArgumentNullException(nameof(name));
if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var props = new VoiceChannelProperties();
func?.Invoke(props);
@@ -181,7 +181,7 @@ namespace Discord.Rest
public static async Task<RestCategoryChannel> CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
if (name == null) throw new ArgumentNullException(nameof(name));
if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var args = new CreateGuildChannelParams(name, ChannelType.Category);
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
@@ -221,7 +221,7 @@ namespace Discord.Rest
public static async Task<RestRole> CreateRoleAsync(IGuild guild, BaseDiscordClient client,
string name, GuildPermissions? permissions, Color? color, bool isHoisted, RequestOptions options)
{
if (name == null) throw new ArgumentNullException(nameof(name));
if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var model = await client.ApiClient.CreateGuildRoleAsync(guild.Id, options).ConfigureAwait(false);
var role = RestRole.Create(client, guild, model);
@@ -356,7 +356,7 @@ namespace Discord.Rest
public static async Task<GuildEmote> ModifyEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, Action<EmoteProperties> func,
RequestOptions options)
{
if (func == null) throw new ArgumentNullException(nameof(func));
if (func == null) throw new ArgumentNullException(paramName: nameof(func));
var props = new EmoteProperties();
func(props);