This commit is contained in:
Kwoth 2016-12-04 05:57:53 +01:00
commit 2d17f4476d
8 changed files with 115 additions and 17 deletions

View File

@ -88,16 +88,35 @@ namespace NadekoBot.Modules.Help
if (com == null) if (com == null)
{ {
await channel.SendMessageAsync("🔍 **I can't find that command.**"); //await channel.SendMessageAsync("🔍 **I can't find that command.**");
var erro = new EmbedBuilder()
.WithAuthor(eau => eau.WithName("Sorry!")
.WithUrl("http://nadekobot.readthedocs.io/en/latest/Commands%20List/")
.WithIconUrl(NadekoBot.Client.GetCurrentUser().AvatarUrl))
//.WithTitle("Sorry!")
.WithDescription("I can't find that command. Please check the **command** and **command prefix** before trying again.")
.WithColor(NadekoBot.ErrorColor);
await channel.EmbedAsync(erro.Build());
return; return;
} }
var str = $"**__Help for:__ `{com.Text}`**"; var str = $"{com.Text}";
var alias = com.Aliases.Skip(1).FirstOrDefault(); var alias = com.Aliases.Skip(1).FirstOrDefault();
if (alias != null) if (alias != null)
str += $" / `{alias}`"; str += $" / `{alias}`";
var embed = new EmbedBuilder()
.WithAuthor(eau => eau.WithName("Help")
.WithUrl("http://nadekobot.readthedocs.io/en/latest/Commands%20List/")
.WithIconUrl(NadekoBot.Client.GetCurrentUser().AvatarUrl))
//.WithTitle(str)
//.WithDescription($"{ string.Format(com.Summary, com.Module.Prefix)}{ GetCommandRequirements(com)}")
.AddField(fb => fb.WithIndex(1).WithName("**Command**").WithValue(str).WithIsInline(true))
.AddField(fb => fb.WithIndex(2).WithName("**Usage**").WithValue($"{string.Format(com.Remarks, com.Module.Prefix)}").WithIsInline(true))
.AddField(fb => fb.WithIndex(3).WithName("Description").WithValue($"{ string.Format(com.Summary, com.Module.Prefix)}{ GetCommandRequirements(com)}").WithIsInline(false))
.WithColor(NadekoBot.OkColor);
if (com != null) if (com != null)
await channel.SendMessageAsync(str + $@"{Environment.NewLine}**Desc:** {string.Format(com.Summary, com.Module.Prefix)} {GetCommandRequirements(com)} await channel.EmbedAsync(embed.Build()).ConfigureAwait(false);
**Usage:** {string.Format(com.Remarks, com.Module.Prefix)}").ConfigureAwait(false); //await channel.SendMessageAsync(str + $@"{Environment.NewLine}**Desc:** {string.Format(com.Summary, com.Module.Prefix)} {GetCommandRequirements(com)}
//**Usage:** {string.Format(com.Remarks, com.Module.Prefix)}").ConfigureAwait(false);
} }
private string GetCommandRequirements(Command cmd) private string GetCommandRequirements(Command cmd)

View File

@ -303,10 +303,10 @@ namespace NadekoBot.Modules.Searches
} }
if (!removed) if (!removed)
{ {
await channel.SendMessageAsync(":anger: No such stream.").ConfigureAwait(false); await channel.SendMessageAsync(" No such stream.").ConfigureAwait(false);
return; return;
} }
await channel.SendMessageAsync($":ok: Removed `{username}`'s stream ({type}) from notifications.").ConfigureAwait(false); await channel.SendMessageAsync($"🗑 Removed `{username}`'s stream ({type}) from notifications.").ConfigureAwait(false);
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
@ -358,7 +358,7 @@ namespace NadekoBot.Modules.Searches
} }
catch catch
{ {
await channel.SendMessageAsync(":anger: Stream probably doesn't exist.").ConfigureAwait(false); await channel.SendMessageAsync("💢 Stream probably doesn't exist.").ConfigureAwait(false);
return; return;
} }
@ -370,7 +370,7 @@ namespace NadekoBot.Modules.Searches
await uow.CompleteAsync().ConfigureAwait(false); await uow.CompleteAsync().ConfigureAwait(false);
} }
var msg = $":ok: I will notify this channel when status changes."; var msg = $"🆗 I will notify this channel when status changes.";
await channel.EmbedAsync(fs.GetEmbed(status).Build(), msg).ConfigureAwait(false); await channel.EmbedAsync(fs.GetEmbed(status).Build(), msg).ConfigureAwait(false);
} }
} }
@ -407,4 +407,4 @@ namespace NadekoBot.Modules.Searches
return "??"; return "??";
} }
} }
} }

