zarincheg / telegram-bot-dialogs

The extension for Telegram Bot API PHP SDK that allows to implement dialogs in bots
MIT License
40 stars 27 forks source link

Standalone mode #7

Closed typhoon1978 closed 7 years ago

typhoon1978 commented 7 years ago

Hi,

how to use telegram-bot-dialogs in standalone mode without Laravel? Is it possible?

2017-02-04T12:09:03.112966+00:00 app[web.1]: [04-Feb-2017 12:09:03 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function HelloCommand::__construct(), 0 passed in /app/vendor/irazasyed/telegram-bot-sdk/src/Commands/CommandBus.php on line 86 and exactly 1 expected in /app/HelloCommand.php:20

so that I can add command in this way:

$telegram->addCommands([
   HelloCommand::class
]);
$update = $telegram->commandsHandler(true);

Thanks in advance, Alex

typhoon1978 commented 7 years ago

Sorry I think it's duplicated

zarincheg commented 7 years ago

@typhoon1978 In last few commits I reduced Laravel dependencies. But it still depends on Redis facade. Also, compatibility with Laravel could be broken. I'll test it and fix if needed.

This thread related to #5 and #6 . So I closed that issues and will report here about the topic.

zarincheg commented 7 years ago

You could test the latest version (master branch) for standalone usage. Dependencies was deleted (replaced for Redis to use predis package directly). Also I pushed simple example (just for tests): https://github.com/zarincheg/example-bot