poshbotio / PoshBot

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

Teams CommandPrefix set to "*" not working #163

Closed delrio1110 closed 5 years ago

delrio1110 commented 5 years ago

Expected Behavior

@Poshbot Status

This should show the staus of posh bot in Teams

Current Behavior

@Poshbot Status Unable to match parsed command [:status] to a plugin command","Data":{}}

Possible Solution

In poshbot 11.0 I was able to set the CommandPrefix to "" and it would accept anything after I called the bot in MS Team. Now in 11.2 -11.5 "" doesnt work. Now I have to use @Poshbot *status. Is there a way to have it like 11.0 when sending command?

Steps to Reproduce (for bugs)

  1. In poshbot 11.2 and up for Teams backend. Set CommandPrefix to "*"

Your Environment

PS 5.1 Poshbot 11.5

devblackops commented 5 years ago

Oh, sorry for the breaking change @delrio1110! I honestly never tried having an empty string for the command prefix. I'll see if I can track down what caused the behavior change.

delrio1110 commented 5 years ago

@devblackops was it this ?

https://github.com/poshbotio/PoshBot/issues/124

devblackops commented 5 years ago

@delrio1110 Ya, that was probably it.

devblackops commented 5 years ago

Hey @delrio1110.

I'd rather not hijack the asterisks * for this functionality as right now it's perfectly valid for a user to choose that character as the prefix if they wish. Using it for this purpose would break their setup. Instead I've added support for $null prefixes in commit f214e1577b301f1bef8af8d752de73c84bcb6fcd.

Can you try the the latest version in master and let me know?

Keep in mind, as the prefix character is intended to tell PoshBot that the message it received is a bot command and attempt to match the message to registered commands, allowing a $null prefix only makes sense with backends that require you to @mention the bot (Teams). We can assume all messages PoshBot receives from said backends are intended as commands (because you mentioned the bot). You wouldn't want to configure a $null prefix with the Slack backend as that would cause PoshBot to try and interpret every message users typed.

Let me know if these works for your usecase and I'll close the PR you created.

delrio1110 commented 5 years ago

That worked perfectly, Thank you @devblackops