Exemple #1
0
        public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
        {
            if (verifyCommand(e))
            {
                TimeSpan uptime = TwitchLib.TwitchApi.GetUptime("burkeblack").Result;
                string msgStr = "";
                if (uptime.Days > 0)
                    msgStr = uptime.Days + " days";
                if (uptime.Hours > 0)
                    if(msgStr == "")
                        msgStr += string.Format("{0} hours", uptime.Hours);
                    else
                        msgStr += string.Format(", {0} hours", uptime.Hours);


                if (uptime.Minutes > 0)
                    if(msgStr == "")
                        msgStr += string.Format("{0} minutes", uptime.Minutes);
                    else
                        msgStr += string.Format(", {0} minutes", uptime.Minutes);
                if (uptime.Seconds > 0)
                    if(msgStr == "")
                        msgStr += string.Format("{0} seconds", uptime.Seconds);
                    else
                        msgStr += string.Format(", {0} seconds", uptime.Seconds);
                Common.ChatClient.SendMessage(string.Format("Current uptime for BurkeBlack is: {0}", msgStr), Common.DryRun);
            }
        }
        public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
        {
            if (verifyCommand(e))
            {
                if(Common.RecentDonations.Count != 0)
                {
                    string elapsedTime = "";
                    TimeSpan difference = DateTime.Now.Subtract(Common.RecentDonations[0].Date);
                    if (difference.Days > 0)
                        elapsedTime = string.Format("{0} day(s), {1} hour(s), {2} minute(s), {3} seconds", difference.Days, difference.Hours, difference.Minutes, difference.Seconds);
                    else if (difference.Hours > 0)
                        elapsedTime = string.Format("{0} hour(s), {1} minute(s), {2} seconds", difference.Hours, difference.Minutes, difference.Seconds);
                    else if (difference.Minutes > 0)
                        elapsedTime = string.Format("{0} minute(s), {1} seconds", difference.Minutes, difference.Seconds);
                    else if (difference.Seconds > 0)
                        elapsedTime = string.Format("{0} seconds", difference.Seconds);
                    Common.ChatClient.SendMessage(string.Format("Most recent donation was by {0} who donated ${1} {2} ago, with the message '{3}'", Common.RecentDonations[0].Username,
                        Common.RecentDonations[0].Amount, elapsedTime, Common.RecentDonations[0].Message));
                } else
                {
                    Common.ChatClient.SendMessage("No recent donations recorded :(");
                }
            }

        }
Exemple #3
0
        //{user} = valid user provided in the command, must also be present in return
        //{sender} = user that sends teh command
        //{recent_sub_name} = most recent sub name
        //{recent_sub_length} = most recent sub length
        //{stream_game} = game burke is currently playing, according to Twitch API
        //{stream_status} = stream's current status
        //{stream_link} = stream link
        //{viewer_count} = number of current viewers
        //{command_count} = number of commands
        //{rotating_message_count} = number of rotating messages
        //{online_status} = "online" or "offline" depending on stream status
        //{raffle_name} = name of raffle
        //{raffle_donator} = donator of raffle
        //{raffle_author} = mod that submitted giveaway

        public static string USER(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
        {
            if (e.ArgumentsAsList.Count == 1)
                return e.ArgumentsAsList[0];
            else
                return null;
        }
Exemple #4
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         string receiver = e.ArgumentsAsList[0].ToLower();
         int usages = 1;
         if (e.ArgumentsAsList.Count == 2)
             usages = int.Parse(e.ArgumentsAsList[1]);
         bool found = false;
         foreach(Objects.Permit oldPermit in Common.Permits)
         {
             if(oldPermit.Username.ToLower() == receiver)
             {
                 found = true;
                 oldPermit.update(DateTime.Now, usages);
             }
         }
         if (!found)
             Common.Permits.Add(new Objects.Permit(receiver, DateTime.Now, usages));
         if (usages == 1)
             Common.ChatClient.SendMessage(string.Format("You are permitted to post 1 link, {0}!", receiver), Common.DryRun);
         else
             Common.ChatClient.SendMessage(string.Format("You are permitted to post {0} links, {1}", usages, receiver), Common.DryRun);
         Common.command(e.Command, true);
     } else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #5
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         if(e.ArgumentsAsList.Count == 0)
         {
             //Random quote
             Objects.Quote randomQuote = Common.Quotes[new Random().Next(0, Common.Quotes.Count - 1)];
             Common.ChatClient.SendMessage(string.Format("[{0}/{1}] {2} - {3}", randomQuote.ID, Common.Quotes[Common.Quotes.Count - 1].ID, randomQuote.QuoteContents, randomQuote.Author), Common.DryRun);
         } else
         {
             //Indexed quote
             if(int.Parse(e.ArgumentsAsList[0]) <= Common.Quotes[Common.Quotes.Count - 1].ID)
             {
                 foreach(Objects.Quote quote in Common.Quotes)
                     if(quote.ID.ToString() == e.ArgumentsAsList[0])
                     {
                         Common.ChatClient.SendMessage(string.Format("[{0}/{1}] {2} - {3}", quote.ID, Common.Quotes[Common.Quotes.Count - 1].ID, quote.QuoteContents, quote.Author), Common.DryRun);
                         return;
                     }
                 Common.ChatClient.SendMessage("Invalid quote index [quote deleted]!", Common.DryRun);
             } else
             {
                 Common.ChatClient.SendMessage("Invalid quote index [too large]!", Common.DryRun);
             }
         }
     }
 }
