예제 #1
0
        private async void button10_Click(object sender, EventArgs e)
        {
            List <TwitchLib.TwitchAPIClasses.Chatter> chatters = await TwitchApi.GetChatters(textBox10.Text);

            string messageContents = "";

            foreach (TwitchLib.TwitchAPIClasses.Chatter user in chatters)
            {
                if (messageContents == "")
                {
                    messageContents = String.Format("{0} ({1})", user.Username, user.UserType.ToString());
                }
                else
                {
                    messageContents += String.Format(", {0} ({1})", user.Username, user.UserType.ToString());
                }
            }
            MessageBox.Show(messageContents);
        }
예제 #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);
        }
예제 #3
0
 public async Task <HttpResponseMessage> GetChatters()
 {
     return(await TwitchApi.GetChatters(_botConfig.TwitchClientId));
 }