From 937f775db4d547627b3bef0e6afdb44a2320a439 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sat, 24 Dec 2016 08:05:43 +0100 Subject: [PATCH] together tube readded --- src/NadekoBot/Modules/Utility/Utility.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index e4e2fe31..a61d6f69 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -15,6 +15,7 @@ using Discord.API; using Embed = Discord.API.Embed; using EmbedAuthor = Discord.API.EmbedAuthor; using EmbedField = Discord.API.EmbedField; +using System.Net.Http; namespace NadekoBot.Modules.Utility { @@ -27,6 +28,27 @@ namespace NadekoBot.Modules.Utility } + [NadekoCommand, Usage, Description, Aliases] + [RequireContext(ContextType.Guild)] + public async Task TogetherTube(IUserMessage imsg) + { + var channel = (ITextChannel)imsg.Channel; + + Uri target; + using (var http = new HttpClient()) + { + var res = await http.GetAsync("https://togethertube.com/room/create").ConfigureAwait(false); + target = res.RequestMessage.RequestUri; + } + + await channel.EmbedAsync(new EmbedBuilder().WithOkColor() + .WithAuthor(eab => eab.WithIconUrl("https://togethertube.com/assets/img/favicons/favicon-32x32.png") + .WithName("Together Tube") + .WithUrl("https://togethertube.com/")) + .WithDescription($"{imsg.Author.Mention} Here is your room link:\n{target}") + .Build()); + } + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task WhosPlaying(IUserMessage umsg, [Remainder] string game = null)