示例#1
0
        public async Task SetExp(EventContext e)
        {
            ArgObject arg = e.Arguments.FirstOrDefault();

            IDiscordUser user = await arg.GetUserAsync(e.Guild);

            arg = arg.Next();

            int amount = arg?.AsInt() ?? 0;

            using (var context = new MikiContext())
            {
                LocalExperience u = await LocalExperience.GetAsync(context, e.Guild.Id.ToDbLong(), user);

                if (u == null)
                {
                    return;
                }
                u.Experience = amount;
                await context.SaveChangesAsync();

                await Global.RedisClient.UpsertAsync($"user:{e.Guild.Id}:{e.Author.Id}:exp", u.Experience);

                e.Channel.QueueMessageAsync(":ok_hand:");
            }
        }
示例#2
0
        public async Task DeclineMarriageAsync(EventContext e)
        {
            using (MikiContext context = new MikiContext())
            {
                MarriageRepository repository = new MarriageRepository(context);

                ArgObject selection   = e.Arguments.FirstOrDefault();
                int?      selectionId = null;

                if (selection != null)
                {
                    selectionId = selection.AsInt();
                }

                var marriages = await repository.GetProposalsReceived(e.Author.Id.ToDbLong());

                if (marriages.Count == 0)
                {
                    throw BotException.CreateCustom("error_proposals_empty");
                }

                marriages = marriages.OrderByDescending(x => x.Marriage.TimeOfMarriage).ToList();

                if (selectionId != null)
                {
                    var    m         = marriages[selectionId.Value - 1];
                    string otherName = (await Global.Client.Client.GetUserAsync(m.GetOther(e.Author.Id.ToDbLong()).FromDbLong())).Username;

                    new EmbedBuilder()
                    {
                        Title       = $"🔫 You shot down {otherName}!",
                        Description = $"Aww, don't worry {otherName}. There is plenty of fish in the sea!",
                        Color       = new Color(191, 105, 82)
                    }.ToEmbed().QueueToChannel(e.Channel);

                    m.Remove(context);
                    await context.SaveChangesAsync();
                }
                else
                {
                    var embed = new EmbedBuilder()
                    {
                        Title  = "💍 Proposals",
                        Footer = new EmbedFooter()
                        {
                            Text = $"Use {await e.Prefix.GetForGuildAsync(Global.RedisClient, e.Guild.Id)}declinemarriage <number> to decline",
                        },
                        Color = new Color(154, 170, 180)
                    };

                    await BuildMarriageEmbedAsync(embed, e.Author.Id.ToDbLong(), context, marriages);

                    embed.ToEmbed().QueueToChannel(e.Channel);
                }
            }
        }
示例#3
0
        public async Task DivorceAsync(EventContext e)
        {
            using (MikiContext context = new MikiContext())
            {
                MarriageRepository repository = new MarriageRepository(context);

                ArgObject selection   = e.Arguments.FirstOrDefault();
                int?      selectionId = null;

                if (selection != null)
                {
                    selectionId = selection.AsInt();
                }

                var marriages = await repository.GetMarriagesAsync((long)e.Author.Id);

                if (marriages.Count == 0)
                {
                    throw BotException.CreateCustom("error_proposals_empty");
                }

                marriages = marriages.OrderByDescending(x => x.Marriage.TimeOfMarriage).ToList();

                if (selectionId != null)
                {
                    var m         = marriages[selectionId.Value - 1];
                    var otherUser = await Global.Client.Client.GetUserAsync(m.GetOther(e.Author.Id.ToDbLong()).FromDbLong());

                    EmbedBuilder embed = Utils.Embed;
                    embed.Title       = $"🔔 {e.Locale.GetString("miki_module_accounts_divorce_header")}";
                    embed.Description = e.Locale.GetString("miki_module_accounts_divorce_content", e.Author.Username, otherUser.Username);
                    embed.Color       = new Color(0.6f, 0.4f, 0.1f);
                    embed.ToEmbed().QueueToChannel(e.Channel);

                    m.Remove(context);
                    await context.SaveChangesAsync();
                }
                else
                {
                    var embed = new EmbedBuilder()
                    {
                        Title  = "💍 Marriages",
                        Footer = new EmbedFooter()
                        {
                            Text = $"Use {await e.Prefix.GetForGuildAsync(Global.RedisClient, e.Guild.Id)}divorce <number> to decline",
                        },
                        Color = new Color(154, 170, 180)
                    };

                    await BuildMarriageEmbedAsync(embed, e.Author.Id.ToDbLong(), context, marriages);

                    embed.ToEmbed().QueueToChannel(e.Channel);
                }
            }
        }