Exemple #6
0
 // Fires when a message is received that is prefixed with an !
 public static void chatOnCommand(object sender, TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     ChatFiltering.violatesProtections(e.ChatMessage.Username, Common.isSub(e), Common.isMod(e), e.ChatMessage.Message);
     Commands.handleChatCommand(e);
     processPotentialSub(e);
     Common.ChatMessageTracker.addMessage(e.ChatMessage);
 }
Exemple #7
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         if(e.ArgumentsAsList.Count == 1)
         {
             //Raise for sub
             if(Common.RecentSub != null)
             {
                 Common.ChatClient.SendMessage(string.Format("burkeFlag burkeFlag burkeFlag raise your burkeFlag for {0} burkeFlag burkeFlag burkeFlag", Common.RecentSub.Name), Common.DryRun);
                 Common.ChatClient.SendMessage(string.Format("burkeFlag burkeFlag burkeFlag raise your burkeFlag for {0} burkeFlag burkeFlag burkeFlag", Common.RecentSub.Name), Common.DryRun);
                 Common.ChatClient.SendMessage(string.Format("burkeFlag burkeFlag burkeFlag raise your burkeFlag for {0} burkeFlag burkeFlag burkeFlag", Common.RecentSub.Name), Common.DryRun);
             } else
             {
                 Common.ChatClient.SendMessage("No recent sub recorded (since bot was sorted) :(");
             }
         } else
         {
             //Raise
             Common.ChatClient.SendMessage("burkeFlag burkeFlag burkeFlag raise your burkeFlag burkeFlag burkeFlag", Common.DryRun);
             Common.ChatClient.SendMessage("burkeFlag burkeFlag burkeFlag raise your burkeFlag burkeFlag burkeFlag", Common.DryRun);
             Common.ChatClient.SendMessage("burkeFlag burkeFlag burkeFlag raise your burkeFlag burkeFlag burkeFlag", Common.DryRun);
         }
     }
 }
Exemple #8
0
 public async static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         Common.ChatClient.SendMessage(await WebCalls.talk(e.ChatMessage.Username, e.ArgumentsAsString), Common.DryRun);
     }
 }
 // Handles raid chat event
 public void handleMessage(TwitchLib.TwitchChatClient.OnMessageReceivedArgs message)
 {
     if(raidTimer.Enabled)
     {
         foreach(string word in message.ChatMessage.Message.ToLower().Split(' '))
         {
             foreach(string gunnerWord in gunnerIdentifiers)
             {
                 if (word == gunnerWord && !gunners.Contains(message.ChatMessage.Username.ToLower()) && message.ChatMessage.Username.ToLower() != "the_kraken_bot")
                     gunners.Add(message.ChatMessage.Username.ToLower());
                 if (word == gunnerWord && !participants.Contains(message.ChatMessage.Username.ToLower()) && message.ChatMessage.Username.ToLower() != "the_kraken_bot")
                     participants.Add(message.ChatMessage.Username.ToLower());
             }
             foreach(string boarderWord in boarderIdentifiers)
             {
                 if (word == boarderWord && !boarders.Contains(message.ChatMessage.Username.ToLower()) && message.ChatMessage.Username.ToLower() != "the_kraken_bot")
                     boarders.Add(message.ChatMessage.Username.ToLower());
                 if (word == boarderWord && !participants.Contains(message.ChatMessage.Username.ToLower()) && message.ChatMessage.Username.ToLower() != "the_kraken_bot")
                     participants.Add(message.ChatMessage.Username.ToLower());
             }
         }
     } else
     {
         if(message.ChatMessage.Username.ToLower() == "burkeblack")
         {
             raidTimer.Start();
             Common.RaidClient.SendMessage("burkeFlag burkeFlag The Black Crew, ATTACK!!!! burkeFlag burkeFlag", Common.DryRun);
             Common.ChatClient.SendMessage(string.Format("burkeFlag burkeFlag The attack has begun on {0}, get in there! http://twitch.tv/{0}", message.ChatMessage.Channel), Common.DryRun);
         }
     }
 }
