Example #1
0
        /// <summary>
        /// Setup TwitchClient
        /// </summary>
        private void SetupTwitch()
        {
            // TwitchApi
            TwitchAPI.Settings.AccessToken = OAuthKey;
            TwitchAPI.Settings.ClientId    = ClientID;

            // TwitchClient
            var TwitchCredentials = new TwitchLib.Models.Client.ConnectionCredentials(Username, OAuthKey);

            AivaTwitchClient = new TwitchClient(
                TwitchCredentials,
                null,
                Convert.ToChar(Config.Config.Instance["General"]["CommandIdentifier"]),
                '@',
                true,  // Loggin
                true); // ReListen when error occurs

            AivaTwitchClient = Client.Tasks.Tasks.SetClientTasks(AivaTwitchClient);

            AivaTwitchClient.OnConnected     += OnConnected;
            AivaTwitchClient.OnJoinedChannel += OnJoinedChannel;

            AivaTwitchClient.Connect();

            DoValidation();
        }
Example #2
0
        private void SetupTwitch()
        {
            // TwitchApi
            TwitchApi = new TwitchAPI(Config.Config.Instance.Storage.Credentials.TwitchClientID,
                                      Config.Config.Instance.Storage.Credentials.TwitchOAuth);

            // TwitchClient
            var TwitchCredentials = new TwitchLib.Models.Client.ConnectionCredentials(BotName,
                                                                                      Config.Config.Instance.Storage.Credentials.TwitchOAuth);

            TwitchClient = new TwitchClient(
                credentials: TwitchCredentials,
                channel: null,
                chatCommandIdentifier: Convert.ToChar(Config.Config.Instance.Storage.General.CommandIdentifier),
                whisperCommandIdentifier: '@',
                logging: false,
                logger: null,
                autoReListenOnExceptions: true);

            Tasks.SetTasks(ref TwitchClient);
            Events.SetEvents(ref TwitchClient);

            TwitchClient.OnConnected     += OnConnected;
            TwitchClient.OnJoinedChannel += OnJoinedChannel;

            TwitchClient.Connect();

            GetChannelId();
        }
Example #3
0
        private void btnGo_Click(object sender, EventArgs e)
        {
            string strChannel = this.txtChannel.Text.ToLower();

            try
            {
                TwitchLib.Models.Client.ConnectionCredentials objConnectionCredentials = new TwitchLib.Models.Client.ConnectionCredentials(strUser, "oauth:" + strToken);
                this.objTwitchClient = new TwitchClient(objConnectionCredentials, strChannel);
                this.objTwitchClient.OnMessageReceived += objTwitchClient_OnMessageReceived;
                this.objTwitchClient.Connect();
            }
            catch (Exception ex)
            {
                this.txtOuput.Text += ex.Message;
            }
        }