Add check for bot messages.

Added a check so bot messages do not trigger any commands involuntariy.
This commit is contained in:
Rithari
2018-10-12 22:19:03 +02:00
committed by Monica S
parent 8df2c1a1fb
commit f3b9f35899

View File

@@ -35,9 +35,10 @@ public class CommandHandler
// Create a number to track where the prefix ends and the command begins
int argPos = 0;
// Determine if the message is a command based on the prefix
// Determine if the message is a command based on the prefix and make sure no bots trigger commands
if (!(message.HasCharPrefix('!', ref argPos) ||
message.HasMentionPrefix(_client.CurrentUser, ref argPos)))
message.HasMentionPrefix(_client.CurrentUser, ref argPos)) ||
message.Author.IsBot)
return;
// Create a WebSocket-based command context based on the message
@@ -60,4 +61,4 @@ public class CommandHandler
// if (!result.IsSuccess)
// await context.Channel.SendMessageAsync(result.ErrorReason);
}
}
}