From ee4d17c3d024557eec27364771a1df2e7d576226 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 24 Oct 2016 14:17:17 +0200 Subject: [PATCH] added .togethertube command, #586 --- .../Modules/Utility/Commands/InfoCommands.cs | 18 +++++++++++++ .../Resources/CommandStrings.Designer.cs | 27 +++++++++++++++++++ src/NadekoBot/Resources/CommandStrings.resx | 9 +++++++ 3 files changed, 54 insertions(+) diff --git a/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs b/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs index 5f65fa64..3304a28b 100644 --- a/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs @@ -5,6 +5,7 @@ using NadekoBot.Attributes; using NadekoBot.Extensions; using System; using System.Linq; +using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -12,6 +13,23 @@ namespace NadekoBot.Modules.Utility { partial class Utility : DiscordModule { + [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.SendMessageAsync($"{imsg.Author.Mention}, `Here is the link:` {target}") + .ConfigureAwait(false); + } + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task ServerInfo(IUserMessage msg, string guild = null) diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index d85adb73..16a386c7 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -6350,6 +6350,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to togethertube totube. + /// + public static string togethertube_cmd { + get { + return ResourceManager.GetString("togethertube_cmd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creates a new room on <https://togethertube.com> and shows the link in the chat.. + /// + public static string togethertube_desc { + get { + return ResourceManager.GetString("togethertube_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `{0}totube`. + /// + public static string togethertube_usage { + get { + return ResourceManager.GetString("togethertube_usage", resourceCulture); + } + } + /// /// Looks up a localized string similar to tq. /// diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 0bd6477a..652f489f 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -2511,4 +2511,13 @@ `{0}xkcd` or `{0}xkcd 1400` or `{0}xkcd latest` + + togethertube totube + + + Creates a new room on <https://togethertube.com> and shows the link in the chat. + + + `{0}totube` + \ No newline at end of file