示例#4
0
        public async Task SearchPasta(EventContext e)
        {
            ArgObject arg = e.Arguments.FirstOrDefault();

            if (arg == null)
            {
                e.ErrorEmbed(e.GetResource("searchpasta_error_no_arg"))
                .Build().QueueToChannel(e.Channel);
                return;
            }

            string query = arg.Argument;

            arg = arg.Next();

            int page = (arg?.AsInt() ?? 0);

            using (var context = new MikiContext())
            {
                var pastasFound = await context.Pastas.Where(x => x.Id.ToLower().Contains(query.ToLower()))
                                  .OrderByDescending(x => x.Id)
                                  .Skip(25 * page)
                                  .Take(25)
                                  .ToListAsync();


                var totalCount = await context.Pastas.Where(x => x.Id.Contains(query))
                                 .CountAsync();

                if (pastasFound?.Count > 0)
                {
                    string resultString = "";

                    pastasFound.ForEach(x => { resultString += "`" + x.Id + "` "; });

                    EmbedBuilder embed = Utils.Embed;
                    embed.Title       = e.GetResource("miki_module_pasta_search_header");
                    embed.Description = resultString;

                    embed.WithFooter(e.GetResource("page_index", page + 1, (Math.Ceiling((double)totalCount / 25)).ToString()));

                    embed.Build().QueueToChannel(e.Channel);
                    return;
                }

                e.ErrorEmbed(e.GetResource("miki_module_pasta_search_error_no_results", query))
                .Build().QueueToChannel(e.Channel);
            }
        }
示例#5
0
        public override async Task SelectAsync()
        {
            Args a = await MenuInstance.ListenMessageAsync();

            ArgObject arg = a.FirstOrDefault();

            if (arg != null)
            {
                int?pageId = arg.AsInt();
                if (pageId != null)
                {
                    pageId = Math.Clamp(pageId.Value, 1, Children.Count + 1);
                    await(MenuInstance.Message as IUserMessage).ModifyAsync(x =>
                    {
                        x.Embed = Children[pageId.Value - 1].Build();
                    });
                    await Children[pageId.Value - 1].SelectAsync();
                }
            }
        }
示例#6
0
        public async Task GetCharacterAsync(EventContext e)
        {
            ICharacter character = null;

            ArgObject arg = e.Arguments.Join();

            int?characterId = arg.AsInt();

            if (characterId != null)
            {
                character = await anilistClient.GetCharacterAsync(characterId.Value);
            }
            else
            {
                character = await anilistClient.GetCharacterAsync(arg.Argument);
            }

            if (character != null)
            {
                string description = character.Description;
                if (description.Length > 1024)
                {
                    description = new string(description.Take(1020).ToArray());
                    description = new string(description.Take(description.LastIndexOf(' ')).ToArray()) + "...";
                }

                Utils.Embed.SetAuthor($"{character.FirstName} {character.LastName}", "https://anilist.co/img/logo_al.png", character.SiteUrl)
                .SetDescription(character.NativeName)
                .AddInlineField("Description", description)
                .SetColor(0, 170, 255)
                .SetThumbnail(character.LargeImageUrl)
                .SetFooter("Powered by anilist.co", "")
                .ToEmbed().QueueToChannel(e.Channel);
            }
            else
            {
                e.ErrorEmbed("Character not found!")
                .ToEmbed().QueueToChannel(e.Channel);
            }
        }
