public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\S{3,}")))
     {
         twitchBot.SendSuggestionNoted(chatMessage);
     }
 }
Beispiel #2
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+(\s\S+)?")))
     {
         twitchBot.SendFuck(chatMessage);
     }
 }
Beispiel #3
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\S+\s" + Pattern.TimeSplitPattern + @"\s" + Pattern.TimeSplitPattern + @"(\s|$)")))
     {
         twitchBot.SendCreatedNuke(chatMessage, chatMessage.GetLowerSplit()[1], TimeHelper.ConvertStringToSeconds(new() { chatMessage.GetLowerSplit()[2] }), TimeHelper.ConvertStringToMilliseconds(new() { chatMessage.GetLowerSplit()[3] }));
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+")))
     {
         twitchBot.SendLastMessage(chatMessage, chatMessage.GetLowerSplit()[1]);
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s.+")))
     {
         twitchBot.SendCompilerResult(chatMessage);
     }
 }
Beispiel #6
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s#?\w+")))
     {
         if (chatMessage.Username == Resources.Owner)
         {
             twitchBot.JoinChannel(chatMessage.GetLowerSplit()[1]);
         }
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+")))
     {
         twitchBot.Send(chatMessage.Channel, $"{Emoji.PointRight} {chatMessage.GetLowerSplit()[1]}, here you can find a list of commands and the repository: {Resources.GitHubRepoLink}");
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel))))
     {
         twitchBot.Send(chatMessage.Channel, $"{Emoji.PointRight} {chatMessage.Username}, here you can find a list of commands and the repository: {Resources.GitHubRepoLink}");
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+")))
     {
         twitchBot.SendSpotifyCurrentlyPlaying(chatMessage);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel))))
     {
         twitchBot.SendSpotifyCurrentlyPlaying(chatMessage);
     }
 }
Beispiel #9
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     _chatMessage = chatMessage;
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), Pattern.ReminderInTimePattern)))
     {
         twitchBot.SendSetTimedReminder(chatMessage, GetTimedRemindMessage(), GetToTime());
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+(\s\S+)*")))
     {
         twitchBot.SendSetReminder(chatMessage, GetRemindMessage());
     }
 }
Beispiel #10
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\sffz(\s((\d+)|(\w+(\s\d+)?)))?")))
     {
         twitchBot.SendFFZEmotes(chatMessage);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\sbttv(\s((\d+)|(\w+(\s\d+)?)))?")))
     {
         twitchBot.SendBTTVEmotes(chatMessage);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s7tv(\s((\d+)|(\w+(\s\d+)?)))?")))
     {
         twitchBot.Send7TVEmotes(chatMessage);
     }
 }
Beispiel #11
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\sprefix")))
     {
         twitchBot.SendUnsetPrefix(chatMessage);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\sreminder\s\d+")))
     {
         twitchBot.SendUnsetReminder(chatMessage);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\semote")))
     {
         twitchBot.SendUnsetEmoteInFront(chatMessage);
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+\s\S+")))
     {
         twitchBot.Send(chatMessage.Channel, GenerateMessage(chatMessage.Username, chatMessage.GetLowerSplit()[1], chatMessage.GetSplit()[2]));
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+")))
     {
         twitchBot.Send(chatMessage.Channel, GenerateMessage(chatMessage.Username, chatMessage.GetLowerSplit()[1]));
     }
     else
     {
         twitchBot.Send(chatMessage.Channel, $"{chatMessage.Username}, who do you want to tuck?");
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+\s#?\w+")))
     {
         twitchBot.SendRandomMessage(chatMessage, chatMessage.GetLowerSplit()[1], chatMessage.GetLowerSplit()[2].ReplaceHashtag());
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+")))
     {
         twitchBot.SendRandomMessage(chatMessage, chatMessage.GetLowerSplit()[1]);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel))))
     {
         twitchBot.SendRandomMessage(chatMessage);
     }
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+\s#?\w+")))
     {
         twitchBot.SendFirstUserChannel(chatMessage, chatMessage.GetLowerSplit()[1], chatMessage.GetLowerSplit()[2]);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s#\w+")))
     {
         twitchBot.SendFirstChannel(chatMessage, chatMessage.GetLowerSplit()[1]);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\w+")))
     {
         twitchBot.SendFirstUser(chatMessage, chatMessage.GetLowerSplit()[1]);
     }
     else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel))))
     {
         twitchBot.SendFirst(chatMessage);
     }
 }
Beispiel #15
0
        public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
        {
            _chatMessage = chatMessage;

            if (chatMessage.GetMessage().IsMatch(@"\s?u(ser(name)?)?:\w+") && chatMessage.GetMessage().IsMatch(@"\s?c(hannel)?:#?\w+"))
            {
                twitchBot.SendSearchUserChannel(chatMessage, GetKeyWord(), GetUsername(), GetChannel());
            }
            else if (chatMessage.GetMessage().IsMatch(@"\su(ser(name)?)?:\w+"))
            {
                twitchBot.SendSearchUser(chatMessage, GetKeyWord(), GetUsername());
            }
            else if (chatMessage.GetMessage().IsMatch(@"\sc(hannel)?:#?\w+"))
            {
                twitchBot.SendSearchChannel(chatMessage, GetKeyWord(), GetChannel());
            }
            else if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\s\S+")))
            {
                twitchBot.SendSearch(chatMessage, GetKeyWord());
            }
        }
 public static bool IsCommand(ChatMessage chatMessage)
 {
     return(CommandHelper.GetCommandAliases().Any(alias => chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"(\s|$)"))));
 }
