Пример #1
0
        public static async Task RespondError(CommandErrorEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            if (e.Exception is ChecksFailedException cfex)
            {
                await ChecksFailedResponderAsync(e, cfex).ConfigureAwait(false);
            }
            else if (e.Exception is ArgumentException)
            {
                await ArgumentResponder(e).ConfigureAwait(false);
            }
            else
            {
                var embed = CommandUtils.ErrorBase(e.Context);
                embed.Description = "An unknown error occoured. Please report this to Partner Bot Staff with pb!report <error message>\n\n" +
                                    "Replace <error message> with the following:\n" +
                                    $"```{e.Exception.Message}\n{e.Exception.StackTrace}```";

                await e.Context.RespondAsync(embed : embed).ConfigureAwait(false);
            }
        }