コード例 #1
0
        public void Run()
        {
            Thread[] ircThreads = null;
            rooms = null;

            var bots = SqlTwitchBot.GetAll();
            foreach(var bot in bots) {
                var connections = SqlTwitchConnection.GetAllAutoConnectingConnections(bot);
                if(connections != null && connections.Length > 0) {
                    var chatConnection = new TwitchIrcConnection(bot, false);
                    var whisperConnection = new TwitchIrcConnection(bot, true);

                    foreach(var connection in connections) {
                        var room = new TwitchChatRoom(chatConnection, whisperConnection, connection);
                        rooms = rooms.Append(room);
                    }

                    ircThreads = ircThreads.Append(new[] {
                        new Thread(whisperConnection.Run),
                        new Thread(chatConnection.Run)
                        });
                }
            }

            ircThreads.Run();
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
0
        public TwitchChatRoom(ITwitchFactory factory, TwitchIrcConnection chatConnection,
			 TwitchIrcConnection whisperConnection, TwitchConnection twitchConnection)
        {
            this.factory = factory;
            this.chatIrcConnection = chatConnection;
            this.whisperIrcConnection = whisperConnection;
            this.twitchConnection = twitchConnection;
            this.pointManager = new ChannelPointManager(factory, twitchConnection.channel);

            chatConnection.Join(this);

            TypeHelpers.InstantiateEachSubclass<IAutoJoinTwitchRooms, TwitchChatRoom>(this);
        }