Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Command("twitchvids")]
- public async Task twitchvidAsync(string username)
- {
- using (var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }))
- {
- string websiteurl = $"https://api.twitch.tv/kraken/channels/{username}/videos?client_id=g8vz0dctlo417o6dz3gvol1ssws1ih";
- client.BaseAddress = new Uri(websiteurl);
- HttpResponseMessage response = client.GetAsync("").Result;
- response.EnsureSuccessStatusCode();
- string result = await response.Content.ReadAsStringAsync();
- var json = JObject.Parse(result);
- var video = json["videos"][0]["url"].ToString();
- var video1 = json["videos"][1]["url"].ToString();
- await Context.Channel.SendMessageAsync($"{video1}");
- //JUST IGNORE THIS
- /*
- var embed = new EmbedBuilder();
- embed.WithTitle($"{name}'s info")
- .WithDescription($"**Username:** {name}"
- + "\n" +
- $"**Bio:** {bio}"
- + "\n" +
- $"**Created at:** {created_at}"
- + "\n" +
- $"**Last updated at:** {updated_at}")
- .WithThumbnailUrl($"{logo}")
- .WithColor(Color.Gold);
- await ReplyAsync("", false, embed.Build());
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement