Api class
You can use an Api class to send a message to another users and more
Why do you need an Api class?
If you want to send a message to another user, call api method for a different bot, or get data from the api reference, you can use Api class methods
Get Api class in controller
To get Api class in controller, use @GetApi
property decorator, and Api class as type
.send Api method take arguments:
User ID or channel ID (string or number)
Required
Message you want to send (you can use MessageSend class too)
Required
Keyboard
Optional
If you want to get a bot token, you can get it via .token
api property
Api methods
You can use any method from the Answer class in the Api class
If Api method takes chat id or message id, you need to pass it as 1st and 2nd arguments
Get Api for different token
If you want to call some api method for different bot, use bot.to
method
bot.to method takes argument: token you want to get api
Last updated