Example #1
0
        public async Task AddWin([Remainder] string args = null)
        {
            var User = Context.User as SocketGuildUser;
            var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Point Manager");

            if (!User.Roles.Contains(role))
            {
                await ReplyAsync("You do not have permission to set the balance of others.");

                return;
            }

            args = UtilSaveFile.MakeUsernameCompatible(args);
            string attempt = UtilSaveFile.AddBalanceByUsername(args, "1", "Unowhiteflags", "Win bal change by " + Context.User.Username, 6);

            if (attempt == "-1")
            {
                await ReplyAsync("Attempt was unsuccessful. Either " + args + " was not found in the database, or the format is wrong." +
                                 "\n\n The proper format is: `p*addgold <User>`. \n\n One is always added by default.");
            }
            else
            {
                await ReplyAsync("Attempt was successful. " + args + " has received 1 general win, making their new total " + attempt);
            }
        }
Example #2
0
        public async Task AddUnoScore([Remainder] string args = null)
        {
            var User = Context.User as SocketGuildUser;
            var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == "Point Manager");

            if (!User.Roles.Contains(role))
            {
                await ReplyAsync("You do not have permission to set the balance of others.");

                return;
            }

            if ((args.Length - 3) < 1)
            {
                Console.WriteLine(args);
                await ReplyAsync("At line 98: " + improperFormatSetBal);

                return;
            }

            string user, amountStr;
            int    division = -1;

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] == ' ')
                {
                    division = i;
                }
            }

            if (division == -1)
            {
                await ReplyAsync("At line 110: " + improperFormatSetBal);

                return;
            }
            user      = args.Substring(0, division);
            amountStr = args.Substring(division + 1, args.Length - (division + 1));

            if (!Int32.TryParse(amountStr, out int ignore))
            {
                await ReplyAsync("At line 117: " + improperFormatSetBal);

                return;
            }

            string attempt = "-1";

            attempt = UtilSaveFile.AddBalanceByUsername(user, amountStr, "Unopoints", Context.User.Username, 6);

            if (attempt == "-1")
            {
                await ReplyAsync("Error: Either " + user + " was not found, or the amount was incorrect. Changes were not performed.");

                return;
            }
            else
            {
                if (user != "all")
                {
                    await ReplyAsync(user + "'s Uno Score was successfully changed to " + attempt);
                }
                else
                {
                    await ReplyAsync("Everyone's Uno Score has been set to " + amountStr);
                }
            }
            return;
        }