Exemplo n.º 1
0
        public async Task emailCmd(string recipient, [Remainder] string emailcontents)
        {
            string sentBy = Context.User.ToString();

            //check Cooldown
            if (!RexTimers.canRunCmd(sentBy, "email"))
            {
                await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(sentBy, "email") + "`");

                return;
            }

            if (AliasUtils.getAliasKey(recipient).Contains("None"))
            {
                await Context.Channel.SendMessageAsync("Invalid user!");
            }
            recipient = DataUtils.aliases[AliasUtils.getAliasKey(recipient)];

            DataUtils.sendEmail(sentBy, recipient, emailcontents);

            var messages = await Context.Channel.GetMessagesAsync(((int)1)).Flatten();

            await Context.Channel.DeleteMessagesAsync(messages);

            await Context.Channel.SendMessageAsync("`" + sentBy + " successfully sent an email to " + recipient + "`");

            RexTimers.resetTimer(sentBy, "email");
        }
Exemplo n.º 2
0
        public async Task reportCmd([Remainder] string name)
        {
            string username = Context.User.ToString();

            if (RexTimers.canRunCmd(username, "report") || MasterUtils.ContainsAny(username, GlobalVars.ADMINS))
            {
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("You're trying to report an unregistered user!");
                }
                else
                {
                    name = DataUtils.aliases[AliasUtils.getAliasKey(name)];

                    DataUtils.incReports(name);

                    await Context.Channel.SendMessageAsync("Report successful");

                    RexTimers.resetTimer(username, "report");
                }
            }
            else
            {
                await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "report") + "`");
            }
        }
Exemplo n.º 3
0
        public async Task forgiveCmd([Remainder] string name)
        {
            string username = Context.User.ToString();

            if (RexTimers.canRunCmd(username, "forgive") || MasterUtils.ContainsAny(username, GlobalVars.ADMINS))
            {
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("You're trying to forgive an unregistered user!");
                }
                else
                {
                    name = DataUtils.aliases[AliasUtils.getAliasKey(name)];

                    if (name == username)
                    {
                        await Context.Channel.SendMessageAsync("Are you seriously trying to forgive yourself bruh?");

                        RexTimers.resetTimer(username, "forgive");
                        return;
                    }

                    if (DataUtils.reports.ContainsKey(name))
                    {
                        if (DataUtils.reports[name] <= 0)
                        {
                            await Context.Channel.SendMessageAsync("You can't forgive someone with 0 or less reports");
                        }
                        else
                        {
                            DataUtils.gainReports(name, -1);
                            await Context.Channel.SendMessageAsync("You successfully forgave this fool");
                        }
                    }
                    else
                    {
                        await Context.Channel.SendMessageAsync("This angel has not been reported yet");
                    }

                    RexTimers.resetTimer(username, "forgive");
                }
            }
            else
            {
                await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "forgive") + "`");
            }
        }
