예제 #1
0
        private async void button50_Click(object sender, EventArgs e)
        {
            var games = await TwitchApi.GetGamesByPopularity();

            foreach (var game in games)
            {
                MessageBox.Show($"Game: {game.Game.Name}\nViewer Count: {game.Viewers}\nChannel Count: {game.Channels}");
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: vpsnak/SnakBot
        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);
        }