From b8cc2eb20f6cc9b36cb4052e6ce9618e176d37c9 Mon Sep 17 00:00:00 2001 From: RogueException Date: Wed, 18 May 2016 19:27:49 -0300 Subject: [PATCH] Added commands triggering on nickname mentions --- src/Discord.Net.Commands/CommandService.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index 1baa04270..4b3a67edf 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -112,6 +112,19 @@ namespace Discord.Commands if (msg.StartsWith(mention) && msg.Length > mention.Length) cmdMsg = msg.Substring(mention.Length + 1); } + + string mention2 = client.CurrentUser.NicknameMention; + if (mention2 != null) + { + if (msg.StartsWith(mention2) && msg.Length > mention2.Length) + cmdMsg = msg.Substring(mention2.Length + 1); + else + { + mention2 = $"@{client.CurrentUser.Name}"; + if (msg.StartsWith(mention2) && msg.Length > mention2.Length) + cmdMsg = msg.Substring(mention2.Length + 1); + } + } } //Check using custom activator