Пример #1
0
        private async Task RespondWithEmbedAsync(ICommandContext context, CommandResult result)
        {
            DiscordEmbedBuilder?embed = result.Type switch
            {
                CommandResultType.Success => EmbedHelper.CreateSuccess(result.Message),
                CommandResultType.InvalidOperation => EmbedHelper.CreateError(result.Message),
                CommandResultType.InvalidParameter => EmbedHelper.CreateError(result.Message, "Parameter error"),
                _ => null
            };

            if (embed is not null)
            {
                await context.RespondAsync(embed);
            }
        }
    }