internal async Task TwitchInfo(CommandContext ctx) { bool isStreaming = await TwitchApi.V5.Streams.BroadcasterOnlineAsync("109598326"); var subs = WebCalls.GetRootObject(); var channel = await TwitchApi.V5.Channels.GetChannelByIDAsync("109598326"); var embed = new DiscordEmbedBuilder { Author = new DiscordEmbedBuilder.EmbedAuthor { Name = channel.DisplayName, IconUrl = channel.Logo }, Color = DiscordColor.Purple, Title = channel.DisplayName + "'s Channel", Url = channel.Url, ImageUrl = channel.ProfileBanner, ThumbnailUrl = channel.Logo, }; embed.AddField("Streaming Live?: ", isStreaming.ToString(), true); embed.AddField("Followers: ", channel.Followers.ToString(), true); embed.AddField("Subscribers: ", (subs.data.Count - 1).ToString(), true); embed.AddField("Views: ", channel.Views.ToString(), true); embed.AddField("Rated Mature?: ", channel.Mature.ToString(), true); embed.AddField("Streamer Type: ", channel.BroadcasterType, true); embed.AddField("Is Partnered?: ", channel.Partner.ToString(), true); embed.AddField("Channel Created: ", channel.CreatedAt.ToShortDateString(), true); await ctx.RespondAsync("\n", embed : embed); }
internal async Task InvoiceOnNowhosting(CommandContext ctx) { try { var subs = WebCalls.GetRootObject(); Console.WriteLine(subs.data.Count); await ctx.RespondAsync("Subscribers: " + (subs.data.Count - 1)); await ctx.RespondAsync("Invoked"); } catch (Exception e) { await ctx.RespondAsync(e.Message); } }
public async void OnStreamOffline(object sender, OnStreamOfflineArgs e) { var subs = WebCalls.GetRootObject(); List <string> gameIds = new List <string> { e.Stream.GameId }; var games = await TwitchApi.Helix.Games.GetGamesAsync(gameIds); var channel = await TwitchApi.V5.Channels.GetChannelByIDAsync("109598326"); Console.WriteLine(e.Stream.ThumbnailUrl); var embed = new DiscordEmbedBuilder { Author = new DiscordEmbedBuilder.EmbedAuthor { Name = channel.DisplayName, IconUrl = channel.Logo }, Color = DiscordColor.Purple, Title = e.Channel + " is now offline! :(", Url = "https://www.twitch.tv/phenomalytv", ImageUrl = "https://static-cdn.jtvnw.net/previews-ttv/live_user_phenomalytv-320x180.jpg", ThumbnailUrl = channel.Logo, }; embed.AddField("Stream Title: ", e.Stream.Title); embed.AddField("Viewers: ", e.Stream.ViewerCount.ToString(), true); embed.AddField("Subscriptions: ", (subs.data.Count - 1).ToString(), true); embed.AddField("Game: ", games.Games[0].Name, true); embed.AddField("Time started [GMT]: ", e.Stream.StartedAt.ToShortTimeString(), true); embed.AddField("Followers: ", channel.Followers.ToString(), true); embed.AddField("Rated Mature?: ", channel.Mature.ToString(), true); embed.AddField("Language: ", e.Stream.Language, true); var chan = await TwitchBotMain.discord.GetChannelAsync(552255972060692504); await chan.SendMessageAsync(" " + e.Channel + " is now offline :(!"); await chan.SendMessageAsync("\n", embed : embed); }
internal async Task SubsList(CommandContext ctx) { try { var subs = WebCalls.GetRootObject(); var channel = await TwitchApi.V5.Channels.GetChannelByIDAsync("109598326"); var embed = new DiscordEmbedBuilder { Author = new DiscordEmbedBuilder.EmbedAuthor { Name = channel.DisplayName + " Subscriber List", IconUrl = channel.Logo }, Color = DiscordColor.Purple, Title = channel.DisplayName + "'s Subscriber List", Url = channel.Url, ThumbnailUrl = "https://cdn.twitchalerts.com/twitch-bits/images/hd/100000.gif", }; for (int i = 0; i < subs.data.Count; i++) { if (i == 0) { continue; } embed.AddField(subs.data[i].user_name, "Plan Name: " + subs.data[i].plan_name, true); } await ctx.RespondAsync("\n", embed : embed); } catch (Exception e) { await ctx.RespondAsync(e.Message); } }