示例#7
0
        public async Task SetMekos(EventContext e)
        {
            ArgObject arg = e.Arguments.FirstOrDefault();

            IDiscordUser user = await arg.GetUserAsync(e.Guild);

            arg = arg.Next();

            int amount = arg?.AsInt() ?? 0;

            using (var context = new MikiContext())
            {
                User u = await context.Users.FindAsync((long)user.Id);

                if (u == null)
                {
                    return;
                }
                u.Currency = amount;
                await context.SaveChangesAsync();

                e.Channel.QueueMessageAsync(":ok_hand:");
            }
        }
示例#8
0
        public async Task GiveMekosAsync(EventContext e)
        {
            if (e.Arguments.Count < 2)
            {
                e.ErrorEmbedResource("give_error_no_arg")
                .ToEmbed().QueueToChannel(e.Channel);
                return;
            }

            ArgObject arg = e.Arguments.FirstOrDefault();

            IDiscordUser user = null;

            if (arg != null)
            {
                user = await arg.GetUserAsync(e.Guild);
            }

            if (user == null)
            {
                e.ErrorEmbedResource("give_error_no_mention")
                .ToEmbed().QueueToChannel(e.Channel);
                return;
            }

            arg = arg.Next();

            int?amount = arg?.AsInt() ?? null;

            if (amount == null)
            {
                e.ErrorEmbedResource("give_error_amount_unparsable")
                .ToEmbed().QueueToChannel(e.Channel);
                return;
            }

            if (amount <= 0)
            {
                e.ErrorEmbedResource("give_error_min_mekos")
                .ToEmbed().QueueToChannel(e.Channel);
                return;
            }

            using (MikiContext context = new MikiContext())
            {
                User sender = await User.GetAsync(context, e.Author);

                User receiver = await User.GetAsync(context, user);

                if (amount.Value <= sender.Currency)
                {
                    await sender.AddCurrencyAsync(-amount.Value, e.Channel, sender);

                    await receiver.AddCurrencyAsync(amount.Value, e.Channel, sender);

                    new EmbedBuilder()
                    {
                        Title       = "🔸 transaction",
                        Description = e.GetResource("give_description", sender.Name, receiver.Name, amount.Value),
                        Color       = new Color(255, 140, 0),
                    }.ToEmbed().QueueToChannel(e.Channel);

                    await context.SaveChangesAsync();
                }
                else
                {
                    e.ErrorEmbedResource("user_error_insufficient_mekos")
                    .ToEmbed().QueueToChannel(e.Channel);
                }
            }
        }
示例#9
0
        public async Task GiveReputationAsync(EventContext e)
        {
            using (var context = new MikiContext())
            {
                User giver = await context.Users.FindAsync(e.Author.Id.ToDbLong());

                var repObject = Global.RedisClient.Get <ReputationObject>($"user:{giver.Id}:rep");

                if (repObject == null)
                {
                    repObject = new ReputationObject()
                    {
                        LastReputationGiven  = DateTime.Now,
                        ReputationPointsLeft = 3
                    };
                    await Global.RedisClient.AddAsync($"user:{giver.Id}:rep", repObject, new DateTimeOffset(DateTime.UtcNow.AddDays(1).Date));
                }

                ArgObject arg = e.Arguments.FirstOrDefault();

                if (arg == null)
                {
                    TimeSpan pointReset = (DateTime.Now.AddDays(1).Date - DateTime.Now);

                    new EmbedBuilder()
                    {
                        Title       = (e.GetResource("miki_module_accounts_rep_header")),
                        Description = (e.GetResource("miki_module_accounts_rep_description"))
                    }.AddInlineField(e.GetResource("miki_module_accounts_rep_total_received"), giver.Reputation.ToString())
                    .AddInlineField(e.GetResource("miki_module_accounts_rep_reset"), pointReset.ToTimeString(e.Channel.Id))
                    .AddInlineField(e.GetResource("miki_module_accounts_rep_remaining"), repObject.ReputationPointsLeft)
                    .ToEmbed().QueueToChannel(e.Channel);
                    return;
                }
                else
                {
                    Dictionary <IDiscordUser, int> usersMentioned = new Dictionary <IDiscordUser, int>();

                    EmbedBuilder embed = new EmbedBuilder();

                    int  totalAmountGiven = 0;
                    bool mentionedSelf    = false;

                    while (true || totalAmountGiven <= repObject.ReputationPointsLeft)
                    {
                        if (arg == null)
                        {
                            break;
                        }

                        IDiscordUser u = await arg.GetUserAsync(e.Guild);

                        int amount = 1;

                        if (u == null)
                        {
                            break;
                        }

                        arg = arg?.Next();

                        if ((arg?.AsInt() ?? -1) != -1)
                        {
                            amount = arg.AsInt().Value;
                            arg    = arg.Next();
                        }
                        else if (Utils.IsAll(arg))
                        {
                            amount = repObject.ReputationPointsLeft;
                            arg    = arg.Next();
                        }

                        if (u.Id == e.Author.Id)
                        {
                            mentionedSelf = true;
                            continue;
                        }

                        totalAmountGiven += amount;

                        if (usersMentioned.Keys.Where(x => x.Id == u.Id).Count() > 0)
                        {
                            usersMentioned[usersMentioned.Keys.Where(x => x.Id == u.Id).First()] += amount;
                        }
                        else
                        {
                            usersMentioned.Add(u, amount);
                        }
                    }

                    if (mentionedSelf)
                    {
                        embed.Footer = new EmbedFooter()
                        {
                            Text = e.GetResource("warning_mention_self"),
                        };
                    }

                    if (usersMentioned.Count == 0)
                    {
                        return;
                    }
                    else
                    {
                        if (totalAmountGiven <= 0)
                        {
                            e.ErrorEmbedResource("miki_module_accounts_rep_error_zero")
                            .ToEmbed().QueueToChannel(e.Channel);
                            return;
                        }

                        if (usersMentioned.Sum(x => x.Value) > repObject.ReputationPointsLeft)
                        {
                            e.ErrorEmbedResource("error_rep_limit", usersMentioned.Count, usersMentioned.Sum(x => x.Value), repObject.ReputationPointsLeft)
                            .ToEmbed().QueueToChannel(e.Channel);
                            return;
                        }
                    }

                    embed.Title       = (e.GetResource("miki_module_accounts_rep_header"));
                    embed.Description = (e.GetResource("rep_success"));

                    foreach (var user in usersMentioned)
                    {
                        User receiver = await User.GetAsync(context, user.Key);

                        receiver.Reputation += user.Value;

                        embed.AddInlineField(receiver.Name, string.Format("{0} => {1} (+{2})", receiver.Reputation - user.Value, receiver.Reputation, user.Value));
                    }

                    repObject.ReputationPointsLeft -= (short)(usersMentioned.Sum(x => x.Value));

                    await Global.RedisClient.AddAsync($"user:{giver.Id}:rep", repObject, new DateTimeOffset(DateTime.UtcNow.AddDays(1).Date));

                    embed.AddInlineField(e.GetResource("miki_module_accounts_rep_points_left"), repObject.ReputationPointsLeft)
                    .ToEmbed().QueueToChannel(e.Channel);

                    await context.SaveChangesAsync();
                }
            }
        }
