/* * Chat Events: * OnIncorrectLogin - Fires when an invalid login is returned by Twitch * OnConnected - Fires on listening and after joined channel, returns username and channel * OnDisconnected - Fires when TwitchClient disconnects. * OnMessageReceived - Fires when new chat message arrives, returns ChatMessage * OnNewSubscriber - Fires when new subscriber is announced in chat, returns Subscriber * OnReSubscriber - Fires when existing subscriber resubscribes, returns ReSubscriber * OnChannelStateChanged - Fires when channel state is changed * -OnViewerJoined - New viewer/chatter joined the chat channel room. * -OnViewerLeft - Viewer/chatter left (PARTed) the chat channel. * OnChatCommandReceived - Fires when command (uses custom command identifier) is received. * OnMessageSent - Fires when a chat message is sent. * OnUserStateChanged - Fires when a user state is received. * OnModeratorJoined - Fires when a moderator joins chat (not necessarily real time) * OnModeratorLeft - Fires when a moderator leaves chat (not necessarily real time) * OnHostLeft - Fires when a hosted channel goes offline * OnExistingUsersDetected - Fires when list of users message is received from Twitch (generally when entering the room) * OnHostingStarted - Fires when someone begins hosting the channel the client is connected to. * OnHostingStopped - Fires when someone that is hosting channel that client is connected to, stops. * OnChatCleared - Fires when a moderator sends a clear chat command (channel). * OnViewerTimedout - Fires when client detects a viewer was timedout (moderator, viewer, timeout duration, timeout reason, channel). * OnViewerBanned - Fires when client detects a viewer was banned (moderator, viewer, ban reason, channel). * -OnModeratorsReceived - Fires when a list of moderators is returned by Twitch (this happens by calling GetChannelModerators in the client). * OnChatColorChanged - Fires when confirmation is received from Twitch that chat color has been successfully changed. * * Whisper Events: * OnWhisperReceived - Fires when a new whisper message is received, returns WhisperMessage * OnWhisperCommandReceived - Fires when command (uses custom command identifier) is received. * OnWhisperSent - Fires when a whisper is sent. * * irc debug * client.OnReadLineTest("entire IRC string goes here"); * https://github.com/swiftyspiffy/TwitchLib */ private void LiveViewersUpdate() { dbData.db.conn.Open(); Chat.Text += "Viewlist update...\n"; pointSys.gainPoints(dbData.viewerDictionary); //dbData.DisplayViewers(ViewerListView); ViewerListView.Refresh(); dbData.db.conn.Close(); }
private async void SnakBot_Load(object sender, EventArgs e) { client.OnConnected += clientConnected; client.OnJoinedChannel += clientJoinedChannel; client.OnMessageReceived += clientOnMessageRecieved; client.OnViewerJoined += clientViewerJoined; client.OnViewerLeft += clientViewerLeft; client.OnModeratorsReceived += clientModeratorsRecieved; client.Connect(); TwitchApi.SetClientId(clientID); TwitchApi.SetAccessToken(accessToken); string usersTable = "CREATE TABLE IF NOT EXISTS [users] ([name] CHARACTER(25) NOT NULL PRIMARY KEY,[rank] CHARACTER(25) default UNRANKED,[points] DOUBLE default 0,[hours] INT default 0);"; string ranksTable = "CREATE TABLE IF NOT EXISTS [ranks] ([name] CHARACTER(25) NOT NULL PRIMARY KEY,[pointsReq] DOUBLE default 0,[hoursReq] INT default 0);"; StreamLanguage.DataSource = new BindingSource(Languages, null); StreamLanguage.DisplayMember = "lang"; StreamLanguage.ValueMember = "langCode"; dbData.db.conn.Open(); dbData.db.runSQL(usersTable + ranksTable); dbData.LoadRanks(); refreshModerators(); dbData.LoadViewers(await TwitchApi.GetChatters(channel)); ViewerListView.Refresh(); LiveViewerSearch.AutoCompleteCustomSource.AddRange(dbData.viewerDictionary.Keys.ToArray()); List <GameByPopularityListing> popularGames = await TwitchApi.GetGamesByPopularity(30); StreamGame.AutoCompleteCustomSource.AddRange(popularGames.Select(game => game.Game.Name).ToArray()); ViewerListView.VirtualListSize = dbData.viewerDictionary.Count(); dbData.DisplayRanks(RankListView); dbData.db.conn.Close(); LiveViewersTimer.Start(); //pointSys.refreshRank(dbData.FindViewer("vpsnak"), dbData.rankList); DashboardRefreshTimer_Tick(null, null); }