Helpful error, forgot random.

This commit is contained in:
Master Kwoth 2016-02-05 08:06:10 +01:00
parent 861a587212
commit 7a95e14eae
2 changed files with 25 additions and 1 deletions

View File

@ -377,7 +377,27 @@ namespace NadekoBot.Modules {
}
await e.Send(await usr.AvatarUrl.ShortenUrl());
});
/*
string saved = "";
cgb.CreateCommand("save")
.Description("Saves up to 5 last messages as a quote")
.Parameter("number", ParameterType.Required)
.Do(e => {
var arg = e.GetArg("number");
int num;
if (!int.TryParse(arg, out num) || num < 1 || num > 5)
num = 1;
saved = string.Join("\n", e.Channel.Messages.Skip(1).Take(num));
});
cgb.CreateCommand("quote")
.Description("Shows the previously saved quote")
.Parameter("arg", ParameterType.Required)
.Do(async e => {
var arg = e.GetArg("arg");
await e.Send("```"+saved+"```");
});
*/
//TODO add eval
/*
cgb.CreateCommand(">")

View File

@ -148,7 +148,10 @@ namespace NadekoBot.Modules {
.Parameter("name", ParameterType.Unparsed)
.Do(async e => {
var arg = e.GetArg("name");
if (string.IsNullOrWhiteSpace(arg)) return;
if (string.IsNullOrWhiteSpace(arg)) {
await e.Send(":anger: Please enter a card name to search for.");
return;
}
var res = await GetResponseAsync($"https://omgvamp-hearthstone-v1.p.mashape.com/cards/search/{Uri.EscapeUriString(arg)}",
new Tuple<string, string>[] {
new Tuple<string, string>("X-Mashape-Key", NadekoBot.creds.MashapeKey),
@ -159,6 +162,7 @@ namespace NadekoBot.Modules {
if (items == null)
throw new KeyNotFoundException("Cannot find a card by that name");
int cnt = 0;
items.Shuffle();
foreach (var item in items) {
if (cnt >= 4)
break;