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); } } }
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); } } } }
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); } }
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); } if (!Common.isSub(e)) { return(false); } if (e.ArgumentsAsList.Count == 0) { return(false); } if (Common.DryRun) { return(false); } return(true); }
// Internal function to process a received sub and redirect stack to ChatSubs object utilizing command as identity private static void processPotentialSub(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (e.ChatMessage.Subscriber && !Common.ChatSubs.Contains(e.ChatMessage.Username.ToLower())) { Common.ChatSubs.Add(e.ChatMessage.Username.ToLower()); } }
// 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); }
// Determine if command received's UserTier meets command UserTier in descending fashion private static bool validateTiers(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e, Objects.ChatCommand command) { switch (command.UserTier) { case Objects.ChatCommand.uTier.SWIFTYSPIFFY: if (e.ChatMessage.Username.ToLower() == "swiftyspiffy") { return(true); } return(false); case Objects.ChatCommand.uTier.MODERATOR: if (Common.isMod(e)) { return(true); } return(false); case Objects.ChatCommand.uTier.SUBSCRIBER: if (Common.isSub(e)) { return(true); } return(false); case Objects.ChatCommand.uTier.VIEWER: return(true); case Objects.ChatCommand.uTier.DISABLED: return(false); default: return(true); } }
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 :("); } } }
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); } }
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); } }
//{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); } }
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); } }
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); } }
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); } }
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); } }
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); }
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); }
// Determine if sender of command is moderator public static bool isMod(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { TwitchLib.ChatMessage.UType UType = e.ChatMessage.UserType; if (Moderators.Contains(e.ChatMessage.Username)) { return(true); } else { return(false); } }
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); } }
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); } }
private static bool verifyCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (e.ChatMessage.Username.ToLower() != "swiftyspiffy") { return(false); } if (Common.DryRun) { return(false); } return(true); }
public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (verifyCommand(e)) { Common.ChatClient.SendMessage("Kappa", Common.DryRun); Common.command(e.Command, true); } else { Common.command(e.Command, false); } }
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); } }
public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (verifyCommand(e)) { int subCount = TwitchLib.TwitchApi.GetSubscriberCount("burkeblack", Properties.Settings.Default.BurkeOAuth).Result; string message = "The Captain is on a hunt for 500 crew members (Subs) that will lead to full time twitch Piracy, which will also unlock more Booty for the crew (Emotes). He currently has a crew of " + subCount.ToString() + "! So if you love running into trees, poles, bridges, space rocks and wish to join our truly close and caring community, please join! :)"; Common.ChatClient.SendMessage(message); Common.command(e.Command, true); } else { Common.command(e.Command, false); } }
// Determine if sender of command is a sub public static bool isSub(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { TwitchLib.ChatMessage.UType UType = e.ChatMessage.UserType; if (UType == TwitchLib.ChatMessage.UType.Admin || UType == TwitchLib.ChatMessage.UType.GlobalModerator || UType == TwitchLib.ChatMessage.UType.Moderator || UType == TwitchLib.ChatMessage.UType.Staff || e.ChatMessage.Subscriber || Moderators.Contains(e.ChatMessage.Username.ToLower()) || e.ChatMessage.Username.ToLower() == "swiftyspiffy") { return(true); } else { return(false); } }
public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (verifyCommand(e)) { Common.ChatClient.SendMessage("Restarting...", Common.DryRun); System.Diagnostics.Process.Start(Environment.CurrentDirectory + "\\KrakenBot2.exe"); Environment.Exit(0); Common.command(e.Command, true); } else { Common.command(e.Command, false); } }
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)) { 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); } } }
public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (verifyCommand(e)) { if (Common.Multihost != null) { Common.Multihost.guess(); } else { Common.ChatClient.SendMessage("Multihost is not currently initialized.", Common.DryRun); } Common.command(e.Command, true); } else { Common.command(e.Command, false); } }
public static void handleCommand(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e) { if (verifyCommand(e)) { if (WebCalls.createHighlight(e.ChatMessage.Username, e.ArgumentsAsString).Result) { Common.ChatClient.SendMessage(string.Format("Created a highlight marker by '{0}' titled '{1}'! You can view bookmarked highlights here: https://burkeblack.tv/highlights.php", e.ChatMessage.Username, e.ArgumentsAsString), Common.DryRun); } else { Common.ChatClient.SendMessage("Highlight was not created. Please make sure Burke is online before creating a highlight."); } Common.command(e.Command, true); } else { Common.command(e.Command, false); } }