internal void SendChat(SqlTwitchConnection twitchConnection, string message) { SendIrcMessage(":" + bot.user.userName + "!" + bot.user.userName + "@" + bot.user.userName + ".tmi.twitch.tv PRIVMSG #" + twitchConnection.channel.user.userName + " :" + message); }
internal static void UpdateLiveFollowers(SqlTwitchConnection connection, uint limit, uint offset) { string json = GetLiveFollowersJson(connection, limit, offset); SqlTwitchChannel[] liveChannels = TwitchJson.ParseStreams(json); if (liveChannels.Length >= limit) { Log.info("Live Followers, requesting another page..."); UpdateLiveFollowers(connection, 100, offset + (uint)liveChannels.Length); } }
public static void RefreshAllFollowers(SqlTwitchConnection connection) { try { if(refreshAllFollowersThrottle.ExecuteIfReady(connection.channel.user.id)) { SqlTwitchFollower.ClearAll(connection.channel); TwitchApi.UpdateNewFollowers(connection, 100, 0, true); } } catch(Exception e) { Log.exception(e); } }
public TwitchChatRoom(TwitchIrcConnection chatConnection, TwitchIrcConnection whisperConnection, SqlTwitchConnection twitchConnection) { this.chatIrcConnection = chatConnection; this.whisperIrcConnection = whisperConnection; this.twitchConnection = twitchConnection; this.pointManager = new ChannelPointManager(twitchConnection.channel); chatConnection.Join(this); commandControllers = GetType().InstantiateEachSubclass<TwitchCommandController, TwitchChatRoom>(false, this); }
public TwitchChatRoom(TwitchIrcConnection chatConnection, TwitchIrcConnection whisperConnection, SqlTwitchConnection twitchConnection) { this.chatIrcConnection = chatConnection; this.whisperIrcConnection = whisperConnection; this.twitchConnection = twitchConnection; this.pointManager = new ChannelPointManager(twitchConnection.channel); chatConnection.Join(this); GetType().InstantiateEachSubclassInMyAssembly<IAutoJoinTwitchRooms, TwitchChatRoom>(false, this); }
public static SqlTwitchChannel[] GetLiveFollowers(SqlTwitchConnection connection) { try { if(liveFollowersThrottle.ExecuteIfReady(connection.channel.user.id)) { SqlTwitchChannel.ClearLiveFollowers(connection.channel); TwitchApi.UpdateLiveFollowers(connection, 25, 0); } return SqlTwitchChannel.GetAllLiveFollowers(connection.channel); } catch(Exception e) { Log.error("Twitch live followers", e); return null; } }
internal static void UpdateNewFollowers(SqlTwitchConnection connection, uint limit, uint offset, bool forceNextPage = false) { string json = GetFollowerJson(connection, limit, offset); SqlTwitchFollower[] followers = TwitchJson.ParseFollowers(json); if (followers != null && followers.Length > 0) { bool nextPage = forceNextPage; foreach (SqlTwitchFollower follower in followers) { follower.Save(false); nextPage = nextPage || follower.HasChangedDb; } if (nextPage) { Log.info("Followers, requesting another page..."); UpdateNewFollowers(connection, 100, offset + (uint)followers.Length, forceNextPage); } } }
static string GetLiveFollowersJson(SqlTwitchConnection connection, uint limit, uint offset) { SqlTwitchFollower[] followers = SqlTwitchFollower.GetAllWithUsernames(connection.channel); return GetJson(connection.bot, limit, offset, "streams/?channel=" + TwitchHelpers.GetAllAsCsv(followers)); }
static string GetFollowerJson(SqlTwitchConnection connection, uint limit, uint offset) { return GetJson(connection.bot, limit, offset, "channels/" + connection.channel.user.userName + "/follows?"); }
public TwitchAlert CreateSqlTwitchAlert(SqlTwitchConnection connection, string alertGuid, DateTime lastFollowerNotification = default(DateTime)) { return new SqlTwitchAlert(connection, alertGuid, lastFollowerNotification); }