示例#10
0
        public async Task LeaderboardsAsync(EventContext e)
        {
            LeaderboardsOptions options = new LeaderboardsOptions();

            ArgObject argument = e.Arguments.FirstOrDefault();

            switch (argument?.Argument.ToLower() ?? "")
            {
            case "commands":
            case "cmds":
            {
                options.type = LeaderboardsType.COMMANDS;
                argument     = argument?.Next();
            }
            break;

            case "currency":
            case "mekos":
            case "money":
            case "bal":
            {
                options.type = LeaderboardsType.CURRENCY;
                argument     = argument?.Next();
            }
            break;

            case "rep":
            case "reputation":
            {
                options.type = LeaderboardsType.REPUTATION;
                argument     = argument?.Next();
            }
            break;

            case "pasta":
            case "pastas":
            {
                options.type = LeaderboardsType.PASTA;
                argument     = argument?.Next();
            }
            break;

            case "experience":
            case "exp":
            {
                options.type = LeaderboardsType.EXPERIENCE;
                argument     = argument?.Next();
            }
            break;

            case "guild":
            case "guilds":
            {
                options.type = LeaderboardsType.GUILDS;
                argument     = argument?.Next();
            }
            break;


            default:
            {
                options.type = LeaderboardsType.EXPERIENCE;
            }
            break;
            }

            if (argument?.Argument.ToLower() == "local")
            {
                if (options.type != LeaderboardsType.PASTA)
                {
                    options.guildId = e.Guild.Id;
                }
                argument = argument.Next();
            }

            if (argument != null)
            {
                IDiscordUser user = await argument.GetUserAsync(e.Guild);

                if (user != null)
                {
                    options.mentionedUserId = user.Id;
                    argument = argument.Next();
                }
            }

            if ((argument?.AsInt() ?? 0) != 0)
            {
                options.pageNumber = argument.AsInt().Value - 1;
                argument           = argument?.Next();
            }

            using (var context = new MikiContext())
            {
                int p = Math.Max(options.pageNumber - 1, 0);

                LeaderboardsObject obj = await Global.MikiApi.GetPagedLeaderboardsAsync(options);

                Utils.RenderLeaderboards(Utils.Embed, obj.items, obj.currentPage * 10)
                .SetFooter(Locale.GetString(e.Channel.Id, "page_index",
                                            obj.currentPage + 1, Math.Ceiling((double)obj.totalItems / 10)), "")
                .SetAuthor(
                    "Leaderboards: " + options.type + " (click me!)",
                    null,
                    Global.MikiApi.BuildLeaderboardsUrl(options)
                    )
                .ToEmbed().QueueToChannel(e.Channel);
            }
        }
示例#11
0
        private async Task GetMediaAsync(EventContext e, bool manga, params MediaFormat[] format)
        {
            IMedia media = null;

            ArgObject arg = e.Arguments.Join();

            int?mediaId = arg.AsInt();

            if (mediaId != null)
            {
                media = await anilistClient.GetMediaAsync(mediaId.Value);
            }
            else
            {
                string filter = "search: $p0, format_not_in: $p1";
                List <GraphQLParameter> parameters = new List <GraphQLParameter>
                {
                    new GraphQLParameter(arg.Argument),
                    new GraphQLParameter(format, "[MediaFormat]")
                };

                if (!e.Channel.IsNsfw)
                {
                    filter += ", isAdult: $p2";
                    parameters.Add(new GraphQLParameter(false, "Boolean"));
                }

                media = await anilistClient.GetMediaAsync(filter, parameters.ToArray());
            }

            if (media != null)
            {
                string description = media.Description;
                if (description.Length > 1024)
                {
                    description = new string(description.Take(1020).ToArray());
                    description = new string(description.Take(description.LastIndexOf(' ')).ToArray()) + "...";
                }

                EmbedBuilder embed = Utils.Embed.SetAuthor(media.DefaultTitle, "https://anilist.co/img/logo_al.png", media.Url)
                                     .SetDescription(media.NativeTitle);

                if (!manga)
                {
                    embed.AddInlineField("Status", media.Status ?? "Unknown")
                    .AddInlineField("Episodes", media.Episodes ?? 0);
                }
                else
                {
                    embed.AddInlineField("Volumes", media.Volumes ?? 0)
                    .AddInlineField("Chapters", media.Chapters ?? 0);
                }

                embed.AddInlineField("Rating", $"{media.Score ?? 0}/100")
                .AddInlineField("Genres", string.Join("\n", media.Genres) ?? "None")
                .AddInlineField("Description", description ?? "None")
                .SetColor(0, 170, 255)
                .SetThumbnail(media.CoverImage)
                .SetFooter("Powered by anilist.co", "")
                .ToEmbed().QueueToChannel(e.Channel);
            }
            else
            {
                e.ErrorEmbed("Anime not found!")
                .ToEmbed().QueueToChannel(e.Channel);
            }
        }
