Random number and random answer
This commit is contained in:
parent
0d8571509e
commit
4b521a5689
@ -122,17 +122,21 @@ namespace NadekoBot.Modules.Conversations
|
|||||||
c.Parameter("args", ParameterType.Unparsed);
|
c.Parameter("args", ParameterType.Unparsed);
|
||||||
c.Do(async e =>
|
c.Do(async e =>
|
||||||
{
|
{
|
||||||
var str = command.Value;
|
Random range = new Random();
|
||||||
|
|
||||||
|
var str = command.Value[range.Next(0, command.Value.Count())];
|
||||||
str = str.Replace("%user%", e.User.Mention);
|
str = str.Replace("%user%", e.User.Mention);
|
||||||
|
str = str.Replace("%rng%", "" + range.Next());
|
||||||
if (str.Contains("%target%"))
|
if (str.Contains("%target%"))
|
||||||
{
|
{
|
||||||
var args = e.GetArg("args");
|
var args = e.GetArg("args");
|
||||||
if (string.IsNullOrWhiteSpace(args)) args = string.Empty;
|
if (string.IsNullOrWhiteSpace(args)) args = string.Empty;
|
||||||
str = str.Replace("%target%", e.GetArg("args"));
|
str = str.Replace("%target%", e.GetArg("args"));
|
||||||
}
|
}
|
||||||
|
|
||||||
await e.Channel.SendMessage(str);
|
await e.Channel.SendMessage(str);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
manager.CreateCommands(NadekoBot.BotMention, cgb =>
|
manager.CreateCommands(NadekoBot.BotMention, cgb =>
|
||||||
|
Loading…
Reference in New Issue
Block a user