public raffle(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { m_Throttler = new throttler(aJerpBot); m_Throttler.waitTimeMax = 15000; m_Throttler.lineCountMinimum = 8; m_Throttler.messagesReduceTimer = false; userList = new Dictionary <string, userEntry>(); usersAddedRecently = new List <userEntry>(); load(); chatCommandDef tempDef = new chatCommandDef("raffle", addUser, true, true); tempDef.addSubCommand(new chatCommandDef("open", open, true, false)); tempDef.addSubCommand(new chatCommandDef("close", close, true, false)); tempDef.addSubCommand(new chatCommandDef("clear", reset, true, false)); tempDef.addSubCommand(new chatCommandDef("draw", draw, true, false)); tempDef.addSubCommand(new chatCommandDef("count", count, true, false)); tempDef.addSubCommand(new chatCommandDef("describe", describe, true, false)); tempDef.addSubCommand(new chatCommandDef("about", about, true, true)); tempDef.addSubCommand(new chatCommandDef("useredemptions", toggleUseRedemptions, false, false)); tempDef.useGlobalCooldown = false; m_BotBrain.addChatCommand(tempDef); }
public bool updateInfoTask(jerpBot aBotBrain) { if (string.IsNullOrEmpty(rewardID)) { Task <TwitchLib.Api.Helix.Models.ChannelPoints.GetCustomReward.GetCustomRewardsResponse> getRewardsTask = aBotBrain.twitchAPI.Helix.ChannelPoints.GetCustomRewardAsync(aBotBrain.ownerID); getRewardsTask.Wait(); if (getRewardsTask.Result != null) { foreach (TwitchLib.Api.Helix.Models.ChannelPoints.CustomReward curReward in getRewardsTask.Result.Data) { if (curReward.Title == title) { rewardID = curReward.Id; return(true); } } } } else { return(true); } return(false); }
public counter(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { string createCounterTableQuery = "CREATE TABLE IF NOT EXISTS counters (counterID INTEGER PRIMARY KEY ASC, name TEXT, game TEXT, description TEXT, count INTEGER, UNIQUE(name, game))"; SQLiteCommand createCounterTableCommand = new SQLiteCommand(createCounterTableQuery, m_BotBrain.storageDB); createCounterTableCommand.ExecuteNonQuery(); m_Entries = new Dictionary <string, Dictionary <string, counterEntry> >(); checkInitializeList(GAME_NOGAME); chatCommandDef tempDef; tempDef = new chatCommandDef("count", display, true, true); tempDef.addSubCommand(new chatCommandDef("add", add, true, false)); tempDef.addSubCommand(new chatCommandDef("remove", remove, true, false)); tempDef.addSubCommand(new chatCommandDef("delete", delete, true, false)); tempDef.addSubCommand(new chatCommandDef("describe", describe, true, false)); tempDef.addSubCommand(new chatCommandDef("set", set, true, false)); tempDef.addSubCommand(new chatCommandDef("forcegame", forceGame, true, false)); tempDef.addSubCommand(new chatCommandDef("cleargame", clearGame, true, false)); tempDef.addSubCommand(new chatCommandDef("setowner", setOwner, false, false)); tempDef.addSubCommand(new chatCommandDef("clearowner", clearOwner, false, false)); tempDef.addSubCommand(new chatCommandDef("about", about, true, true)); tempDef.addSubCommand(new chatCommandDef("outputlist", outputList, false, false)); m_BotBrain.addChatCommand(tempDef); }
public bool attemptAddRequest(jerpBot aBotBrain, out bool aAlreadyExists) { aAlreadyExists = false; if (!updateInfoTask(aBotBrain)) { try { TwitchLib.Api.Helix.Models.ChannelPoints.CreateCustomReward.CreateCustomRewardsRequest createRewardRequest = getCreateRequest(); Task <TwitchLib.Api.Helix.Models.ChannelPoints.CreateCustomReward.CreateCustomRewardsResponse> createRewardTask = aBotBrain.twitchAPI.Helix.ChannelPoints.CreateCustomRewardsAsync(aBotBrain.ownerID, createRewardRequest); createRewardTask.Wait(); if (createRewardTask.Result == null) { Console.WriteLine("Failed to create channel point reward named: " + title); return(false); } else { rewardID = createRewardTask.Result.Data[0].Id; return(true); // Successfully created } } catch (Exception e) { Console.WriteLine(string.Format("Exception when trying to create channel point reward named: \"{0}\": {1}", title, e.Message)); return(false); } } else { aAlreadyExists = true; return(true); // Already exists } }
public localizer(jerpBot aJerpBot) { m_BotBrain = aJerpBot; if (loadConfig()) { m_Loaded = true; } }
public botModule(jerpBot aJerpBot, bool aRequiresConnection = true, bool aRequiresChannel = true, bool aRequiresPM = false) { m_BotBrain = aJerpBot; m_RequiresConnection = aRequiresConnection; m_RequiresChannel = aRequiresChannel; m_RequiresPM = aRequiresPM; m_BotBrain.addModule(this); }
public commandAlias(jerpBot botGeneral) : base(botGeneral) { chatCommandDef tempDef = new chatCommandDef("alias", null, false, false); tempDef.addSubCommand(new chatCommandDef("add", add, false, false)); tempDef.addSubCommand(new chatCommandDef("remove", remove, false, false)); tempDef.addSubCommand(new chatCommandDef("outputlist", outputList, false, false)); m_BotBrain.addChatCommand(tempDef); }
public customCommand(jerpBot aJerpBot) : base(aJerpBot) { chatCommandDef tempDef = new chatCommandDef("command", null, false, false); tempDef.addSubCommand(new chatCommandDef("add", add, true, false)); tempDef.addSubCommand(new chatCommandDef("remove", remove, true, false)); tempDef.addSubCommand(new chatCommandDef("outputlist", outputList, false, false)); m_BotBrain.addChatCommand(tempDef); }
public delaySender(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { m_Entries = new List <delaySendEntry>(); chatCommandDef tempDef = new chatCommandDef("delay", addEntry, true, false); tempDef.addSubCommand(new chatCommandDef("purge", purgeEntries, false, false)); tempDef.addSubCommand(new chatCommandDef("count", getCount, false, false)); tempDef.useGlobalCooldown = false; m_BotBrain.addChatCommand(tempDef); }
public predictionManager(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { chatCommandDef tempDef = new chatCommandDef("prediction", null, false, false); tempDef.addSubCommand(new chatCommandDef("last", displayLast, true, true)); tempDef.addSubCommand(new chatCommandDef("create", create, true, false)); tempDef.addSubCommand(new chatCommandDef("close", close, true, false)); tempDef.addSubCommand(new chatCommandDef("cancel", cancel, true, false)); tempDef.addSubCommand(new chatCommandDef("decide", decide, true, false)); m_BotBrain.addChatCommand(tempDef); }
static void Main(string[] args) { jerpBot.checkCreateBotStorage(); jerpBot.checkCreateBotDatabase(); logger logGeneral = new logger("log_general.txt"); botConfig tempConfig = new botConfig(); botConnection connConfig; if (tempConfig.loaded && tempConfig.configData.connections.Count > 0) { connConfig = tempConfig.configData.connections[0]; } else { return; } jerpBot botGeneral = new jerpBot(logGeneral, tempConfig); raffle raffleModule = new raffle(botGeneral); quotes quoteModule = new quotes(botGeneral); customCommand customCommandModule = new customCommand(botGeneral); gameCommand gameCommandModule = new gameCommand(botGeneral); counter counterModule = new counter(botGeneral); queueSystem queueModule = new queueSystem(botGeneral); autoShoutout shoutoutModule = new autoShoutout(botGeneral); lurkShoutout lurkShoutModule = new lurkShoutout(botGeneral); messageRoll rollModule = new messageRoll(botGeneral); pollManager pollModule = new pollManager(botGeneral); soundCommands soundManager = new soundCommands(botGeneral); commandAlias aliasManager = new commandAlias(botGeneral); trivia triviaManager = new trivia(botGeneral); hydrateReminder hydrateManager = new hydrateReminder(botGeneral); delaySender delaySendManager = new delaySender(botGeneral); hostMessages hostMessageModule = new hostMessages(botGeneral); streamProfiles streamProfileManager = new streamProfiles(botGeneral); predictionManager streamPredictionManager = new predictionManager(botGeneral); customCommandModule.initTable(); gameCommandModule.initTable(); aliasManager.initTable(); botGeneral.customCommandModule = customCommandModule; botGeneral.gameCommandModule = gameCommandModule; botGeneral.soundCommandModule = soundManager; botGeneral.aliasModule = aliasManager; while (!botGeneral.isReadyToClose) { botGeneral.frame(); } }
// TODO: variant that applies properties before creating table public gameCommand(jerpBot botGeneral) : base(botGeneral) { formatHint = m_BotBrain.localizer.getString("commandGameFormatHint"); chatCommandDef tempDef = new chatCommandDef("gamecommand", null, false, false); tempDef.addSubCommand(new chatCommandDef("add", add, true, false)); tempDef.addSubCommand(new chatCommandDef("remove", remove, true, false)); tempDef.addSubCommand(new chatCommandDef("setgame", setGame, true, false)); tempDef.addSubCommand(new chatCommandDef("cleargame", clearGame, true, false)); tempDef.addSubCommand(new chatCommandDef("outputlist", outputList, false, false)); m_BotBrain.addChatCommand(tempDef); }
public hostMessages(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { m_IsLoaded = loadConfig(); if (m_IsLoaded) { chatCommandDef tempDef = new chatCommandDef("hostmessages", null, true, true); tempDef.addSubCommand(new chatCommandDef("reload", reloadMessages, false, false)); m_BotBrain.addChatCommand(tempDef); } }
public hydrateReminder(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { m_Throttler = new throttler(aJerpBot); m_Throttler.requiresUserMessages = false; m_Throttler.messagesReduceTimer = false; m_Throttler.waitTimeMax = 30000; chatCommandDef tempDef = new chatCommandDef("hydrate", null, false, false); tempDef.addSubCommand(new chatCommandDef("current", current, true, true)); tempDef.addSubCommand(new chatCommandDef("offset", setOffset, false, false)); m_BotBrain.addChatCommand(tempDef); }
public autoShoutout(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { string configPath = System.IO.Path.Combine(jerpBot.storagePath, "config\\jerpdoesbots_shoutouts.json"); if (File.Exists(configPath)) { string configFileString = File.ReadAllText(configPath); if (!string.IsNullOrEmpty(configFileString)) { configData = new JavaScriptSerializer().Deserialize <autoShoutoutConfig>(configFileString); loaded = true; } } }
public messageRoll(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { if (loadConfig()) { m_Loaded = true; m_Throttler = new throttler(aJerpBot); m_Throttler.waitTimeMax = 900000; m_Throttler.lineCountReduction = 23333; m_Throttler.lineCountReductionMax = 30; chatCommandDef tempDef = new chatCommandDef("message", null, false, false); tempDef.addSubCommand(new chatCommandDef("next", forceNext, false, false)); m_BotBrain.addChatCommand(tempDef); } }
public quotes(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { string createQuoteTableQuery = "CREATE TABLE IF NOT EXISTS quotes (quoteID INTEGER PRIMARY KEY ASC, submitter TEXT, message TEXT, game TEXT)"; SQLiteCommand createQuoteTableCommand = new SQLiteCommand(createQuoteTableQuery, m_BotBrain.storageDB); createQuoteTableCommand.ExecuteNonQuery(); chatCommandDef tempDef = new chatCommandDef("quote", display, true, true); tempDef.addSubCommand(new chatCommandDef("add", add, true, false)); tempDef.addSubCommand(new chatCommandDef("remove", remove, true, false)); tempDef.addSubCommand(new chatCommandDef("edit", edit, true, false)); tempDef.addSubCommand(new chatCommandDef("setgame", setGame, true, false)); tempDef.addSubCommand(new chatCommandDef("outputlist", outputList, false, false)); // TODO: Add command to return total number of quotes. m_BotBrain.addChatCommand(tempDef); }
public counterEntry(string newName, string newGame, jerpBot botGeneral, bool autoCreate = true, bool tryLoad = true) { if (!String.IsNullOrEmpty(newName)) { m_Name = newName; m_Game = newGame; botBrain = botGeneral; if (tryLoad && load(newName)) { initialized = true; } else if (autoCreate && create(newName)) { initialized = true; } } }
public soundCommands(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { if (loadSounds()) { isEnabled = m_Config.enabled; chatCommandDef tempDef = new chatCommandDef("sound", playSound, true, true); tempDef.addSubCommand(new chatCommandDef("volume", setVolume, false, false)); tempDef.addSubCommand(new chatCommandDef("list", getList, true, true)); tempDef.addSubCommand(new chatCommandDef("enable", enable, true, false)); tempDef.addSubCommand(new chatCommandDef("disable", disable, true, false)); tempDef.addSubCommand(new chatCommandDef("reload", reloadSounds, false, false)); tempDef.addSubCommand(new chatCommandDef("random", playRandom, true, true)); tempDef.addSubCommand(new chatCommandDef("getdevices", getDeviceList, false, false)); tempDef.addSubCommand(new chatCommandDef("setdevice", setDevice, false, false)); m_BotBrain.addChatCommand(tempDef); m_OutputEvent = new WaveOutEvent(); } }
public trivia(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { m_Throttler = new throttler(aJerpBot); m_Throttler.waitTimeMax = 120000; m_Throttler.lineCountReductionMax = 15; m_Throttler.lineCountReduction = 4000; m_LoadSuccessful = load(); m_Scores = new Dictionary <userEntry, int>(); m_Questions = new List <triviaQuestion>(); chatCommandDef tempDef = new chatCommandDef("trivia", null, true, true); tempDef.addSubCommand(new chatCommandDef("start", start, false, false)); tempDef.addSubCommand(new chatCommandDef("stop", stop, true, false)); tempDef.addSubCommand(new chatCommandDef("scores", scores, true, true)); tempDef.addSubCommand(new chatCommandDef("topics", topics, true, true)); tempDef.addSubCommand(new chatCommandDef("setmax", setMaxQuestions, true, true)); tempDef.addSubCommand(new chatCommandDef("reload", reload, false, false)); tempDef.useGlobalCooldown = false; m_BotBrain.addChatCommand(tempDef); }
public pollManager(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { m_Throttler = new throttler(aJerpBot); m_Throttler.waitTimeMax = 30000; m_Throttler.lineCountMinimum = 8; userChoices = new Dictionary <userEntry, int>(); chatCommandDef tempDef = new chatCommandDef("poll", null, false, false); tempDef.addSubCommand(new chatCommandDef("open", open, true, false)); tempDef.addSubCommand(new chatCommandDef("close", close, true, false)); tempDef.addSubCommand(new chatCommandDef("about", about, true, true)); tempDef.addSubCommand(new chatCommandDef("describe", describe, true, false)); tempDef.addSubCommand(new chatCommandDef("count", count, true, false)); tempDef.addSubCommand(new chatCommandDef("results", results, true, false)); tempDef.addSubCommand(new chatCommandDef("choices", choices, true, false)); m_BotBrain.addChatCommand(tempDef); tempDef = new chatCommandDef("vote", vote, true, true); tempDef.useGlobalCooldown = false; m_BotBrain.addChatCommand(tempDef); }
public bool attemptRemoveRequest(jerpBot aBotBrain, out bool aExisted) { aExisted = false; if (updateInfoTask(aBotBrain)) { try { Task removeRewardTask = aBotBrain.twitchAPI.Helix.ChannelPoints.DeleteCustomRewardAsync(aBotBrain.ownerID, rewardID); removeRewardTask.Wait(); aExisted = true; rewardID = null; return(true); // Successfully removed } catch (Exception e) { Console.WriteLine(string.Format("Exception when trying to remove channel point reward named: \"{0}\": {1}", title, e.Message)); return(false); } } Console.WriteLine("Unable to find ID for and thus remove reward named: " + title); return(false); }
public streamProfiles(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { string configPath = System.IO.Path.Combine(jerpBot.storagePath, "config\\jerpdoesbots_streamprofiles.json"); if (File.Exists(configPath)) { string configFileString = File.ReadAllText(configPath); if (!string.IsNullOrEmpty(configFileString)) { configData = new JavaScriptSerializer().Deserialize <streamProfilesConfig>(configFileString); loaded = true; } } if (loaded) { chatCommandDef tempDef = new chatCommandDef("profile", null, false, false); tempDef.addSubCommand(new chatCommandDef("apply", applyProfile, false, false)); tempDef.addSubCommand(new chatCommandDef("setrewards", applyRewardGroup, false, false)); m_BotBrain.addChatCommand(tempDef); } }
public commandModule(jerpBot aJerpBot) : base(aJerpBot, true, true, false) { formatHint = m_BotBrain.localizer.getString("commandFormatHint"); // TODO: Add ability to list out commands. }
/// <summary>All times are in Milliseconds</summary> public throttler(jerpBot aBotBrain) { m_BotBrain = aBotBrain; }