From fbd32a679728fef0752393214654da80713be65a Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 5 Feb 2017 19:47:36 +0100 Subject: [PATCH] disabled %rnduser% completely due to performance issues --- .../Modules/CustomReactions/Extensions.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/NadekoBot/Modules/CustomReactions/Extensions.cs b/src/NadekoBot/Modules/CustomReactions/Extensions.cs index ff20fa89..a0b91962 100644 --- a/src/NadekoBot/Modules/CustomReactions/Extensions.cs +++ b/src/NadekoBot/Modules/CustomReactions/Extensions.cs @@ -23,17 +23,24 @@ namespace NadekoBot.Modules.CustomReactions {"%mention%", (ctx) => { return $"<@{NadekoBot.Client.CurrentUser.Id}>"; } }, {"%user%", (ctx) => { return ctx.Author.Mention; } }, {"%rnduser%", (ctx) => { - var ch = ctx.Channel as ITextChannel; - if(ch == null) - return ""; + //var ch = ctx.Channel as ITextChannel; + //if(ch == null) + // return ""; - var g = ch.Guild as SocketGuild; - if(g == null) - return ""; + //var g = ch.Guild as SocketGuild; + //if(g == null) + // return ""; + //try { + // var usr = g.Users.Skip(new NadekoRandom().Next(0, g.Users.Count)).FirstOrDefault(); + // return usr.Mention; + //} + //catch { + return "[%rnduser% is temp. disabled]"; + //} - var users = g.Users.ToArray(); + //var users = g.Users.ToArray(); - return users[new NadekoRandom().Next(0, users.Length-1)].Mention; + //return users[new NadekoRandom().Next(0, users.Length-1)].Mention; } } //{"%rng%", (ctx) => { return new NadekoRandom().Next(0,10).ToString(); } } };