added .togethertube command, #586

This commit is contained in:
Kwoth 2016-10-24 14:17:17 +02:00
parent 29b06567bd
commit ee4d17c3d0
3 changed files with 54 additions and 0 deletions

View File

@ -5,6 +5,7 @@ using NadekoBot.Attributes;
using NadekoBot.Extensions; using NadekoBot.Extensions;
using System; using System;
using System.Linq; using System.Linq;
using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -12,6 +13,23 @@ namespace NadekoBot.Modules.Utility
{ {
partial class Utility : DiscordModule 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] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task ServerInfo(IUserMessage msg, string guild = null) public async Task ServerInfo(IUserMessage msg, string guild = null)

View File

@ -6350,6 +6350,33 @@ namespace NadekoBot.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to togethertube totube.
/// </summary>
public static string togethertube_cmd {
get {
return ResourceManager.GetString("togethertube_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Creates a new room on &lt;https://togethertube.com&gt; and shows the link in the chat..
/// </summary>
public static string togethertube_desc {
get {
return ResourceManager.GetString("togethertube_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}totube`.
/// </summary>
public static string togethertube_usage {
get {
return ResourceManager.GetString("togethertube_usage", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to tq. /// Looks up a localized string similar to tq.
/// </summary> /// </summary>

View File

@ -2511,4 +2511,13 @@
<data name="xkcd_usage" xml:space="preserve"> <data name="xkcd_usage" xml:space="preserve">
<value>`{0}xkcd` or `{0}xkcd 1400` or `{0}xkcd latest`</value> <value>`{0}xkcd` or `{0}xkcd 1400` or `{0}xkcd latest`</value>
</data> </data>
<data name="togethertube_cmd" xml:space="preserve">
<value>togethertube totube</value>
</data>
<data name="togethertube_desc" xml:space="preserve">
<value>Creates a new room on &lt;https://togethertube.com&gt; and shows the link in the chat.</value>
</data>
<data name="togethertube_usage" xml:space="preserve">
<value>`{0}totube`</value>
</data>
</root> </root>