mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-29 10:39:53 +03:00
Show an error when entering the same value from the settings (#326)
Closes #324
This commit is contained in:
parent
07e8784d2e
commit
d6d2660fb0
9 changed files with 67 additions and 4 deletions
|
@ -202,6 +202,27 @@ public sealed class SettingsCommandGroup : CommandGroup
|
|||
IGuildOption option, string value, GuildData data, Snowflake channelId, IUser executor, IUser bot,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var equalsResult = option.ValueEquals(data.Settings, value);
|
||||
if (!equalsResult.IsSuccess)
|
||||
{
|
||||
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.SettingNotChanged, bot)
|
||||
.WithDescription(equalsResult.Error.Message)
|
||||
.WithColour(ColorsList.Red)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: ct);
|
||||
}
|
||||
|
||||
if (equalsResult.Entity)
|
||||
{
|
||||
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.SettingNotChanged, bot)
|
||||
.WithDescription(Messages.SettingValueEquals)
|
||||
.WithColour(ColorsList.Red)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct: ct);
|
||||
}
|
||||
|
||||
var setResult = option.Set(data.Settings, value);
|
||||
if (!setResult.IsSuccess)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue