private async void button9_Click(object sender, EventArgs e) { try { TwitchLib.TwitchAPIClasses.Channel channel = await TwitchApi.GetTwitchChannel(textBox9.Text); MessageBox.Show(String.Format("Status: {0}\nBroadcaster Lang: {1}\nDisplay Name: {2}\nGame: {3}\nLanguage: {4}\nName: {5}\nCreated At: {6}\n" + "Updated At: {7}\nDelay: {8}\nLogo: {9}\nBackground: {10}\nProfile Banner: {11}\nMature: {12}\nPartner: {13}\nID: {14}\nViews: {15}\nFollowers: {16}", channel.Status, channel.BroadcasterLanguage, channel.DisplayName, channel.Game, channel.Language, channel.Name, channel.CreatedAt, channel.UpdatedAt, channel.Delay, channel.Logo, channel.Background, channel.ProfileBanner, channel.Mature, channel.Partner, channel.Id, channel.Views, channel.Followers)); } catch (TwitchLib.Exceptions.InvalidChannelException) { MessageBox.Show(string.Format("The channel '{0}' is not a valid channel!", textBox9.Text)); } }
private static async Task ShowChannelDetails(string channelName) { // Sicherstellen, dass die clientId gesetzt ist. Ohne läuft die TwitchAPI nicht! TwitchApi.SetClientId(clientId); Console.WriteLine("ShowChannelDetails: Hole Informationen über den Channel: " + channelName); // Asynchron die Anfrage absetzten und auf Antwort warten. Channel channel = await TwitchApi.GetTwitchChannel(channelName); Console.WriteLine("\nShowChannelDetails: Informationen über den Channel: " + channelName); Console.WriteLine("DisplayName: " + channel.DisplayName); Console.WriteLine("Spiel: " + channel.Game); Console.WriteLine("Background: " + channel.Background); Console.WriteLine("Follower: " + channel.Followers); Console.WriteLine("Logo: " + channel.Logo); }
private async void DashboardRefreshTimer_Tick(object sender, EventArgs e) { //MessageBox.Show( //delay, uptime, averagefps, broadcaster language filter, broadcaste check box StreamGame.Text = (await TwitchApi.GetTwitchChannel(channel)).Game; StreamTitle.Text = (await TwitchApi.GetTwitchChannel(channel)).Status; string langCode = (await TwitchApi.GetTwitchChannel(channel)).BroadcasterLanguage; StreamLanguage.SelectedValue = langCode; if (await TwitchApi.BroadcasterOnline(channel) != false) { StreamViewers.Text = (await TwitchApi.GetTwitchStream(channel)).Viewers.ToString(); } else { StreamViewers.Text = "Stream Offline"; } StreamFollowers.Text = (await TwitchApi.GetTwitchChannel(channel)).Followers.ToString(); }
private void TwitchCheck(object state) { Printer.PrintTag("TwitchCheck", "Checking for online streams."); var previousStreams = new List <string>(Lists.OnlineStreams); Lists.OnlineStreams.Clear(); try { foreach (var stream in Lists.TwitchStreams) { if (TwitchApi.BroadcasterOnline(stream).Result) { Lists.OnlineStreams.Add(stream); } } foreach (var stream in Lists.OnlineStreams) { if (previousStreams.Count == 0) { Printer.PrintTag("TwitchCheck", stream + " is online!"); Channels.TwitchChannel.SendMessage(stream + " is now online, playing " + TwitchApi.GetTwitchChannel(stream).Result.Game + "! http://www.twitch.tv/" + stream); } else { if (!previousStreams.Contains(stream)) { Printer.PrintTag("TwitchCheck", stream + " is online!"); Channels.TwitchChannel.SendMessage(stream + " is now online, playing " + TwitchApi.GetTwitchChannel(stream).Result.Game + "! " + TwitchApi.GetTwitchChannel(stream).Result.Status + " http://www.twitch.tv/" + stream); } } } } catch (Exception ex) { Printer.PrintTag("Exception", ex.Message); } }