View File

@ -48,9 +48,9 @@ namespace NadekoBot.Modules.Searches
.AddField(fb => fb.WithName("📏 Lat,Long").WithValue($"{obj["latitude"]}, {obj["longitude"]}").WithIsInline(true)) .AddField(fb => fb.WithName("📏 Lat,Long").WithValue($"{obj["latitude"]}, {obj["longitude"]}").WithIsInline(true))
.AddField(fb => fb.WithName("☁ Condition").WithValue($"{obj["condition"]}").WithIsInline(true)) .AddField(fb => fb.WithName("☁ Condition").WithValue($"{obj["condition"]}").WithIsInline(true))
.AddField(fb => fb.WithName("😓 Humidity").WithValue($"{obj["humidity"]}%").WithIsInline(true)) .AddField(fb => fb.WithName("😓 Humidity").WithValue($"{obj["humidity"]}%").WithIsInline(true))
.AddField(fb => fb.WithName("💨 Wind Speed").WithValue($"{obj["windspeedk"]}km/h / {obj["windspeedm"]}mph").WithIsInline(true)) .AddField(fb => fb.WithName("💨 Wind Speed").WithValue($"{obj["windspeedk"]}km/h ({obj["windspeedm"]}mph)").WithIsInline(true))
.AddField(fb => fb.WithName("🌡 Temperature").WithValue($"{obj["centigrade"]}°C / {obj["fahrenheit"]}°F").WithIsInline(true)) .AddField(fb => fb.WithName("🌡 Temperature").WithValue($"{obj["centigrade"]}°C ({obj["fahrenheit"]}°F)").WithIsInline(true))
.AddField(fb => fb.WithName("🔆 Feels like").WithValue($"{obj["feelscentigrade"]}°C / {obj["feelsfahrenheit"]}°F").WithIsInline(true)) .AddField(fb => fb.WithName("🔆 Feels like").WithValue($"{obj["feelscentigrade"]}°C ({obj["feelsfahrenheit"]}°F)").WithIsInline(true))
.AddField(fb => fb.WithName("🌄 Sunrise").WithValue($"{obj["sunrise"]}").WithIsInline(true)) .AddField(fb => fb.WithName("🌄 Sunrise").WithValue($"{obj["sunrise"]}").WithIsInline(true))
.AddField(fb => fb.WithName("🌇 Sunset").WithValue($"{obj["sunset"]}").WithIsInline(true)) .AddField(fb => fb.WithName("🌇 Sunset").WithValue($"{obj["sunset"]}").WithIsInline(true))
.WithColor(NadekoBot.OkColor); .WithColor(NadekoBot.OkColor);
@ -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)

View File

@ -222,7 +222,7 @@ namespace NadekoBot.Modules.Utility
}, },
}, },
Color = NadekoBot.OkColor Color = 0x00bbd6
}); });
} }
@ -293,4 +293,3 @@ namespace NadekoBot.Modules.Utility
//} //}
} }
} }

View File

@ -24,8 +24,8 @@ namespace NadekoBot
{ {
private Logger _log; private Logger _log;
public static uint OkColor { get; } = 0x00ff00; public static uint OkColor { get; } = 0x71cd40;
public static uint ErrorColor { get; } = 0xff0000; public static uint ErrorColor { get; } = 0xee281f;
public static CommandService CommandService { get; private set; } public static CommandService CommandService { get; private set; }
public static CommandHandler CommandHandler { get; private set; } public static CommandHandler CommandHandler { get; private set; }

View File

@ -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>

View File

@ -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>

View File

@ -95,4 +95,4 @@ Messages: {MessageCounter} [{MessagesPerSecond:F2}/sec] Heap: [{Heap} MB]";
return $"{time.Days} days{separator}{time.Hours} hours{separator}{time.Minutes} minutes"; return $"{time.Days} days{separator}{time.Hours} hours{separator}{time.Minutes} minutes";
} }
} }
} }