Module telegram-bot-lua
telegram-bot-lua - a feature-filled telegram bot API library.
supports bot API 9.6 with full method coverage, middleware, async polling, MCP server, adapters, and backward-compatible v2 shims.
Info:
- Copyright: 2017-2026
- License: GPL-3
- Author: Matthew Hesketh
Functions
| api.close() | close the bot instance before moving it to a local server. |
| api.configure(token, debug) | configure the bot with a token and optional debug mode. |
| api.get_me() | get basic information about the bot via getMe. |
| api.log_out() | log the bot out from the cloud bot API server. |
| api.request(endpoint, parameters, file) | send a request to the telegram bot API. |
Functions
- api.close()
-
close the bot instance before moving it to a local server.
Returns:
- table|false true on success, or false on failure
- string|table the HTTP status or error details
- api.configure(token, debug)
-
configure the bot with a token and optional debug mode.
connects to the telegram API and retrieves bot info via getMe.
Parameters:
- token string the bot API token from @BotFather
- debug boolean enable debug logging of requests
Returns:
-
table the api object, configured and ready to use
- api.get_me()
-
get basic information about the bot via getMe.
Returns:
- table|false the bot user object, or false on failure
- string|table the HTTP status or error details
- api.log_out()
-
log the bot out from the cloud bot API server.
Returns:
- table|false true on success, or false on failure
- string|table the HTTP status or error details
- api.request(endpoint, parameters, file)
-
send a request to the telegram bot API.
encodes parameters as multipart form data and handles file uploads.
Parameters:
- endpoint string the full API endpoint URL
- parameters table optional request parameters
- file table optional file attachments keyed by type
Returns:
- table|false the decoded JSON response, or false on failure
- string|table the HTTP status or error details