Exemple #1
0
 public void OnUserCommand(User user, string command, List <string> args)
 {
     if (command == "skip" && user.CanCheat)
     {
         Timer.Skip();
     }
 }
        public void OnUserCommand(User user, string command, List <string> args)
        {
            if (command == "donate" && args.Parse(out int amount))
            {
                Vote(user, amount);
            }

            if (command == "skip" && user.CanCheat)
            {
                Timer.Skip();
            }
        }
        public void OnUserCommand(User user, string command, List <string> args)
        {
            if (command == "pay")
            {
                if (args.Count != 2)
                {
                    return;
                }

                var arg1 = args[0];
                var arg2 = args[1];

                if (Progress.ContainsKey(arg1) && int.TryParse(arg2, out var amount2))
                {
                    Pay(user, arg1, amount2);
                }

                // Different arg combination
                if (Progress.ContainsKey(arg2) && int.TryParse(arg1, out var amount1))
                {
                    Pay(user, arg2, amount1);
                }
            }

            if (command == "work" && args.Parse(out int optionIndex))
            {
                // Work voting by option number !work 3
                if (optionIndex >= 1 && optionIndex <= Progress.Count)
                {
                    Work(user, Progress.Keys.ToList()[optionIndex - 1]);
                }
            }

            if (command == "work" && args.Parse(out string optionKey))
            {
                // Work voting by option key !work backend
                Work(user, optionKey);
            }

            if (command == "skip" && user.CanCheat)
            {
                Timer.Skip();
            }

            if (Progress.ContainsKey(command))
            {
                // User simply types "!backend"
                Work(user, command);
            }
        }
        public void OnUserCommand(User user, string command, List <string> args)
        {
            // Todo handle votes
            if (command == "vote" && args.Parse(out int number))
            {
                if (number >= 1 && number <= Options.Count)
                {
                    var option = Results.Keys.ToList()[number - 1];
                    Vote(user, option);
                }
            }

            if (command == "skip" && user.CanCheat)
            {
                Timer.Skip();
            }
        }