commit
11fe94c26c
@ -313,6 +313,50 @@ namespace NadekoBot.Modules.Searches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
public async Task Yodify(IUserMessage umsg, [Remainder] string query = null)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.MashapeKey))
|
||||||
|
{
|
||||||
|
await channel.SendMessageAsync("💢 `Bot owner didn't specify MashapeApiKey. You can't use this functionality.`").ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var arg = query;
|
||||||
|
if (string.IsNullOrWhiteSpace(arg))
|
||||||
|
{
|
||||||
|
await channel.SendMessageAsync("💢 `Please enter a sentence.`").ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
|
||||||
|
using (var http = new HttpClient())
|
||||||
|
{
|
||||||
|
http.DefaultRequestHeaders.Clear();
|
||||||
|
http.DefaultRequestHeaders.Add("X-Mashape-Key", NadekoBot.Credentials.MashapeKey);
|
||||||
|
http.DefaultRequestHeaders.Add("Accept", "text/plain");
|
||||||
|
var res = await http.GetStringAsync($"https://yoda.p.mashape.com/yoda?sentence={Uri.EscapeUriString(arg)}").ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var embed = new EmbedBuilder()
|
||||||
|
.WithTitle("Young Padawan")
|
||||||
|
.WithUrl("http://www.yodaspeak.co.uk/")
|
||||||
|
.WithAuthor(au => au.WithName("Yoda").WithIconUrl("http://www.yodaspeak.co.uk/yoda-small1.gif"))
|
||||||
|
.WithDescription("Seek advice, you must!")
|
||||||
|
.WithThumbnail(th => th.WithUrl("http://i.imgur.com/62Uh4u6.jpg"))
|
||||||
|
.AddField(fb => fb.WithName($"🌍 **{umsg.Author.Username}**").WithValue($"{res.ToString()}").WithIsInline(false))
|
||||||
|
.WithColor(NadekoBot.OkColor);
|
||||||
|
await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await channel.SendMessageAsync("💢 Failed to yodify your sentence.").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task UrbanDict(IUserMessage umsg, [Remainder] string query = null)
|
public async Task UrbanDict(IUserMessage umsg, [Remainder] string query = null)
|
||||||
|
@ -293,4 +293,3 @@ namespace NadekoBot.Modules.Utility
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -7781,6 +7781,33 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to yodify yoda.
|
||||||
|
/// </summary>
|
||||||
|
public static string yodify_cmd {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("yodify_cmd", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Translates your normal sentences into Yoda styled sentences!.
|
||||||
|
/// </summary>
|
||||||
|
public static string yodify_desc {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("yodify_desc", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to {0}yodify I was once an adventurer like you` or `{0}yoda my feelings hurt`.
|
||||||
|
/// </summary>
|
||||||
|
public static string yodify_usage {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("yodify_usage", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to yomama ym.
|
/// Looks up a localized string similar to yomama ym.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2709,4 +2709,13 @@
|
|||||||
<data name="magicthegathering_usage" xml:space="preserve">
|
<data name="magicthegathering_usage" xml:space="preserve">
|
||||||
<value>`{0}magicthegathering about face` or `{0}mtg about face`</value>
|
<value>`{0}magicthegathering about face` or `{0}mtg about face`</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="yodify_cmd" xml:space="preserve">
|
||||||
|
<value>yodify yoda</value>
|
||||||
|
</data>
|
||||||
|
<data name="yodify_desc" xml:space="preserve">
|
||||||
|
<value>Translates your normal sentences into Yoda styled sentences!</value>
|
||||||
|
</data>
|
||||||
|
<data name="yodify_usage" xml:space="preserve">
|
||||||
|
<value>{0}yodify I was once an adventurer like you` or `{0}yoda my feelings hurt`</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue
Block a user