Fix exception on every non-command incoming message

This commit is contained in:
Noi 2020-05-22 00:26:55 -07:00
parent 9278ef0a48
commit a91e22ca71

View file

@ -106,7 +106,7 @@ namespace BirthdayBot
// For all cases: base command, 2 parameters. // For all cases: base command, 2 parameters.
// Except this case: "bb.config", subcommand name, subcommand parameters in a single string // Except this case: "bb.config", subcommand name, subcommand parameters in a single string
var csplit = msg.Content.Split(" ", 3, StringSplitOptions.RemoveEmptyEntries); var csplit = msg.Content.Split(" ", 3, StringSplitOptions.RemoveEmptyEntries);
if (csplit.Length > 0) if (csplit.Length > 0 && csplit[0].StartsWith(CommandPrefix, StringComparison.OrdinalIgnoreCase))
{ {
var channel = (SocketTextChannel)msg.Channel; var channel = (SocketTextChannel)msg.Channel;
var author = (SocketGuildUser)msg.Author; var author = (SocketGuildUser)msg.Author;