示例#12
0
        public async Task FavouritePastaList(EventContext e, bool lovedPastas = true)
        {
            IUser targetUser   = e.Author;
            float totalPerPage = 25f;
            int   page         = 0;

            ArgObject arg = e.Arguments.FirstOrDefault();

            if (arg == null)
            {
                // TODO: error no user found
                return;
            }

            IUser user = await arg.GetUserAsync(e.Guild);

            if (user != null)
            {
                arg = arg.Next();
            }
            else
            {
                user = e.Author;
            }

            page = arg.AsInt() ?? 0;

            using (MikiContext context = new MikiContext())
            {
                long authorId = targetUser.Id.ToDbLong();
                IEnumerable <PastaVote> pastaVotes = context.Votes.Where(x => x.UserId == authorId && x.PositiveVote == lovedPastas);

                int maxPage = (int)Math.Floor(pastaVotes.Count() / totalPerPage);
                page = page > maxPage ? maxPage : page;
                page = page < 0 ? 0 : page;


                if (pastaVotes.Count() <= 0)
                {
                    string loveString  = (lovedPastas ? e.GetResource("miki_module_pasta_loved") : e.GetResource("miki_module_pasta_hated"));
                    string errorString = e.GetResource("miki_module_pasta_favlist_self_none", loveString);
                    if (e.message.MentionedUserIds.Count() >= 1)
                    {
                        errorString = e.GetResource("miki_module_pasta_favlist_mention_none", loveString);
                    }
                    Utils.ErrorEmbed(e, errorString).Build().QueueToChannel(e.Channel);
                    return;
                }

                EmbedBuilder     embed        = Utils.Embed;
                List <PastaVote> neededPastas = pastaVotes.Skip((int)totalPerPage * page).Take((int)totalPerPage).ToList();

                string resultString = string.Join(" ", neededPastas.Select(x => $"`{x.Id}`"));

                string useName = string.IsNullOrEmpty(targetUser.Username) ? targetUser.Username : targetUser.Username;
                embed.WithTitle($"{(lovedPastas ? e.GetResource("miki_module_pasta_loved_header") : e.GetResource("miki_module_pasta_hated_header"))} - {useName}");
                embed.WithDescription(resultString);
                embed.WithFooter(e.GetResource("page_index", page + 1, Math.Ceiling(pastaVotes.Count() / totalPerPage)), "");

                embed.Build().QueueToChannel(e.Channel);
            }
        }
