コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: TwitchApi.cs プロジェクト: BobAlmighty/HardlyBot
        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);
            }
        }
コード例 #3
0
ファイル: Twitch.cs プロジェクト: 1amnick/HardlyBot
 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);
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: Twitch.cs プロジェクト: 1amnick/HardlyBot
 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;
     }
 }
コード例 #7
0
ファイル: TwitchApi.cs プロジェクト: BobAlmighty/HardlyBot
        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);
                }
            }
        }
コード例 #8
0
ファイル: TwitchApi.cs プロジェクト: BobAlmighty/HardlyBot
 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));
 }
コード例 #9
0
ファイル: TwitchApi.cs プロジェクト: BobAlmighty/HardlyBot
 static string GetFollowerJson(SqlTwitchConnection connection, uint limit, uint offset)
 {
     return GetJson(connection.bot, limit, offset, "channels/" + connection.channel.user.userName + "/follows?");
 }
コード例 #10
0
 public TwitchAlert CreateSqlTwitchAlert(SqlTwitchConnection connection, string alertGuid, DateTime lastFollowerNotification = default(DateTime))
 {
     return new SqlTwitchAlert(connection, alertGuid, lastFollowerNotification);
 }