Exemple #10
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         Random rand = new Random();
         if (e.ArgumentsAsList.Count == 0)
         {
             List<TwitchLib.Chatter> chatters = TwitchLib.TwitchApi.GetChatters("burkeblack").Result;
             Common.ChatClient.SendMessage(string.Format("{0} {1}!!", intro[rand.Next(0, intro.Length)], chatters[rand.Next(0, chatters.Count)].Username), Common.DryRun);
         } else
         {
             switch(e.ArgumentsAsList[0])
             {
                 case "follower":
                     bool foundFollower = false;
                     int iteration = 0;
                     TwitchLib.Chatter candidate = null;
                     List<TwitchLib.Chatter> chatters = TwitchLib.TwitchApi.GetChatters("burkeblack").Result;
                     while (foundFollower == false && iteration < 5)
                     {
                         candidate = chatters[rand.Next(0, chatters.Count)];
                         if (TwitchLib.TwitchApi.UserFollowsChannel(candidate.Username, "burkeblack").Result)
                             foundFollower = true;
                         iteration++;
                     }
                     if(foundFollower)
                         Common.ChatClient.SendMessage(string.Format("{0} {1}!!", intro[rand.Next(0, intro.Length)], candidate.Username), Common.DryRun);
                     else
                         Common.ChatClient.SendMessage(string.Format("{0} {1} (no follower found after 5th iteration)!!", intro[rand.Next(0, intro.Length)], candidate.Username), Common.DryRun);
                     break;
                 case "sub":
                     if (Common.ChatSubs.Count > 2)
                         Common.ChatClient.SendMessage(string.Format("{0} {1}!!", intro[rand.Next(0, intro.Length)], Common.ChatSubs[rand.Next(0, Common.ChatSubs.Count)]), Common.DryRun);
                     else
                         Common.ChatClient.SendMessage("Fewer than 3 subs exist in the sub chatter list.  Please allow more subs to speak in chat before using this command.", Common.DryRun);
                     break;
                 case "subscriber":
                     if (Common.ChatSubs.Count > 2)
                         Common.ChatClient.SendMessage(string.Format("{0} {1}!!", intro[rand.Next(0, intro.Length)], Common.ChatSubs[rand.Next(0, Common.ChatSubs.Count)]), Common.DryRun);
                     else
                         Common.ChatClient.SendMessage("Fewer than 3 subs exist in the sub chatter list.  Please allow more subs to speak in chat before using this command.", Common.DryRun);
                     break;
                 case "clear":
                     Common.ChatSubs.Clear();
                     Common.ChatClient.SendMessage("Subscriber list has been cleared.");
                     break;
                 case "reset":
                     Common.ChatSubs.Clear();
                     Common.ChatClient.SendMessage("Subscriber list has been cleared.");
                     break;
             }
         }
         Common.command(e.Command, true);
     }
     else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #11
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         TwitchLib.TwitchApi.UpdateStreamTitle(e.ArgumentsAsString, "burkeblack", Properties.Settings.Default.BurkeOAuth);
         Common.ChatClient.SendMessage("Title change API request sent!", Common.DryRun);
     }
 }
Exemple #12
0
 private static bool verifyCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (e.ArgumentsAsList.Count > 0 && !Common.isMod(e))
         return false;
     if (Common.DryRun)
         return false;
     return true;
 }
