From c51d41d40f1e8a1c5da6cea9633fe9397da5c861 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 13 May 2016 19:30:11 +0200 Subject: [PATCH] minor changes --- .../CustomReactions/CustomReactions.cs | 25 ++++++++++++------- NadekoBot/Modules/Gambling/GamblingModule.cs | 3 ++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/NadekoBot/Modules/CustomReactions/CustomReactions.cs index 9d9c8c6a..39d59efd 100644 --- a/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -12,6 +12,21 @@ namespace NadekoBot.Modules.CustomReactions { public override string Prefix { get; } = ""; + Random rng = new Random(); + + private Dictionary> commandFuncs; + + public CustomReactionsModule() + { + commandFuncs = new Dictionary> + { + {"%rng%", (e) => rng.Next().ToString()}, + {"%mention%", (e) => NadekoBot.BotMention }, + {"%user%", e => e.User.Mention }, + {"%target%", e => e.GetArg("args")?.Trim() ?? "" }, + }; + } + public override void Install(ModuleManager manager) { @@ -19,14 +34,6 @@ namespace NadekoBot.Modules.CustomReactions { cgb.AddCheck(PermissionChecker.Instance); - Random range = new Random(); - Dictionary> commandFuncs = new Dictionary> - { - {"%rng%", (e) => range.Next().ToString()}, - {"%mention%", (e) => NadekoBot.BotMention }, - {"%user%", e => e.User.Mention }, - {"%target%", e => e.GetArg("args")?.Trim() ?? "" }, - }; foreach (var command in NadekoBot.Config.CustomReactions) { @@ -39,7 +46,7 @@ namespace NadekoBot.Modules.CustomReactions .Parameter("args", ParameterType.Unparsed) .Do(async e => { - string str = command.Value[range.Next(0, command.Value.Count())]; + string str = command.Value[rng.Next(0, command.Value.Count())]; commandFuncs.Keys.ForEach(k => str = str.Replace(k, commandFuncs[k](e))); await e.Channel.SendMessage(str).ConfigureAwait(false); }); diff --git a/NadekoBot/Modules/Gambling/GamblingModule.cs b/NadekoBot/Modules/Gambling/GamblingModule.cs index 9660e209..ef49e6dc 100644 --- a/NadekoBot/Modules/Gambling/GamblingModule.cs +++ b/NadekoBot/Modules/Gambling/GamblingModule.cs @@ -50,7 +50,8 @@ namespace NadekoBot.Modules.Gambling }); cgb.CreateCommand(Prefix + "$$") - .Description(string.Format("Check how much {0}s you have.", NadekoBot.Config.CurrencyName)) + .Description(string.Format("Check how much {0}s a person has. (Defaults to yourself)\n**Usage**:`{1}$$` or `{1}$$ @Someone`", + NadekoBot.Config.CurrencyName, Prefix)) .Parameter("all", ParameterType.Unparsed) .Do(async e => {