コード例 #1
0
ファイル: Maoubot.cs プロジェクト: imthe666st/TwitchSharp
        /// <summary>
        /// Connects the bot with the specified settings.
        /// What else?
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (Tcb == null)
            {
                CreateTwitchChatBot();
            }

            if (!Tcb.Active)
            {
                SaveTwitchConfig();

                Tcb.SetNick(ConfigFile.Nick);
                Tcb.SetOAuth(ConfigFile.oAuth);

                // Add the account
                AddAccount();

                Tcb.Run();
            }
            else
            {
                Tcb.JoinChannel(textBoxChannel.Text);
            }

            textBoxNickname.Enabled = false;
            textBoxOAuth.Enabled    = false;
            textBoxChannel.Enabled  = false;

            comboBoxAccounts.Enabled = false;

            buttonAccountsLoad.Enabled   = false;
            buttonAccountsDelete.Enabled = false;

            buttonConnect.Enabled = false;
        }
コード例 #2
0
ファイル: Maoubot.cs プロジェクト: imthe666st/TwitchSharp
        /// <summary>
        /// Creates the TCB object and adds events
        /// </summary>
        private void CreateTwitchChatBot()
        {
            this.Tcb = new TwitchChatBot();
            this.Tcb.LoginCompleted += (s, e) =>
            {
                Tcb.ReceiveWhispers();
                Tcb.JoinChannel(ConfigFile.Channel);
            };

            this.Tcb.MessageReceived += Tcb_MessageReceived;
            this.Tcb.CommandExecute  += Tcb_CommandExecute;

            this.Tcb.Verbose = IsInDebugMode;
        }