コード例 #1
0
ファイル: Program.cs プロジェクト: RivenSenpai/TwitchBot
        static void Main(string[] args)
        {
            IrcBot irc = new IrcBot("irc.twitch.tv", 6667,
                "bauwsdebug", "oauth:20m91p9usq6l1yoi528dtrqfygxmhd");

            #region ConnectionStatusText
            Console.WriteLine("Connected to Twitch servers...");
            Console.WriteLine("Logging into account...");
            #endregion

            irc.joinRoom("bauwsdebug");
            Console.WriteLine("Joining channel: " + "BauwsDebug...");
            while (true)
            {
                string message = irc.readMessage();
                #region Commands
                ///this is where commands go
                #region Command: !test
                ///see this command as an example of how this works
                if (message.Contains("!test"))
                {
                    irc.sendChatMessage("Testing requested.");
                    Console.WriteLine("Command executed: " + "Testing Requested.");
                    ///TODO find out how to add who triggered the event and then add it to the end
                    ///Console.WriteLine("!test used by " + userName);
                }
                #endregion
                #endregion
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IrcBot irc = new IrcBot("irc.twitch.tv", 6667,
                                    "bauwsbot", "oauth:yk1erggcp1egwf527jrwouu7molbp1");

            irc.joinRoom("bauwsbot");
            while (true)
            {
                string message = irc.readMessage();
                if (message.Contains("!test"))
                {
                    irc.sendChatMessage("Testing requested.");
                }
            }
        }
コード例 #3
0
        ///connection information
        public TwitchChatConnection(TwitchBot bot, bool whisperServer)
        {
            this._bot = bot;
            string ircServer = "irc.twitch.tv";
            ///public ip of the server
            if(whisperServer)
            {
                ircServer = "199.9.253.119";
                ///actual ip of the server
            }

            this._ircBot = new IrcBot(ircServer, 6667, bot.user.username, bot.oauthPassword);

            if(whisperServer)
            {
                //fix this
                ircClient.WriteLine("CAP REQ :twitch.tv/commands");
                ///send this to the server to ensure that you can receive whispers on the IRC
            }
        }