irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.04k stars 671 forks source link

how create my command ? #1055

Closed irpcpro closed 1 year ago

irpcpro commented 1 year ago

PHP version

8.1 irazasyed/telegram-bot-sdk version

3.10 Laravel version (if any)

10

hi. i search in issues and read the document. but still i'm confused how should i create my command?

irazasyed commented 1 year ago

Read instructions here: https://telegram-bot-sdk.com/docs/guides/commands-system

irpcpro commented 1 year ago

thanks .. but i've just checked it. in this document says handle method has a input variable named $arguments but when i used it, IDE got me an error which says : Declaration must be compatible with Command->handle() after i checked it, I found that in abstract class Telegram\Bot\Commands\Command handler method, it doesn't have any input variable. and i get this error : Declaration of Vendor\App\Commands\StartCommand::handle($arguments) must be compatible with Telegram\Bot\Commands\Command::handle()

I think there is a conflict with version 3 and its document.

irpcpro commented 1 year ago

i think in vendor/irazasyed/telegram-bot-sdk/src/Commands/Command.php@make we have to pass $update to handle method. when i did that, i got the correct variable in handler method command which was my input data from telegram.