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:
@@ -6,7 +6,6 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using EmbedModel = Discord.API.GuildEmbed;
|
||||
using WidgetModel = Discord.API.GuildWidget;
|
||||
using Model = Discord.API.Guild;
|
||||
|
||||
@@ -27,8 +26,6 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
public int AFKTimeout { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public bool IsEmbeddable { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public bool IsWidgetEnabled { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public VerificationLevel VerificationLevel { get; private set; }
|
||||
@@ -42,8 +39,6 @@ namespace Discord.Rest
|
||||
/// <inheritdoc />
|
||||
public ulong? AFKChannelId { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ulong? EmbedChannelId { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ulong? WidgetChannelId { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public ulong? SystemChannelId { get; private set; }
|
||||
@@ -133,16 +128,12 @@ namespace Discord.Rest
|
||||
internal void Update(Model model)
|
||||
{
|
||||
AFKChannelId = model.AFKChannelId;
|
||||
if (model.EmbedChannelId.IsSpecified)
|
||||
EmbedChannelId = model.EmbedChannelId.Value;
|
||||
if (model.WidgetChannelId.IsSpecified)
|
||||
WidgetChannelId = model.WidgetChannelId.Value;
|
||||
SystemChannelId = model.SystemChannelId;
|
||||
RulesChannelId = model.RulesChannelId;
|
||||
PublicUpdatesChannelId = model.PublicUpdatesChannelId;
|
||||
AFKTimeout = model.AFKTimeout;
|
||||
if (model.EmbedEnabled.IsSpecified)
|
||||
IsEmbeddable = model.EmbedEnabled.Value;
|
||||
if (model.WidgetEnabled.IsSpecified)
|
||||
IsWidgetEnabled = model.WidgetEnabled.Value;
|
||||
IconId = model.Icon;
|
||||
@@ -200,11 +191,6 @@ namespace Discord.Rest
|
||||
|
||||
Available = true;
|
||||
}
|
||||
internal void Update(EmbedModel model)
|
||||
{
|
||||
EmbedChannelId = model.ChannelId;
|
||||
IsEmbeddable = model.Enabled;
|
||||
}
|
||||
internal void Update(WidgetModel model)
|
||||
{
|
||||
WidgetChannelId = model.ChannelId;
|
||||
@@ -241,15 +227,6 @@ namespace Discord.Rest
|
||||
Update(model);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <see langword="null"/>.</exception>
|
||||
[Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
|
||||
public async Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null)
|
||||
{
|
||||
var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false);
|
||||
Update(model);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="ArgumentNullException"><paramref name="func"/> is <see langword="null"/>.</exception>
|
||||
public async Task ModifyWidgetAsync(Action<GuildWidgetProperties> func, RequestOptions options = null)
|
||||
@@ -463,23 +440,6 @@ namespace Discord.Rest
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild.
|
||||
/// </summary>
|
||||
/// <param name="options">The options to be used when sending the request.</param>
|
||||
/// <returns>
|
||||
/// A task that represents the asynchronous get operation. The task result contains the embed channel set
|
||||
/// within the server's widget settings; <see langword="null"/> if none is set.
|
||||
/// </returns>
|
||||
[Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
|
||||
public async Task<RestGuildChannel> GetEmbedChannelAsync(RequestOptions options = null)
|
||||
{
|
||||
var embedId = EmbedChannelId;
|
||||
if (embedId.HasValue)
|
||||
return await GuildHelper.GetChannelAsync(this, Discord, embedId.Value, options).ConfigureAwait(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
|
||||
/// </summary>
|
||||
@@ -937,15 +897,6 @@ namespace Discord.Rest
|
||||
return null;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
[Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
|
||||
async Task<IGuildChannel> IGuild.GetEmbedChannelAsync(CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
return await GetEmbedChannelAsync(options).ConfigureAwait(false);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
async Task<IGuildChannel> IGuild.GetWidgetChannelAsync(CacheMode mode, RequestOptions options)
|
||||
{
|
||||
if (mode == CacheMode.AllowDownload)
|
||||
|
||||
Reference in New Issue
Block a user