2023-07-09 16:32:14 +03:00
|
|
|
|
using System.ComponentModel;
|
2023-10-28 21:10:16 +03:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
using System.Text;
|
2023-07-20 23:41:02 +03:00
|
|
|
|
using System.Text.Json.Nodes;
|
2023-07-18 15:25:02 +03:00
|
|
|
|
using JetBrains.Annotations;
|
2023-09-30 16:58:32 +03:00
|
|
|
|
using Octobot.Data;
|
|
|
|
|
using Octobot.Data.Options;
|
2023-10-12 18:37:25 +03:00
|
|
|
|
using Octobot.Extensions;
|
2023-09-30 16:58:32 +03:00
|
|
|
|
using Octobot.Services;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
using Remora.Commands.Attributes;
|
|
|
|
|
using Remora.Commands.Groups;
|
2023-07-18 15:25:02 +03:00
|
|
|
|
using Remora.Discord.API.Abstractions.Objects;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
using Remora.Discord.API.Abstractions.Rest;
|
2023-07-18 15:25:02 +03:00
|
|
|
|
using Remora.Discord.Commands.Attributes;
|
|
|
|
|
using Remora.Discord.Commands.Conditions;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
using Remora.Discord.Commands.Contexts;
|
|
|
|
|
using Remora.Discord.Commands.Feedback.Services;
|
|
|
|
|
using Remora.Discord.Extensions.Embeds;
|
|
|
|
|
using Remora.Discord.Extensions.Formatting;
|
2023-08-03 23:32:38 +03:00
|
|
|
|
using Remora.Rest.Core;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
using Remora.Results;
|
|
|
|
|
|
2023-09-30 16:58:32 +03:00
|
|
|
|
namespace Octobot.Commands;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles the commands to list and modify per-guild settings: /settings and /settings list.
|
|
|
|
|
/// </summary>
|
2023-07-18 15:25:02 +03:00
|
|
|
|
[UsedImplicitly]
|
2023-08-02 23:51:16 +03:00
|
|
|
|
public class SettingsCommandGroup : CommandGroup
|
|
|
|
|
{
|
2023-08-22 10:45:46 +03:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents all options as an array of objects implementing <see cref="IOption" />.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// WARNING: If you update this array in any way, you must also update <see cref="AllOptionsEnum" /> and make sure
|
|
|
|
|
/// that the orders match.
|
|
|
|
|
/// </remarks>
|
2023-08-02 23:51:16 +03:00
|
|
|
|
private static readonly IOption[] AllOptions =
|
2023-12-20 19:23:37 +03:00
|
|
|
|
[
|
2023-07-18 15:25:02 +03:00
|
|
|
|
GuildSettings.Language,
|
|
|
|
|
GuildSettings.WelcomeMessage,
|
|
|
|
|
GuildSettings.ReceiveStartupMessages,
|
|
|
|
|
GuildSettings.RemoveRolesOnMute,
|
|
|
|
|
GuildSettings.ReturnRolesOnRejoin,
|
|
|
|
|
GuildSettings.AutoStartEvents,
|
2023-07-24 19:51:05 +03:00
|
|
|
|
GuildSettings.RenameHoistedUsers,
|
2023-07-18 15:25:02 +03:00
|
|
|
|
GuildSettings.PublicFeedbackChannel,
|
|
|
|
|
GuildSettings.PrivateFeedbackChannel,
|
|
|
|
|
GuildSettings.EventNotificationChannel,
|
|
|
|
|
GuildSettings.DefaultRole,
|
|
|
|
|
GuildSettings.MuteRole,
|
|
|
|
|
GuildSettings.EventNotificationRole,
|
|
|
|
|
GuildSettings.EventEarlyNotificationOffset
|
2023-12-20 19:23:37 +03:00
|
|
|
|
];
|
2023-07-18 15:25:02 +03:00
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
private readonly ICommandContext _context;
|
2023-11-04 21:28:22 +03:00
|
|
|
|
private readonly IFeedbackService _feedback;
|
2023-08-02 23:51:16 +03:00
|
|
|
|
private readonly GuildDataService _guildData;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
private readonly IDiscordRestUserAPI _userApi;
|
2023-08-03 23:32:38 +03:00
|
|
|
|
private readonly UtilityService _utility;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
|
|
|
|
public SettingsCommandGroup(
|
2023-08-02 23:51:16 +03:00
|
|
|
|
ICommandContext context, GuildDataService guildData,
|
2023-11-04 21:28:22 +03:00
|
|
|
|
IFeedbackService feedback, IDiscordRestUserAPI userApi, UtilityService utility)
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-07-09 16:32:14 +03:00
|
|
|
|
_context = context;
|
2023-08-02 23:51:16 +03:00
|
|
|
|
_guildData = guildData;
|
|
|
|
|
_feedback = feedback;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
_userApi = userApi;
|
2023-08-03 23:32:38 +03:00
|
|
|
|
_utility = utility;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-08-12 23:19:07 +03:00
|
|
|
|
/// A slash command that sends a page from the list of current GuildSettings.
|
2023-07-09 16:32:14 +03:00
|
|
|
|
/// </summary>
|
2023-08-12 23:19:07 +03:00
|
|
|
|
/// <param name="page">The number of the page to send.</param>
|
2023-07-09 16:32:14 +03:00
|
|
|
|
/// <returns>
|
|
|
|
|
/// A feedback sending result which may or may not have succeeded.
|
|
|
|
|
/// </returns>
|
2023-08-22 02:18:58 +03:00
|
|
|
|
[Command("listsettings")]
|
2023-07-18 15:25:02 +03:00
|
|
|
|
[DiscordDefaultMemberPermissions(DiscordPermission.ManageGuild)]
|
|
|
|
|
[DiscordDefaultDMPermission(false)]
|
|
|
|
|
[RequireContext(ChannelContext.Guild)]
|
|
|
|
|
[RequireDiscordPermission(DiscordPermission.ManageGuild)]
|
2023-07-09 16:32:14 +03:00
|
|
|
|
[Description("Shows settings list for this server")]
|
2023-07-18 15:25:02 +03:00
|
|
|
|
[UsedImplicitly]
|
2023-08-22 02:18:58 +03:00
|
|
|
|
public async Task<Result> ExecuteListSettingsAsync(
|
|
|
|
|
[Description("Settings list page")] [MinValue(1)]
|
2023-08-12 23:19:07 +03:00
|
|
|
|
int page)
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-07-09 16:32:14 +03:00
|
|
|
|
if (!_context.TryGetContextIDs(out var guildId, out _, out _))
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-07-28 19:58:55 +03:00
|
|
|
|
return new ArgumentInvalidError(nameof(_context), "Unable to retrieve necessary IDs from command context");
|
2023-08-02 23:51:16 +03:00
|
|
|
|
}
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var botResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
|
|
|
|
if (!botResult.IsDefined(out var bot))
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return Result.FromError(botResult);
|
2023-08-02 23:51:16 +03:00
|
|
|
|
}
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
var cfg = await _guildData.GetSettings(guildId, CancellationToken);
|
2023-07-18 15:25:02 +03:00
|
|
|
|
Messages.Culture = GuildSettings.Language.Get(cfg);
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return await SendSettingsListAsync(cfg, bot, page, CancellationToken);
|
2023-07-20 23:41:02 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-05 22:24:55 +03:00
|
|
|
|
private Task<Result> SendSettingsListAsync(JsonNode cfg, IUser bot, int page,
|
2023-08-02 23:51:16 +03:00
|
|
|
|
CancellationToken ct = default)
|
|
|
|
|
{
|
2023-07-26 21:07:05 +03:00
|
|
|
|
var description = new StringBuilder();
|
2023-07-25 17:53:11 +03:00
|
|
|
|
var footer = new StringBuilder();
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-07-26 21:07:05 +03:00
|
|
|
|
const int optionsPerPage = 10;
|
2023-07-25 17:53:11 +03:00
|
|
|
|
|
2023-07-26 21:07:05 +03:00
|
|
|
|
var totalPages = (AllOptions.Length + optionsPerPage - 1) / optionsPerPage;
|
|
|
|
|
var lastOptionOnPage = Math.Min(optionsPerPage * page, AllOptions.Length);
|
|
|
|
|
var firstOptionOnPage = optionsPerPage * page - optionsPerPage;
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
if (firstOptionOnPage >= AllOptions.Length)
|
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var errorEmbed = new EmbedBuilder().WithSmallTitle(Messages.PageNotFound, bot)
|
2023-07-26 21:07:05 +03:00
|
|
|
|
.WithDescription(string.Format(Messages.PagesAllowed, Markdown.Bold(totalPages.ToString())))
|
2023-07-25 17:53:11 +03:00
|
|
|
|
.WithColour(ColorsList.Red)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return _feedback.SendContextualEmbedResultAsync(errorEmbed, ct: ct);
|
2023-08-02 23:51:16 +03:00
|
|
|
|
}
|
2023-07-26 21:07:05 +03:00
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
footer.Append($"{Messages.Page} {page}/{totalPages} ");
|
|
|
|
|
for (var i = 0; i < totalPages; i++)
|
|
|
|
|
{
|
|
|
|
|
footer.Append(i + 1 == page ? "●" : "○");
|
|
|
|
|
}
|
2023-07-26 21:07:05 +03:00
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
for (var i = firstOptionOnPage; i < lastOptionOnPage; i++)
|
|
|
|
|
{
|
|
|
|
|
var optionName = AllOptions[i].Name;
|
|
|
|
|
var optionValue = AllOptions[i].Display(cfg);
|
2023-07-26 21:07:05 +03:00
|
|
|
|
|
2023-12-04 17:09:47 +03:00
|
|
|
|
description.AppendBulletPointLine($"Settings{optionName}".Localized())
|
|
|
|
|
.AppendSubBulletPoint(Markdown.InlineCode(optionName))
|
|
|
|
|
.Append(": ").AppendLine(optionValue);
|
2023-07-26 21:07:05 +03:00
|
|
|
|
}
|
2023-08-02 23:51:16 +03:00
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var embed = new EmbedBuilder().WithSmallTitle(Messages.SettingsListTitle, bot)
|
2023-08-02 23:51:16 +03:00
|
|
|
|
.WithDescription(description.ToString())
|
|
|
|
|
.WithColour(ColorsList.Default)
|
|
|
|
|
.WithFooter(footer.ToString())
|
|
|
|
|
.Build();
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
|
2023-07-09 16:32:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-08-02 23:51:16 +03:00
|
|
|
|
/// A slash command that modifies per-guild GuildSettings.
|
2023-07-09 16:32:14 +03:00
|
|
|
|
/// </summary>
|
2023-07-09 18:15:39 +03:00
|
|
|
|
/// <param name="setting">The setting to modify.</param>
|
|
|
|
|
/// <param name="value">The new value of the setting.</param>
|
|
|
|
|
/// <returns>A feedback sending result which may or may not have succeeded.</returns>
|
2023-08-22 02:18:58 +03:00
|
|
|
|
[Command("editsettings")]
|
2023-07-18 15:25:02 +03:00
|
|
|
|
[DiscordDefaultMemberPermissions(DiscordPermission.ManageGuild)]
|
|
|
|
|
[DiscordDefaultDMPermission(false)]
|
|
|
|
|
[RequireContext(ChannelContext.Guild)]
|
|
|
|
|
[RequireDiscordPermission(DiscordPermission.ManageGuild)]
|
2023-07-09 16:32:14 +03:00
|
|
|
|
[Description("Change settings for this server")]
|
2023-07-18 15:25:02 +03:00
|
|
|
|
[UsedImplicitly]
|
2023-08-22 02:18:58 +03:00
|
|
|
|
public async Task<Result> ExecuteEditSettingsAsync(
|
2023-07-09 18:15:39 +03:00
|
|
|
|
[Description("The setting whose value you want to change")]
|
2023-08-22 10:45:46 +03:00
|
|
|
|
AllOptionsEnum setting,
|
2023-10-28 21:10:16 +03:00
|
|
|
|
[Description("Setting value")] [MaxLength(512)]
|
|
|
|
|
string value)
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
if (!_context.TryGetContextIDs(out var guildId, out var channelId, out var executorId))
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-07-28 19:58:55 +03:00
|
|
|
|
return new ArgumentInvalidError(nameof(_context), "Unable to retrieve necessary IDs from command context");
|
2023-08-02 23:51:16 +03:00
|
|
|
|
}
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var botResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
|
|
|
|
if (!botResult.IsDefined(out var bot))
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return Result.FromError(botResult);
|
2023-08-02 23:51:16 +03:00
|
|
|
|
}
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var executorResult = await _userApi.GetUserAsync(executorId, CancellationToken);
|
|
|
|
|
if (!executorResult.IsDefined(out var executor))
|
2023-08-03 23:32:38 +03:00
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return Result.FromError(executorResult);
|
2023-08-03 23:32:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
var data = await _guildData.GetData(guildId, CancellationToken);
|
2023-07-20 23:41:02 +03:00
|
|
|
|
Messages.Culture = GuildSettings.Language.Get(data.Settings);
|
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return await EditSettingAsync(AllOptions[(int)setting], value, data, channelId, executor, bot,
|
2023-08-22 10:45:46 +03:00
|
|
|
|
CancellationToken);
|
2023-07-20 23:41:02 +03:00
|
|
|
|
}
|
2023-07-18 15:25:02 +03:00
|
|
|
|
|
2023-07-20 23:41:02 +03:00
|
|
|
|
private async Task<Result> EditSettingAsync(
|
2023-10-04 18:21:10 +03:00
|
|
|
|
IOption option, string value, GuildData data, Snowflake channelId, IUser executor, IUser bot,
|
2023-08-03 23:32:38 +03:00
|
|
|
|
CancellationToken ct = default)
|
2023-08-02 23:51:16 +03:00
|
|
|
|
{
|
2023-07-20 23:41:02 +03:00
|
|
|
|
var setResult = option.Set(data.Settings, value);
|
2023-08-02 23:51:16 +03:00
|
|
|
|
if (!setResult.IsSuccess)
|
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.SettingNotChanged, bot)
|
2023-07-18 15:25:02 +03:00
|
|
|
|
.WithDescription(setResult.Error.Message)
|
2023-07-09 16:32:14 +03:00
|
|
|
|
.WithColour(ColorsList.Red)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: ct);
|
2023-07-09 16:32:14 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var builder = new StringBuilder();
|
|
|
|
|
|
2023-07-18 15:25:02 +03:00
|
|
|
|
builder.Append(Markdown.InlineCode(option.Name))
|
2023-07-09 18:15:39 +03:00
|
|
|
|
.Append($" {Messages.SettingIsNow} ")
|
2023-07-20 23:41:02 +03:00
|
|
|
|
.Append(option.Display(data.Settings));
|
2023-08-03 23:32:38 +03:00
|
|
|
|
var title = Messages.SettingSuccessfullyChanged;
|
|
|
|
|
var description = builder.ToString();
|
|
|
|
|
|
|
|
|
|
var logResult = _utility.LogActionAsync(
|
2023-10-04 18:21:10 +03:00
|
|
|
|
data.Settings, channelId, executor, title, description, bot, ColorsList.Magenta, false, ct);
|
2023-08-03 23:32:38 +03:00
|
|
|
|
if (!logResult.IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
return Result.FromError(logResult.Error);
|
|
|
|
|
}
|
2023-07-09 16:32:14 +03:00
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var embed = new EmbedBuilder().WithSmallTitle(title, bot)
|
2023-08-03 23:32:38 +03:00
|
|
|
|
.WithDescription(description)
|
2023-07-09 16:32:14 +03:00
|
|
|
|
.WithColour(ColorsList.Green)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
|
2023-07-09 16:32:14 +03:00
|
|
|
|
}
|
2023-09-22 20:23:08 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A slash command that resets per-guild GuildSettings.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="setting">The setting to reset.</param>
|
|
|
|
|
/// <returns>A feedback sending result which may have succeeded.</returns>
|
|
|
|
|
[Command("resetsettings")]
|
|
|
|
|
[DiscordDefaultMemberPermissions(DiscordPermission.ManageGuild)]
|
|
|
|
|
[DiscordDefaultDMPermission(false)]
|
|
|
|
|
[RequireContext(ChannelContext.Guild)]
|
|
|
|
|
[RequireDiscordPermission(DiscordPermission.ManageGuild)]
|
|
|
|
|
[Description("Reset settings for this server")]
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
public async Task<Result> ExecuteResetSettingsAsync(
|
|
|
|
|
[Description("Setting to reset")] AllOptionsEnum? setting = null)
|
|
|
|
|
{
|
|
|
|
|
if (!_context.TryGetContextIDs(out var guildId, out _, out _))
|
|
|
|
|
{
|
|
|
|
|
return new ArgumentInvalidError(nameof(_context), "Unable to retrieve necessary IDs from command context");
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var botResult = await _userApi.GetCurrentUserAsync(CancellationToken);
|
|
|
|
|
if (!botResult.IsDefined(out var bot))
|
2023-09-22 20:23:08 +03:00
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return Result.FromError(botResult);
|
2023-09-22 20:23:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cfg = await _guildData.GetSettings(guildId, CancellationToken);
|
|
|
|
|
Messages.Culture = GuildSettings.Language.Get(cfg);
|
|
|
|
|
|
|
|
|
|
if (setting is not null)
|
|
|
|
|
{
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return await ResetSingleSettingAsync(cfg, bot, AllOptions[(int)setting], CancellationToken);
|
2023-09-22 20:23:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
return await ResetAllSettingsAsync(cfg, bot, CancellationToken);
|
2023-09-22 20:23:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
private async Task<Result> ResetSingleSettingAsync(JsonNode cfg, IUser bot,
|
2023-09-22 20:23:08 +03:00
|
|
|
|
IOption option, CancellationToken ct = default)
|
|
|
|
|
{
|
|
|
|
|
var resetResult = option.Reset(cfg);
|
|
|
|
|
if (!resetResult.IsSuccess)
|
|
|
|
|
{
|
|
|
|
|
return Result.FromError(resetResult.Error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var embed = new EmbedBuilder().WithSmallTitle(
|
2023-10-04 18:21:10 +03:00
|
|
|
|
string.Format(Messages.SingleSettingReset, option.Name), bot)
|
2023-09-22 20:23:08 +03:00
|
|
|
|
.WithColour(ColorsList.Green)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
|
2023-09-22 20:23:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
private async Task<Result> ResetAllSettingsAsync(JsonNode cfg, IUser bot,
|
2023-09-22 20:23:08 +03:00
|
|
|
|
CancellationToken ct = default)
|
|
|
|
|
{
|
|
|
|
|
var failedResults = new List<Result>();
|
|
|
|
|
foreach (var resetResult in AllOptions.Select(option => option.Reset(cfg)))
|
|
|
|
|
{
|
|
|
|
|
failedResults.AddIfFailed(resetResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (failedResults.Count is not 0)
|
|
|
|
|
{
|
|
|
|
|
return failedResults.AggregateErrors();
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-04 18:21:10 +03:00
|
|
|
|
var embed = new EmbedBuilder().WithSmallTitle(Messages.AllSettingsReset, bot)
|
2023-09-22 20:23:08 +03:00
|
|
|
|
.WithColour(ColorsList.Green)
|
|
|
|
|
.Build();
|
|
|
|
|
|
2023-12-17 18:44:18 +03:00
|
|
|
|
return await _feedback.SendContextualEmbedResultAsync(embed, ct: ct);
|
2023-09-22 20:23:08 +03:00
|
|
|
|
}
|
2023-07-09 16:32:14 +03:00
|
|
|
|
}
|