feature: Add missing properties to Guild and deprecate GuildEmbed (#1573)
* Add missing properties to Guild, related methods, and deprecate GuildEmbed endpoints - Add missing guild properties: `discovery_splash`, `widget_enabled`, `widget_channel_id`, `rules_channel_id`, `max_presences`, `max_presences`, `max_members`, `public_updates_channel_id`, `max_video_channel_users`, `approximate_member_count`, `approximate_presence_count` - Update guild properties: `embed_enabled`, `embed_channel_id` - Add `GetGuildDiscoverySplashUrl` to `CDN` - Add classes related to the guild widget - Add `withCounts` parameter to `GetGuild(s)Async` - Make GuildEmbed related methods obsolete with a message redirecting to widget ones * Change xml docs and PremiumSubscriptionCount type * Changed some xml docs
This commit is contained in:
@@ -5,6 +5,7 @@ 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;
|
||||
using ImageModel = Discord.API.Image;
|
||||
@@ -99,6 +100,27 @@ namespace Discord.Rest
|
||||
|
||||
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)
|
||||
{
|
||||
if (func == null)
|
||||
throw new ArgumentNullException(nameof(func));
|
||||
|
||||
var args = new GuildWidgetProperties();
|
||||
func(args);
|
||||
var apiArgs = new API.Rest.ModifyGuildWidgetParams
|
||||
{
|
||||
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.ModifyGuildWidgetAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
|
||||
}
|
||||
public static async Task ReorderChannelsAsync(IGuild guild, BaseDiscordClient client,
|
||||
IEnumerable<ReorderChannelProperties> args, RequestOptions options)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user