Exemple #13
0
 public FollowData(TwitchLib.TwitchChannel channel)
 {
     this.channel = channel;
     if (channel.Mature)
         chatMessage = string.Format("Go follow {0} (mature channel), they've been playing: {1}! http://twitch.tv/{0}", channel.Name, channel.Game);
     else
         chatMessage = string.Format("Go follow {0}, they've been playing: {1}! http://twitch.tv/{0}", channel.Name, channel.Game);
 }
Exemple #14
0
 private static bool verifyCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (e.ChatMessage.Username.ToLower() != "swiftyspiffy")
         return false;
     if (Common.DryRun)
         return false;
     return true;
 }
Exemple #15
0
 // Fires when channel state message is received from Twitch
 public static void onChannelState(object sender, TwitchLib.TwitchChatClient.OnChannelStateChangedArgs e)
 {
     if(!connected && !Common.DefaultOverride)
         Common.ChatClient.SendMessage(string.Format("/me [V2] connected[v{0}]!", Assembly.GetExecutingAssembly().GetName().Version), Common.DryRun);
     connected = true;
     if (!Common.EntryMessage)
         return;
 }
Exemple #16
0
 private static bool verifyCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (!Common.Cooldown.chatCommandAvailable(e.ChatMessage.UserType, e.Command, 10))
         return false;
     if (Common.DryRun)
         return false;
     return true;
 }
Exemple #17
0
 private static bool verifyCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     TwitchLib.ChatMessage.UType userType = e.ChatMessage.UserType;
     if (Common.Moderators.Contains(e.ChatMessage.Username.ToLower()))
         userType = TwitchLib.ChatMessage.UType.Moderator;
     if (!Common.Cooldown.chatCommandAvailable(userType, e.Command, 10))
         return false;
     return true;
 }
Exemple #18
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         string timeData = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")).ToString();
         Common.ChatClient.SendMessage(string.Format("The current time for Burke is: {0} {1}", timeData.Split(' ')[1], timeData.Split(' ')[2]), Common.DryRun);
     }
         
 }
Exemple #19
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if(verifyCommand(e))
     {
         Common.ChatClient.SendMessage(getModerators(e.Channel), Common.DryRun);
         Common.command(e.Command, true);
     } else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #20
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if(verifyCommand(e) && !Common.DryRun)
     {
         Common.Raffle.tryClaim(e.ChatMessage.Username);
         Common.command(e.Command, true);
     } else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #21
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if(verifyCommand(e))
     {
         Common.Multihost.handleExtend(e.ChatMessage.Username);
         Common.command(e.Command, true);
     } else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #22
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         Common.ChatClient.SendMessage(string.Format("!Games is an automated giveaway system! You can see a video on it here: https://www.twitch.tv/burkeblack/v/30553157 .  There are currently {0} !games available!", WebCalls.downloadExGamesCount().Result), Common.DryRun);
         Common.command(e.Command, true);
     }
     else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #23
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         Common.ChatClient.SendMessage("How dare ye wake me from me slumber!");
         Common.command(e.Command, true);
     }
     else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #24
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         Common.Multihost.remaining();
         Common.command(e.Command, true);
     }
     else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #25
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         //if (Common.RaidClient == null || Common.RaidClient.Channel.ToLower() != e.ArgumentsAsList[0].ToLower())
         //    launchRaidInstance(e.ArgumentsAsList[0]);
         Common.ChatClient.SendMessage(string.Format("Go raid {0}!!! Viewers: R)", e.ArgumentsAsList[0]), Common.DryRun);
         Common.ChatClient.SendMessage(string.Format("Go raid http://twitch.tv/{0}!!! Sub: burkeShip burkeFire burkeFire", e.ArgumentsAsList[0]), Common.DryRun);
         Common.ChatClient.SendMessage(string.Format("Go raid {0}!!! Viewers: R)", e.ArgumentsAsList[0]), Common.DryRun);
         Common.ChatClient.SendMessage(string.Format("Go raid http://twitch.tv/{0}!!! Sub: burkeShip burkeFire burkeFire", e.ArgumentsAsList[0]), Common.DryRun);
     }
 }
Exemple #26
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         string drinking = WebCalls.downloadDrinking().Result;
         Common.ChatClient.SendMessage(string.Format("Burke is currently drink {0}.", drinking));
         Common.command(e.Command, true);
     }
     else
     {
         Common.command(e.Command, false);
     }
 }
