diff --git a/PoshBot/Classes/Bot.ps1 b/PoshBot/Classes/Bot.ps1 index 36425ef9..00115a9c 100644 --- a/PoshBot/Classes/Bot.ps1 +++ b/PoshBot/Classes/Bot.ps1 @@ -288,10 +288,10 @@ class Bot : BaseLogger { # Determine if message text is addressing the bot and should be # treated as a bot command - [bool]IsBotCommand([Message]$Message) { - $firstWord = ($Message.Text -split ' ')[0] + [bool]IsBotCommand([Message]$Message) { + $parsedCommand = [CommandParser]::Parse($Message) foreach ($prefix in $this._PossibleCommandPrefixes ) { - if ($firstWord -match "^$prefix") { + if ($parsedCommand.command -match "^$prefix") { $this.LogDebug('Message is a bot command') return $true }