private async Task CreateGuildsAsync()
 {
     var guild = new AppGuild(_guidGenerator.Create(), "someone foo")
     {
         Compacity = 200,
         Desc      = "guild tester created"
     };
     await _guilds.InsertAsync(guild, true);
 }
        private async Task HandleResultAsync(IResult result, CommandContextWithPrefix context, AppGuild guild, bool clientPrefix)
        {
            switch (result.Error)
            {
            case CommandError.UnmetPrecondition:
                await context.Channel.SendMessageAsync("You don't have the required permissions to use this command");

                return;

            case CommandError.UnknownCommand:
                if (await HandleCustomCommandAsync(context, guild, clientPrefix))
                {
                    return;
                }
                await context.Channel.SendMessageAsync($"Unknown command, for list of commands try using {context.Prefix}help");

                return;

            case CommandError.ParseFailed:
            case CommandError.BadArgCount:
                await context.Channel.SendMessageAsync($"Command wasn't used properly, try using {context.Prefix}help {GetCommandFromMessage(context, clientPrefix)}");

                return;

            case CommandError.Unsuccessful:
            case CommandError.Exception:
                await context.Channel.SendMessageAsync($"Command threw an exception, try reporting it using {context.Prefix}report <message>");

                return;

            default:
                await context.Channel.SendMessageAsync(result.ErrorReason);

                return;
            }
        }
        private async Task <bool> HandleCustomCommandAsync(CommandContextWithPrefix context, AppGuild guild, bool clientPrefix)
        {
            if (!guild.CustomCommands.Any())
            {
                return(false);
            }
            var command = guild.CustomCommands.FirstOrDefault(f => f.Command == GetCommandFromMessage(context, clientPrefix));

            if (command == null)
            {
                return(false);
            }
            await context.Channel.SendMessageAsync(command.Message);

            return(true);
        }