Exemplo n.º 4
0
        public async Task buyCmd([Remainder] string query)
        {
            string username = Context.User.ToString();

            //check Cooldown
            if (!RexTimers.canRunCmd(username, "buy"))
            {
                await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "buy") + "`");

                return;
            }


            // DataUtils.coins[username] = 1000; //test purposes
            //Check query argument count validity
            string[] words = query.Split(' ');

            //this condition will never be met.. as fun;ction will not be called (will call !help !buy)
            if (words.Length < 1)
            {
                await Context.Channel.SendMessageAsync("Specify what you want to buy");

                return;
            }

            int index = DataUtils.shop.FindIndex(f => f.Callname == words[0]);

            if (index < 0)
            {
                await Context.Channel.SendMessageAsync("You entered an invalid item");

                return;
            }

            ShopItem item = DataUtils.shop.ElementAt(index);

            if (item.Argcount != words.Length)
            {
                await Context.Channel.SendMessageAsync("Check your arguments bruh");

                return;
            }

            //Check if we have enough coins to buy item
            int cost = item.Cost;

            if (!DataUtils.canBuy(username, cost))
            {
                await Context.Channel.SendMessageAsync("You dont have enough money you poor thing");

                return;
            }

            //Actually buy the item
            DataUtils.spendCoins(username, cost);
            string name;
            int    dice;


            switch (item.Callname)
            {
            case "report":
                //check if valid user ->
                name = words[1];
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("Invalid user!");
                }
                name = DataUtils.aliases[AliasUtils.getAliasKey(name)];
                dice = DataUtils.rnd.Next(1, 101);

                if (dice < 50)
                {
                    DataUtils.gainReports(name, 77);
                    await Context.Channel.SendMessageAsync(name + "has been reported 77 times LOL!");
                }
                else
                {
                    await Context.Channel.SendMessageAsync("I decided not to report anyone");
                }
                break;

            case "forgive":
                //check if valid user ->
                name = words[1];
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("Invalid user!");
                }
                name = DataUtils.aliases[AliasUtils.getAliasKey(name)];
                dice = DataUtils.rnd.Next(1, 101);
                if (dice < 50)
                {
                    DataUtils.gainReports(name, -77);
                    await Context.Channel.SendMessageAsync(name + "has been forgiven 77 times!");
                }
                else
                {
                    await Context.Channel.SendMessageAsync("I decided not to forgive anyone");
                }
                break;

            case "w":
                await Context.Channel.SendMessageAsync(MasterUtils.getAnnoyingTTSString(), true);

                break;

            case "wchance":
                DataUtils.incWAddChances(username);
                await Context.Channel.SendMessageAsync("Successfully increased your !w chances by 1%");

                break;

            //case "beg":
            //break;
            case "catmode":
                //length of temp catmode in MasterHandler
                RexTimers.catModeClock.Start();
                break;

            case "restrain":
                name = words[1];
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("Invalid user!");
                }
                name = DataUtils.aliases[AliasUtils.getAliasKey(name)];

                int timeInSeconds = DataUtils.rnd.Next(121, 181);
                AdminUtils.addRestriction(name, timeInSeconds);
                await Context.Channel.SendMessageAsync(name + " is restrained for " + timeInSeconds + "s!");

                break;

            case "purge":
                if (int.Parse(words[1]) > 30)
                {
                    await Context.Channel.SendMessageAsync("You tried to purge too many messages! What a waste of coins...");
                }
                var messages = await Context.Channel.GetMessagesAsync((int.Parse(words[1]) + 1)).Flatten();

                await Context.Channel.DeleteMessagesAsync(messages);

                break;

            case "tts":
                name = words[1];
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("Invalid user! What a waste of coins...");
                }
                name = DataUtils.aliases[AliasUtils.getAliasKey(name)];
                RexTimers.addPersonToTTS(name);
                await Context.Channel.SendMessageAsync("```" + username + " decided to tts-annoy " + name + "!\n" + name + " better start sending messages for the next 3 minutes or i'm going to take all of your coins!```");

                break;

            case "annoy":
                name = words[1];
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("Invalid user! What a waste of coins...");
                }
                name = DataUtils.aliases[AliasUtils.getAliasKey(name)];
                RexTimers.addPersonToAnnoy(name);
                await Context.Channel.SendMessageAsync("```" + username + " decided to super annoy " + name + "!\n" + name + " better start sending messages for the next 3 minutes or i'm going to take all of your coins!```");

                break;

            case "confuse":
                name = words[1];
                if (AliasUtils.getAliasKey(name).Contains("None"))
                {
                    await Context.Channel.SendMessageAsync("Invalid user! What a waste of coins...");
                }
                name = DataUtils.aliases[AliasUtils.getAliasKey(name)];
                RexTimers.addPersonToConfuse(name);
                await Context.Channel.SendMessageAsync("```" + username + " decided to confuse " + name + "!\n" + name + " better start sending messages for the next 3 minutes or i'm going to take all of your coins!```");

                break;

            case "bribe":
                await Context.Channel.SendMessageAsync("This function is not implemented yet! What a waste of coins...");

                break;

            default: await Context.Channel.SendMessageAsync("Item not added to switch statement"); break;
            }

            //show coins spent and coins remaining
            await Context.Channel.SendMessageAsync("`" + username + " paid " + cost + "coins and has " + DataUtils.getCoinCount(username) + " left!`");

            RexTimers.resetTimer(username, "buy");
            //Check if valid argument types..? -> Just force convert..
            //await Context.Channel.SendMessageAsync("Your requested item is at index :" + index + " which costs " + DataUtils.shop.ElementAt(index).Cost);
        }