Error message when mashape isn't specified

This commit is contained in:
Kwoth 2016-11-08 22:05:04 +01:00
parent 6350efd7f9
commit c6bab91c40

View File

@ -206,9 +206,16 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var arg = name; var arg = name;
if (string.IsNullOrWhiteSpace(arg)) if (string.IsNullOrWhiteSpace(arg))
{ {
await channel.SendMessageAsync("💢 Please enter a card name to search for.").ConfigureAwait(false); await channel.SendMessageAsync("💢 `Please enter a card name to search for.`").ConfigureAwait(false);
return; return;
} }
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.MashapeKey))
{
await channel.SendMessageAsync("💢 `Bot owner didn't specify MashapeApiKey. You can't use this functionality.`").ConfigureAwait(false);
return;
}
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
string response = ""; string response = "";
using (var http = new HttpClient()) using (var http = new HttpClient())
@ -256,10 +263,16 @@ $@"🌍 **Weather for** 【{obj["target"]}】
{ {
var channel = (ITextChannel)umsg.Channel; 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; var arg = query;
if (string.IsNullOrWhiteSpace(arg)) if (string.IsNullOrWhiteSpace(arg))
{ {
await channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false); await channel.SendMessageAsync("💢 `Please enter a search term.`").ConfigureAwait(false);
return; return;
} }
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
@ -293,9 +306,15 @@ $@"🌍 **Weather for** 【{obj["target"]}】
var arg = query; var arg = query;
if (string.IsNullOrWhiteSpace(arg)) if (string.IsNullOrWhiteSpace(arg))
{ {
await channel.SendMessageAsync("💢 Please enter a search term.").ConfigureAwait(false); await channel.SendMessageAsync("💢 `Please enter a search term.`").ConfigureAwait(false);
return; return;
} }
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.MashapeKey))
{
await channel.SendMessageAsync("💢 `Bot owner didn't specify MashapeApiKey. You can't use this functionality.`").ConfigureAwait(false);
return;
}
await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false); await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);
string res = ""; string res = "";
using (var http = new HttpClient()) using (var http = new HttpClient())