示例#1
0
        public async Task InitializeAsync()
        {
            if (settings.Twitch.EnableChatBot)
            {
                client.Initialize(credentials, settings.Twitch.Channel);
                client.OnLog             += Client_OnLog;
                client.OnMessageReceived += Client_OnMessageReceived;
                client.OnConnected       += Client_OnConnected;
                client.OnDisconnected    += Client_OnDisconnected;
                client.OnConnectionError += Client_OnConnectionError;
                client.Connect();
            }

            if (settings.Twitch.EnablePubSub)
            {
                string channelId = await GetChannelId();

                pubSub.ListenToRewards(channelId);

                pubSub.OnRewardRedeemed         += PubSub_OnRewardRedeemed;
                pubSub.OnLog                    += PubSub_OnLog;
                pubSub.OnPubSubServiceConnected += PubSub_OnPubSubServiceConnected;
                pubSub.OnPubSubServiceError     += PubSub_OnPubSubServiceError;
                pubSub.OnPubSubServiceClosed    += PubSub_OnPubSubServiceClosed;

                pubSub.Connect();
            }
        }
示例#2
0
 private void ListenToRewards(string channelId)
 {
     PubSub.OnRewardRedeemed      += PubSub_OnRewardRedeemed;
     PubSub.OnCustomRewardCreated += PubSub_OnCustomRewardCreated;
     PubSub.OnCustomRewardDeleted += PubSub_OnCustomRewardDeleted;
     PubSub.OnCustomRewardUpdated += PubSub_OnCustomRewardUpdated;
     PubSub.ListenToRewards(channelId);
 }