예제 #1
0
        private void HandleOnMessage(string channel, string msg)
        {
            logEvent(string.Format("Received '{0}' from pubsub", msg, channel));

            if (msg.Contains("\"type\":\"cheer\""))
            {
                CheerVO cheer = JsonConvert.DeserializeObject <CheerVO>(msg);
                HandleAction(cheer);
            }
            else if (msg.Contains("\"type\":\"command\""))
            {
                CommandVO commandVO = JsonConvert.DeserializeObject <CommandVO>(msg);
                HandleAction(commandVO);
            }
            else if (msg.Contains("\"type\":\"sub\""))
            {
                SubVO subVO = JsonConvert.DeserializeObject <SubVO>(msg);
                HandleAction(subVO);
            }
            else if (msg.Contains("\"type\":\"raid\""))
            {
                RaidVO raidVO = JsonConvert.DeserializeObject <RaidVO>(msg);
                HandleAction(raidVO);
            }
            else
            {
                // wtf
            }
        }
예제 #2
0
 private void HandleSetLightsCommand(CommandVO commandVO)
 {
     if (commandVO.message.Contains("!setlights"))
     {
         if (Properties.Settings.Default.channel == commandVO.nick)
         {
             foreach (Match match in Regex.Matches(commandVO.message, @"#([0-9a-fA-F]{6})"))
             {
                 if (!string.IsNullOrEmpty(match.Value))
                 {
                     SetHexColor(match.Value);
                 }
             }
         }
         else if (commandVO.mod)
         {
             if (Properties.Settings.Default.setlightsMods)
             {
                 foreach (Match match in Regex.Matches(commandVO.message, @"#([0-9a-fA-F]{6})"))
                 {
                     if (!string.IsNullOrEmpty(match.Value))
                     {
                         SetHexColor(match.Value);
                     }
                 }
             }
         }
         else if (commandVO.sub)
         {
             if (Properties.Settings.Default.setlightsSubs)
             {
                 foreach (Match match in Regex.Matches(commandVO.message, @"#([0-9a-fA-F]{6})"))
                 {
                     if (!string.IsNullOrEmpty(match.Value))
                     {
                         SetHexColor(match.Value);
                     }
                 }
             }
         }
     }
 }
예제 #3
0
 private void HandleColorLoop(CommandVO commandVO)
 {
     if (commandVO.message.Contains("!colorloop"))
     {
         if (Properties.Settings.Default.channel == commandVO.nick)
         {
             DoColorLoop();
         }
         else if (commandVO.mod)
         {
             if (Properties.Settings.Default.colorloopMods)
             {
                 DoColorLoop();
             }
         }
         else if (commandVO.sub)
         {
             if (Properties.Settings.Default.colorloopSubs)
             {
                 DoColorLoop();
             }
         }
     }
 }
예제 #4
0
 private void HandleAction(CommandVO commandVO)
 {
     HandleSetLightsCommand(commandVO);
     HandleColorLoop(commandVO);
 }