Exemple #27
0
 public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e)
 {
     if (verifyCommand(e))
     {
         OpenWeatherAPI.Query query = Common.OpenWeatherAPI.query(e.ArgumentsAsString);
         if (query != null && query.ValidRequest)
             Common.ChatClient.SendMessage(string.Format("{0}, {1} temperature: {2} ~F ({3} ~C).Conditions: {4} ({5}). Humidity: {6}%. Wind speed: {7} m/s ({8})",
                 query.Name, query.Sys.Country, query.Main.Temperature.FahrenheitCurrent, query.Main.Temperature.CelsiusCurrent, query.Weathers[0].Main, query.Weathers[0].Description,
                 query.Main.Humdity, query.Wind.SpeedMetersPerSecond, query.Wind.directionEnumToString(query.Wind.Direction)), Common.DryRun);
         else
             Common.ChatClient.SendMessage("Failed to process weather command. Sorry :(", Common.DryRun);
     }
 }
Exemple #28
0
 // Checks availability of chat command, and resets cooldown if available
 public bool chatCommandAvailable(TwitchLib.ChatMessage.UType userType, string command, int seconds)
 {
     if(seconds != 0 && userType != TwitchLib.ChatMessage.UType.Moderator)
     {
         foreach (CommandCooldown cooldown in cooldowns)
         {
             if (cooldown.Command.ToLower() == command.ToLower()) {
                 return cooldown.activate();
             }
         }
         cooldowns.Add(new CommandCooldown(command, seconds));
     }
     return true;
 }
 public static void handleCommand(TwitchLib.TwitchWhisperClient.OnCommandReceivedArgs e)
 {
     if (Common.Cooldown.chatCommandAvailable(TwitchLib.ChatMessage.UType.Viewer, e.Command, 20))
     {
         if (int.Parse(WebCalls.getUserDoubloons(e.Username).Result) > Common.DiscordInviteLimit)
         {
             string oldInvite = WebCalls.getExistingDiscordInvite(e.Username).Result;
             if (oldInvite != null)
             {
                 if (Common.WhisperClient != null)
                     Common.WhisperClient.SendWhisper(e.Username, string.Format("It appears you've already requested an invite.  You may try accessing your old invite here (https://discord.gg/{0}), but it may be invalid.", oldInvite), Common.DryRun);
             }
             else
             {
                 //string invite = WebCalls.createInviteCode();
                 //if (Common.WhisperClient != null)
                 //    Common.WhisperClient.SendWhisper(e.Username, string.Format("Here is your BurkeBlack Crew Discord Chat invite.  You have two 2 minutes, and this link will expire after its first usage.  You will not receive another link. https://discord.gg/{0}", invite), Common.DryRun);
                 //WebCalls.addInviteCode(e.Username, invite);
             }
         }
         else
         {
             if (Common.WhisperClient != null)
                 Common.WhisperClient.SendWhisper(e.Username, string.Format("You currently do not meet the {0} doubloon limit.  Please request an invite when you have met this requirement.", Common.DiscordInviteLimit), Common.DryRun);
         }
     } else
     {
         if (Common.WhisperClient != null)
             Common.WhisperClient.SendWhisper(e.Username, string.Format("There is a 20 second cooldown on this whisper command applied to everyone whispering me (The_Kraken_Bot).  Please try again shortly."));
     }
 }
Exemple #30
-1
 // Handles all whisper commands (whispers that have ! prefix) from event
 public static void handleWhisperCommand(TwitchLib.TwitchWhisperClient.OnCommandReceivedArgs command)
 {
     switch(command.Command)
     {
         case "notifyme":
             HardCodedWhisperCommands.OnlineNotifications.NotifyMe.handleCommand(command);
             break;
         case "removeme":
             HardCodedWhisperCommands.OnlineNotifications.RemoveMe.handleCommand(command);
             break;
         case "doubloons":
             HardCodedWhisperCommands.Doubloons.handleCommand(command);
             break;
         case "commands":
             HardCodedWhisperCommands.Commands.handleCommand(command);
             break;
         case "discordinvite":
             HardCodedWhisperCommands.DiscordInvite.handleCommand(command);
             break;
         case "giveawayhistory":
             HardCodedWhisperCommands.GiveawayHistory.handleCommand(command);
             break;
         default:
             if (Common.WhisperClient != null)
                 Common.WhisperClient.SendWhisper(command.Username, "To view available whisper commands, whisper the bot !commands", Common.DryRun);
             //Handle dynamically created whisper commands
             break;
     }
 }