示例#13
0
        public async Task LotteryAsync(EventContext e)
        {
            ArgObject arg = e.Arguments.FirstOrDefault();

            if (arg == null)
            {
                long totalTickets = await(Global.RedisClient as StackExchangeCacheClient).Client.GetDatabase(0).ListLengthAsync(lotteryKey);
                long yourTickets  = 0;

                string latestWinner = (Global.RedisClient as StackExchangeCacheClient).Client.GetDatabase(0).StringGet("lottery:winner");

                if (await lotteryDict.ContainsAsync(e.Author.Id))
                {
                    yourTickets = long.Parse(await lotteryDict.GetAsync(e.Author.Id));
                }

                string timeLeft = taskScheduler?.GetInstance(0, lotteryId).TimeLeft.ToTimeString(e.Channel.Id, true) ?? "1h?m?s - will be fixed soon!";

                new EmbedBuilder()
                {
                    Title       = "🍀 Lottery",
                    Description = "Make the biggest gamble, and get paid off massively if legit.",
                    Color       = new Color(119, 178, 85)
                }.AddInlineField("Tickets Owned", yourTickets)
                .AddInlineField("Drawing In", timeLeft)
                .AddInlineField("Total Tickets", totalTickets)
                .AddInlineField("Ticket price", $"{100} mekos")
                .AddInlineField("Latest Winner", latestWinner ?? "no name")
                .AddInlineField("How to buy?", ">lottery buy [amount]")
                .ToEmbed().QueueToChannel(e.Channel);
                return;
            }

            switch (arg.Argument.ToLower())
            {
            case "buy":
            {
                arg = arg.Next();
                int amount = arg?.AsInt() ?? 1;

                if (amount < 1)
                {
                    amount = 1;
                }

                using (var context = new MikiContext())
                {
                    User u = await User.GetAsync(context, e.Author);

                    if (amount * 100 > u.Currency)
                    {
                        e.ErrorEmbedResource("miki_mekos_insufficient")
                        .ToEmbed().QueueToChannel(e.Channel);
                        return;
                    }

                    await u.AddCurrencyAsync(-amount * 100, e.Channel);

                    RedisValue[] tickets = new RedisValue[amount];

                    for (int i = 0; i < amount; i++)
                    {
                        tickets[i] = e.Author.Id.ToString();
                    }

                    await(Global.RedisClient as StackExchangeCacheClient).Client.GetDatabase(0).ListRightPushAsync(lotteryKey, tickets);

                    int totalTickets = 0;

                    if (await lotteryDict.ContainsAsync(e.Author.Id.ToString()))
                    {
                        totalTickets = int.Parse(await lotteryDict.GetAsync(e.Author.Id.ToString()));
                    }

                    await lotteryDict.AddAsync(e.Author.Id, amount + totalTickets);

                    await context.SaveChangesAsync();

                    Utils.SuccessEmbed(e.Channel.Id, $"Successfully bought {amount} tickets!")
                    .QueueToChannel(e.Channel);
                }
            }
            break;
            }
        }
示例#14
0
        public async Task LeaderboardsAsync(EventContext e)
        {
            LeaderboardsOptions options = new LeaderboardsOptions();

            Args      args     = new Args(e.arguments);
            ArgObject argument = args.Get(0);

            switch (argument?.Argument.ToLower() ?? "")
            {
            case "commands":
            case "cmds":
            {
                options.type = LeaderboardsType.COMMANDS;
                argument     = argument?.Next();
            }
            break;

            case "currency":
            case "mekos":
            case "money":
            case "bal":
            {
                options.type = LeaderboardsType.CURRENCY;
                argument     = argument?.Next();
            }
            break;

            case "rep":
            case "reputation":
            {
                options.type = LeaderboardsType.REPUTATION;
                argument     = argument?.Next();
            }
            break;

            case "pasta":
            case "pastas":
            {
                options.type = LeaderboardsType.PASTA;
                argument     = argument?.Next();
            }
            break;

            case "experience":
            case "exp":
            {
                options.type = LeaderboardsType.EXPERIENCE;
                argument     = argument?.Next();
            }
            break;

            default:
            {
                options.type = LeaderboardsType.EXPERIENCE;
            }
            break;
            }

            if (argument?.Argument.ToLower() == "local")
            {
                if (options.type != LeaderboardsType.PASTA)
                {
                    options.guildId = e.Guild.Id;
                }
                argument = argument.Next();
            }

            // Null-conditional operators do not apply on async methods.
            if (argument != null)
            {
                IDiscordUser user = (await argument.GetUserAsync(e.Guild));
                if (user != null)
                {
                    options.mentionedUserId = user.Id;
                    argument = argument.Next();
                }
            }

            if ((argument?.AsInt(0) ?? 0) != 0)
            {
                options.pageNumber = argument.AsInt();
                argument           = argument?.Next();
            }

            await ShowLeaderboardsAsync(e.message, options);
        }