poshbotio / PoshBot

Powershell-based bot framework
MIT License
537 stars 108 forks source link

Pasted messages from Teams add prepended Line Breaks '\r\n' #109

Closed AndrewPla closed 5 years ago

AndrewPla commented 6 years ago

If you paste a command into Teams and send it to poshbot it adds some whitespace "\r\n" to the command.

Expected Behavior

Paste "!Get-Something" into Teams and send to poshbot. PoshBot will recognize that it begins with '!' and will interpret it as a bot command.

Current Behavior

Paste "!Get-Something" into Teams and send to poshbot. PoshBot interprets the command as beginning with \r\n rather than '!' so it wouldn't be detected as a bot command.

Possible Solution

I think that we should use the parsed command to determine if it starts with an approved prefix or not. $parsedCommand = [CommandParser]::Parse($Message) This returns the actual beginning of the command and removes the \r\n.

Your Environment