.prefix bugfix, #1524

This commit is contained in:
Master Kwoth 2017-08-22 05:47:57 +02:00
parent 919c81d385
commit e5609a0708

View File

@ -43,6 +43,7 @@ namespace NadekoBot.Services
public event Func<IUserMessage, CommandInfo, Task> CommandExecuted = delegate { return Task.CompletedTask; };
public event Func<CommandInfo, ITextChannel, string, Task> CommandErrored = delegate { return Task.CompletedTask; };
public event Func<IUserMessage, Task> OnMessageNoTrigger = delegate { return Task.CompletedTask; };
//userid/msg count
public ConcurrentDictionary<ulong, uint> UserMessagesSent { get; } = new ConcurrentDictionary<ulong, uint>();
@ -261,7 +262,7 @@ namespace NadekoBot.Services
}
}
var prefix = GetPrefix(guild?.Id);
var isPrefixCommand = messageContent == ".prefix";
var isPrefixCommand = messageContent.StartsWith(".prefix");
// execute the command and measure the time it took
if (messageContent.StartsWith(prefix) || isPrefixCommand)
{
@ -280,7 +281,10 @@ namespace NadekoBot.Services
if (guild != null)
await CommandErrored(result.Info, channel as ITextChannel, result.Error);
}
}
else
{
await OnMessageNoTrigger(usrMsg).ConfigureAwait(false);
}
foreach (var svc in _services)