Fixed a couple substring bugs in commandservice
This commit is contained in:
@@ -87,9 +87,9 @@ namespace Discord.Commands
|
|||||||
if (cmdMsg == null && Config.AllowMentionPrefix)
|
if (cmdMsg == null && Config.AllowMentionPrefix)
|
||||||
{
|
{
|
||||||
if (msg.StartsWith(e.Server.CurrentUser.Mention))
|
if (msg.StartsWith(e.Server.CurrentUser.Mention))
|
||||||
cmdMsg = msg.Substring(e.Server.CurrentUser.Mention.Length);
|
cmdMsg = msg.Substring(e.Server.CurrentUser.Mention.Length + 1);
|
||||||
else if (msg.StartsWith($"@{client.CurrentUser.Name}"))
|
else if (msg.StartsWith($"@{client.CurrentUser.Name}"))
|
||||||
cmdMsg = msg.Substring(client.CurrentUser.Name.Length);
|
cmdMsg = msg.Substring(client.CurrentUser.Name.Length + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check using custom activator
|
//Check using custom activator
|
||||||
@@ -105,7 +105,7 @@ namespace Discord.Commands
|
|||||||
//Parse command
|
//Parse command
|
||||||
IEnumerable<Command> commands;
|
IEnumerable<Command> commands;
|
||||||
int argPos;
|
int argPos;
|
||||||
CommandParser.ParseCommand(msg, _map, out commands, out argPos);
|
CommandParser.ParseCommand(cmdMsg, _map, out commands, out argPos);
|
||||||
if (commands == null)
|
if (commands == null)
|
||||||
{
|
{
|
||||||
CommandEventArgs errorArgs = new CommandEventArgs(e.Message, null, null);
|
CommandEventArgs errorArgs = new CommandEventArgs(e.Message, null, null);
|
||||||
@@ -118,7 +118,7 @@ namespace Discord.Commands
|
|||||||
{
|
{
|
||||||
//Parse arguments
|
//Parse arguments
|
||||||
string[] args;
|
string[] args;
|
||||||
var error = CommandParser.ParseArgs(msg, argPos, command, out args);
|
var error = CommandParser.ParseArgs(cmdMsg, argPos, command, out args);
|
||||||
if (error != null)
|
if (error != null)
|
||||||
{
|
{
|
||||||
if (error == CommandErrorType.BadArgCount)
|
if (error == CommandErrorType.BadArgCount)
|
||||||
|
|||||||
Reference in New Issue
Block a user