コード例 #1
0
ファイル: TwitchBot.cs プロジェクト: Solferrun/RazBot2
        public static void Start()
        {
            Client.Initialize(Credentials);

            Client.OnConnected     += Client_OnConnected;
            Client.OnDisconnected  += Client_OnDisconnected;
            Client.OnJoinedChannel += Client_OnJoinedChannel;
            Client.OnLeftChannel   += Client_OnLeftChannel;

            Client.OnMessageReceived    += Client_OnMessageReceived;
            Client.OnWhisperReceived    += Client_OnWhisperReceived;
            Client.OnModeratorsReceived += Client_OnModeratorsReceived;

            PubSub.OnPubSubServiceConnected += Pubsub_OnPubSubServiceConnected;
            PubSub.OnListenResponse         += PubSub_OnListenResponse;
            PubSub.OnStreamUp   += PubSub_OnStreamUp;
            PubSub.OnStreamDown += PubSub_OnStreamDown;
            PubSub.ListenToVideoPlayback("maerictv");

            Client.OnHostingStarted   += Client_OnHostingStarted;
            Client.OnHostingStopped   += Client_OnHostingStopped;
            Client.OnBeingHosted      += Client_OnBeingHosted;
            Client.OnRaidNotification += Client_OnRaidNotification;

            Client.OnNewSubscriber         += Client_OnNewSubscriber;
            Client.OnReSubscriber          += Client_OnReSubscriber;
            Client.OnCommunitySubscription += Client_OnCommunitySubscription;
            Client.OnGiftedSubscription    += Client_OnGiftedSubscription;

            for (int i = 0; i < 99; i++)
            {
                try
                {
                    Client.Connect();
                    PubSub.Connect();
                }
                catch (Exception e)
                {
                    BotTools.LogToSessionLogFile(e.ToString());
                }
            }

            StreamStatus = GetStreamOnline() ? StreamState.Online : StreamState.Offline;
        }