Last active
June 22, 2018 18:42
-
-
Save mpociot/2bc86b74317afea06b030dd047fe629e to your computer and use it in GitHub Desktop.
Simple BotMan middleware to limit the bot, so that it only responds to certain allowed users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usage example | |
$botman = BotManFactory::create($config); | |
// Apply middleware | |
$botman->middleware(Authorization::create([ | |
'user_1', | |
'user_2' | |
])); | |
// give the bot something to listen for. | |
$botman->hears('hello', function (BotMan $bot, $message) { | |
$bot->reply('Hello yourself.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not work in case of fallback. Am I right ?
Ps:
I'm on V2.0
$botman->middleware->matching($authMiddleware);
public function matching(IncomingMessage $message, $pattern, $regexMatched) ;