feature: Bump API version to 9 (#1847)
* First changes to the config * Lots of changes to fit the new version * Remove PermissionTargetConverter
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using EmbedModel = Discord.API.GuildEmbed;
|
||||
using WidgetModel = Discord.API.GuildWidget;
|
||||
using Model = Discord.API.Guild;
|
||||
using RoleModel = Discord.API.Role;
|
||||
@@ -81,26 +80,6 @@ namespace Discord.Rest
|
||||
return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
|
||||
}
|
||||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception>
|
||||
public static async Task<EmbedModel> ModifyEmbedAsync(IGuild guild, BaseDiscordClient client,
|
||||
Action<GuildEmbedProperties> func, RequestOptions options)
|
||||
{
|
||||
if (func == null) throw new ArgumentNullException(nameof(func));
|
||||
|
||||
var args = new GuildEmbedProperties();
|
||||
func(args);
|
||||
var apiArgs = new API.Rest.ModifyGuildEmbedParams
|
||||
{
|
||||
Enabled = args.Enabled
|
||||
};
|
||||
|
||||
if (args.Channel.IsSpecified)
|
||||
apiArgs.ChannelId = args.Channel.Value?.Id;
|
||||
else if (args.ChannelId.IsSpecified)
|
||||
apiArgs.ChannelId = args.ChannelId.Value;
|
||||
|
||||
return await client.ApiClient.ModifyGuildEmbedAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
|
||||
}
|
||||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <c>null</c>.</exception>
|
||||
public static async Task<WidgetModel> ModifyWidgetAsync(IGuild guild, BaseDiscordClient client,
|
||||
Action<GuildWidgetProperties> func, RequestOptions options)
|
||||
{
|
||||
@@ -205,8 +184,8 @@ namespace Discord.Rest
|
||||
{
|
||||
TargetId = overwrite.TargetId,
|
||||
TargetType = overwrite.TargetType,
|
||||
Allow = overwrite.Permissions.AllowValue,
|
||||
Deny = overwrite.Permissions.DenyValue
|
||||
Allow = overwrite.Permissions.AllowValue.ToString(),
|
||||
Deny = overwrite.Permissions.DenyValue.ToString()
|
||||
}).ToArray()
|
||||
: Optional.Create<API.Overwrite[]>(),
|
||||
};
|
||||
@@ -233,8 +212,8 @@ namespace Discord.Rest
|
||||
{
|
||||
TargetId = overwrite.TargetId,
|
||||
TargetType = overwrite.TargetType,
|
||||
Allow = overwrite.Permissions.AllowValue,
|
||||
Deny = overwrite.Permissions.DenyValue
|
||||
Allow = overwrite.Permissions.AllowValue.ToString(),
|
||||
Deny = overwrite.Permissions.DenyValue.ToString()
|
||||
}).ToArray()
|
||||
: Optional.Create<API.Overwrite[]>(),
|
||||
};
|
||||
@@ -258,8 +237,8 @@ namespace Discord.Rest
|
||||
{
|
||||
TargetId = overwrite.TargetId,
|
||||
TargetType = overwrite.TargetType,
|
||||
Allow = overwrite.Permissions.AllowValue,
|
||||
Deny = overwrite.Permissions.DenyValue
|
||||
Allow = overwrite.Permissions.AllowValue.ToString(),
|
||||
Deny = overwrite.Permissions.DenyValue.ToString()
|
||||
}).ToArray()
|
||||
: Optional.Create<API.Overwrite[]>(),
|
||||
};
|
||||
@@ -320,7 +299,7 @@ namespace Discord.Rest
|
||||
Hoist = isHoisted,
|
||||
Mentionable = isMentionable,
|
||||
Name = name,
|
||||
Permissions = permissions?.RawValue ?? Optional.Create<ulong>()
|
||||
Permissions = permissions?.RawValue.ToString() ?? Optional.Create<string>()
|
||||
};
|
||||
|
||||
var model = await client.ApiClient.CreateGuildRoleAsync(guild.Id, createGuildRoleParams, options).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user