Beispiel #1
0
        public void Kill(WinterBot bot, TwitchUser user, string cmd, string value)
        {
            bot.WriteDiagnostic(DiagnosticFacility.Info, "Bot killed by streamer.");
            WinterBotSource.Log.Kill();

            bot.Shutdown();
        }
Beispiel #2
0
        public void Kill(WinterBot bot, TwitchUser user, string cmd, string value)
        {
            bot.WriteDiagnostic(DiagnosticFacility.Info, "Bot killed by streamer.");
            WinterBotSource.Log.Kill();

            bot.Shutdown();
        }
Beispiel #3
0
        private void SetRegular(WinterBot sender, string cmd, string value, bool regular)
        {
            value = value.Trim();
            if (!TwitchUsers.IsValidUserName(value))
            {
                sender.WriteDiagnostic(DiagnosticFacility.UserError, "{0}: Invalid username '{1}.", cmd, value);
                return;
            }

            TwitchUser target = sender.Users.GetUser(value);
            target.IsRegular = regular;
            sender.SendResponse(Importance.Med, "{0} {1} the regular list.", target.Name, regular ? "added to " : "removed from");
        }
Beispiel #4
0
        private void SetRegular(WinterBot sender, string cmd, string value, bool regular)
        {
            value = value.Trim();
            if (!TwitchUsers.IsValidUserName(value))
            {
                sender.WriteDiagnostic(DiagnosticFacility.UserError, "{0}: Invalid username '{1}.", cmd, value);
                return;
            }

            TwitchUser target = sender.Users.GetUser(value);

            target.IsRegular = regular;
            sender.SendResponse(Importance.Med, "{0} {1} the regular list.", target.Name, regular ? "added to " : "removed from");
        }
Beispiel #5
0
 public WordMatch(WinterBot bot, string str)
 {
     m_str = str.ToLower();
     if (str.IsRegex())
     {
         try
         {
             m_reg = new Regex(str, RegexOptions.IgnoreCase);
         }
         catch (ArgumentException)
         {
             bot.WriteDiagnostic(DiagnosticFacility.UserError, "Invalid regex in options: " + str);
         }
     }
 }
Beispiel #6
0
        public UrlMatch(WinterBot bot, string str)
        {
            if (str.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase))
            {
                str = str.Substring(7);
            }

            m_str = str.ToLower();
            if (str.IsRegex())
            {
                try
                {
                    m_reg = new Regex(str, RegexOptions.IgnoreCase);
                }
                catch (ArgumentException)
                {
                    bot.WriteDiagnostic(DiagnosticFacility.UserError, "Invalid regex in options: " + str);
                }
            }
        }
Beispiel #7
0
        private static bool ChangeMode(WinterBot sender, TwitchUser user, string value, string type, bool curr)
        {
            bool result = curr;

            value = value.Trim();
            if (string.IsNullOrWhiteSpace(value))
            {
                sender.SendResponse(Importance.Med, "{0} protect is currently {1}.", type, curr ? "enabled" : "disabled");
            }
            else if (value.ParseBool(ref result))
            {
                if (curr != result)
                {
                    string enableStr = result ? "enabled" : "disabled";
                    sender.SendResponse(Importance.Med, "{0} protect is now {1}.", type, enableStr);
                    sender.WriteDiagnostic(DiagnosticFacility.ModeChange, "{0} changed {1} mode to {2}.", user.Name, type, enableStr);
                }
            }
            return(result);
        }
Beispiel #8
0
        private void SetRegular(WinterBot sender, string cmd, string value, bool regular)
        {
            value = value.Trim().ToLower();
            if (!TwitchUsers.IsValidUserName(value))
            {
                sender.WriteDiagnostic(DiagnosticFacility.UserError, "{0}: Invalid username '{1}.", cmd, value);
                return;
            }

            TwitchUser target = sender.Users.GetUser(value);
            if (regular)
            {
                sender.AddRegular(target);
                sender.SendResponse("{0} added to regular list.", value);
            }
            else
            {
                sender.RemoveRegular(target);
                sender.SendResponse("{0} removed from regular list.", value);
            }
        }
 public WordMatch(WinterBot bot, string str)
 {
     m_str = str.ToLower();
     if (str.IsRegex())
     {
         try
         {
             m_reg = new Regex(str, RegexOptions.IgnoreCase);
         }
         catch (ArgumentException)
         {
             bot.WriteDiagnostic(DiagnosticFacility.UserError, "Invalid regex in options: " + str);
         }
     }
 }
        public UrlMatch(WinterBot bot, string str)
        {
            if (str.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase))
                str = str.Substring(7);

            m_str = str.ToLower();
            if (str.IsRegex())
            {
                try
                {
                    m_reg = new Regex(str, RegexOptions.IgnoreCase);
                }
                catch (ArgumentException)
                {
                    bot.WriteDiagnostic(DiagnosticFacility.UserError, "Invalid regex in options: " + str);
                }
            }
        }
        private static bool ChangeMode(WinterBot sender, TwitchUser user, string value, string type, bool curr)
        {
            bool result = curr;

            value = value.Trim();
            if (string.IsNullOrWhiteSpace(value))
            {
                sender.SendResponse(Importance.Med, "{0} protect is currently {1}.", type, curr ? "enabled" : "disabled");
            }
            else if (value.ParseBool(ref result))
            {
                if (curr != result)
                {
                    string enableStr = result ? "enabled" : "disabled";
                    sender.SendResponse(Importance.Med, "{0} protect is now {1}.", type, enableStr);
                    sender.WriteDiagnostic(DiagnosticFacility.ModeChange, "{0} changed {1} mode to {2}.", user.Name, type, enableStr);
                }
            }
            return result;
        }