コード例 #1
0
 private void AddLevelHelper(LevelSubmission submission, int timesToEnter)
 {
     for (int i = 1; i <= timesToEnter; i++)
         AllLevels.Add(submission);
 }
コード例 #2
0
 public void ForceAddLevel(string levelCode,string submitter)
 {
     IrcDotNet.IrcUser tempUser = new IrcDotNet.IrcUser { NickName = submitter };
     LevelSubmission submission = new LevelSubmission(levelCode, tempUser, true);
     _finalLevels.Add(submission);
     if (Remaining == 0)
         displayNextLevel();
 }
コード例 #3
0
        internal void AddLevel(LevelSubmission currentSubmission)
        {
            //If level has already been submitted, then bail
            if (AllLevels.Any(t => t.LevelID == currentSubmission.LevelID))
                return;

            if (currentSubmission.User.IsOperator || currentSubmission.User.IsSubscriber)
                AddLevelHelper(currentSubmission, 5);
            else
                AddLevelHelper(currentSubmission, 1);
        }
コード例 #4
0
ファイル: BotMain.cs プロジェクト: dram55/MarioMakerTwitchBot
        private static void IrcClient_Channel_MessageReceived(object sender, IrcMessageEventArgs e)
        {
            var channel = (IrcChannel)sender;
            if (e.Source is IrcUser)
            {
                IrcUser user = (IrcUser)e.Source;
                string command = e.Text;

                //Twitch notify will let you know if you have a new sub or are hosted.
                if (user.NickName == "twitchnotify")
                {
                    //If you are getting an alert that someone subscribed..
                    //then don't even bother with the API, just update IsSubscriber to true
                    if (command.Contains(" subscribed "))
                    {
                        bool newUser;
                        string userName = command.Split(' ')[0];
                        IrcUser subscribedUser = channel.Client.GetUserFromNickName(userName, true, out newUser);
                        subscribedUser.IsSubscriber = true;

                    }
                    Console.WriteLine("");
                    Console.WriteLine(command);
                    Console.WriteLine("");
                }

                else if (command.StartsWith("!") && command.Length > 1)
                {
                    command = command.Remove(0,1);

                    //SUB and Operator only commands
                    if (user.IsOperator || user.IsSubscriber)
                    {
                        switch (command)
                        {
                            case "bfb": PlaySound("sounds\\bfb.mp3"); break;
                            case "bes": PlaySound("sounds\\bes.mp3"); break;
                            case "speed": PlaySound("sounds\\speed.mp3"); break;
                            case "yeah": PlaySound("sounds\\yeah.mp3"); break;
                            case "dik": PlaySound("sounds\\dik.mp3"); break;
                            case "uptime":
                                Random m = new Random();
                                string hr = m.Next(2, 999).ToString();
                                channel.Client.SendPrivateMessage(MAINCHANNEL,"Uptime: " + hr + " hours.");
                                break;
                            default:
                                break;
                        }
                    }

                    //Any other commands:
                    if (command.StartsWith("submit "))
                    {
                        //People trying to submit when the QUEUE is closed, get warned - to avoid spam.
                        if (!levels.Open)
                        {
                            InvalidSubmission(channel);
                            return;
                        }

                        command = command.Remove(0,6).Trim();

                        try
                        {
                            LevelSubmission currentSubmission = new LevelSubmission(command, user, false);
                            levels.AddLevel(currentSubmission);
                        }
                        catch (ArgumentException)
                        {
                            //Invalid level code or API fuckup
                            //code could go here to alert the user they f'd up.
                        }

                    }
                }
            }
        }