/// <summary> Checks the command result if failed and behaves accordingly.</summary>
        /// <param name="result"></param>
        public async Task FailedCommandResult(Optional <CommandInfo> command, ICommandContext context, IResult result)
        {
            LogMessage(context, result);
            Console.WriteLine("Successfully logged failed command.");

            if (result.ErrorReason.StartsWith("You can use this command in"))
            {
                await _customEmbed.CreateAndPostEmbed((SocketCommandContext)context, "CommandOnCooldown");
            }

            else if (result.ErrorReason.StartsWith("You do not have the required permission"))
            {
                await _customEmbed.CreateAndPostEmbed((SocketCommandContext)context, "NoBotOwner");
            }

            else if (result.ErrorReason == "This command may only be invoked in an NSFW channel.")
            {
                await _customEmbed.CreateAndPostEmbed((SocketCommandContext)context, "RequireNSFW");
            }

            else
            {
                await _customEmbed.CreateAndPostEmbed((SocketCommandContext)context, "UncalculatedError");
            }
        }
        public async Task CommandExecutedAsync(Optional <CommandInfo> command, ICommandContext context, IResult result)
        {
            var guildID      = context.Guild.Id;
            var guildAccount = _guildAccount.GetSettingsAccount(guildID);

            if (!command.IsSpecified)
            {
                if (guildAccount.NoCommandFoundResponseIsDisabled)
                {
                    return;
                }

                await _customEmbed.CreateAndPostEmbed((SocketCommandContext)context, "NoCommandFound");

                return;
            }

            if (result.IsSuccess)
            {
                _commandSucceeded.SucceededCommandResult(command, context, result);
                Console.WriteLine($"Command executed: {context.User.Username} used {command.Value.Name}");
                return;
            }
            else
            {
                await _commandFailed.FailedCommandResult(command, context, result);
            }
            await context.Channel.SendMessageAsync($"There was an 'uncalculated' error executing the command: {result}\nContact svr333#3451 / <@202095042372829184> for more information.");
        }
Beispiel #3
0
 public async Task TestAndStuff() =>
 await _customEmbedService.CreateAndPostEmbed(Context, "test");
Beispiel #4
0
 public async Task Butt() =>
 await _customEmbedService.CreateAndPostEmbed(Context, "butt");