Beispiel #17
0
 public static bool MatchesAnyAlias(this ChatMessage chatMessage, AfkCommandType type)
 {
     return(GetAfkCommand(type).Alias.Any(alias => PrefixHelper.GetPrefix(chatMessage.Channel) + alias == chatMessage.GetLowerSplit()[0] || alias + Config.Suffix == chatMessage.GetLowerSplit()[0]));
 }
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage, string alias)
 {
     if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"\sprefix\s\S{1," + Config.MaxPrefixLength + "}")))
     {
         twitchBot.SendSetPrefix(chatMessage, chatMessage.GetLowerSplit()[2][..(chatMessage.GetLowerSplit()[2].Length > Config.MaxPrefixLength ? Config.MaxPrefixLength : chatMessage.GetLowerSplit()[2].Length)]);
Beispiel #19
0
 public static void Handle(TwitchBot twitchBot, ChatMessage chatMessage)
 {
     if (MessageHelper.IsCommand(chatMessage))
     {
         ((CommandType[])Enum.GetValues(typeof(CommandType))).ToList().ForEach(type =>
         {
             if (chatMessage.MatchesAnyAlias(type))
             {
                 if (!BotActions.IsOnCooldown(chatMessage.Username, type))
                 {
                     CommandHelper.GetCommand(type).Alias.ForEach(alias =>
                     {
                         if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"(\s|$)")))
                         {
                             BotActions.AddUserToCooldownDictionary(chatMessage.Username, type);
                             Type.GetType(CommandHelper.GetCommandClassName(type)).GetMethod(_handleName).Invoke(null, new object[] { twitchBot, chatMessage, alias });
                             BotActions.AddCooldown(chatMessage.Username, type);
                         }
                     });
                 }
             }
         });
         twitchBot.CommandCount++;
     }
     else if (MessageHelper.IsAfkCommand(chatMessage))
     {
         ((AfkCommandType[])Enum.GetValues(typeof(AfkCommandType))).ToList().ForEach(type =>
         {
             if (chatMessage.MatchesAnyAlias(type))
             {
                 if (!BotActions.IsOnAfkCooldown(chatMessage.Username))
                 {
                     CommandHelper.GetAfkCommand(type).Alias.ForEach(alias =>
                     {
                         if (chatMessage.GetMessage().IsMatch(PatternCreator.Create(alias, PrefixHelper.GetPrefix(chatMessage.Channel), @"(\s|$)")))
                         {
                             BotActions.AddUserToAfkCooldownDictionary(chatMessage.Username);
                             AfkCommandHandler.Handle(twitchBot, chatMessage, type);
                             BotActions.AddAfkCooldown(chatMessage.Username);
                         }
                     });
                 }
             }
         });
         twitchBot.CommandCount++;
     }
 }