Beispiel #1
0
        static void Main()
        {
            // Initialize the database
            DatabaseHandler handler = new DatabaseHandler();

            // Set up the chat server and whisper server, using the authentication fields
            // TwitchChatConnection oldServerConnection = new TwitchChatConnection(new IrcClient(IRC_SERVER, PORT, RECONNECT_TIME, BOTNAME, OAUTH_TOKEN), false);
            TwitchChatConnection ircServerConnection = new TwitchChatConnection(new IrcClient(IRC_SERVER, PORT, RECONNECT_TIME, BOTNAME, OAUTH_TOKEN), false);


            // Create a list of channels from all the rows in the CHANNELS table, as well as the bot itself,
            // then create a connection to the chat server and whisper connection
            channels = new List <Channel>();
            channels.Add(new Channel(BOTNAME));
            channels.AddRange(DatabaseHandler.GetChannelList());
            foreach (Channel channel in channels)
            {
                // new TwitchChatRoom(oldServerConnection, whisperConnection, channel);
                new TwitchChatRoom(ircServerConnection, ircServerConnection, channel);
            }

            // Start the pulling in data from the chat server and whisper server streams
            // (if you want to added a second, third, fourth etc. bot, double up on these threads)
            // new Thread(new ThreadStart(oldServerConnection.Run)).Start();
            new Thread(new ThreadStart(ircServerConnection.Run)).Start();
            //new Thread(new ThreadStart(whisperConnection.Run)).Start();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            nutbotty = new NutBotty();
            Application.Run(nutbotty);
        }
Beispiel #2
0
        public TwitchChatRoom(TwitchChatConnection chatConnection, TwitchChatConnection whisperConnection, Channel channel)
        {
            this.chatConnection    = chatConnection;
            this.whisperConnection = whisperConnection;
            this.channel           = channel;

            chatConnection.join(this);
        }