Api
class Api (View source)
Class Api
Constants
VERSION |
|
BOT_TOKEN_ENV_NAME |
|
Methods
Instantiates a new Telegram super-class object.
Returns the TelegramClient service.
Returns Telegram Bot API Access Token.
Returns the last response returned from API request.
Sets the bot access token to use with API requests.
Make this request asynchronous (non-blocking).
Check if this is an asynchronous request (non-blocking).
Returns SDK's Command Bus.
Add Telegram Commands to the Command Bus.
Returns list of available commands.
Send text messages.
Forward messages of any kind.
Send Photos.
Send regular audio files.
Send voice audio files.
Send general files.
Send .webp stickers.
Send Video File, Telegram clients support mp4 videos (other formats may be sent as Document).
Send point on the map.
Broadcast a Chat Action.
Returns a list of profile pictures for a user.
Set a Webhook to receive incoming updates via an outgoing webhook.
Returns webhook updates sent by Telegram.
Removes the outgoing webhook (if any).
Use this method to receive incoming updates using long polling.
Builds a custom keyboard markup.
Hide the current custom keyboard and display the default letter-keyboard.
Display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply').
Processes Inbound Commands.
Determine if a given type is the message.
Detect Message Type Based on Update Object.
Magic method to process any "get" requests.
Details
at line 70
__construct(
string $token = null,
bool $async = false,
string|HttpClientInterface $http_client_handler = null)
Instantiates a new Telegram super-class object.
at line 100
TelegramClient
getClient()
Returns the TelegramClient service.
at line 110
string
getAccessToken()
Returns Telegram Bot API Access Token.
at line 120
TelegramResponse
getLastResponse()
Returns the last response returned from API request.
at line 134
Api
setAccessToken(
string $accessToken)
Sets the bot access token to use with API requests.
at line 152
TelegramRequest
setAsyncRequest(
bool $isAsyncRequest)
Make this request asynchronous (non-blocking).
at line 164
bool
isAsyncRequest()
Check if this is an asynchronous request (non-blocking).
at line 174
CommandBus
getCommandBus()
Returns SDK's Command Bus.
at line 190
CommandBus
addCommand(
CommandInterface|string $command)
Add Telegram Command to the Command Bus.
at line 202
CommandBus
addCommands(
array $commands)
Add Telegram Commands to the Command Bus.
at line 212
array
getCommands()
Returns list of available commands.
at line 225
User
getMe()
A simple method for testing your bot's auth token.
Returns basic information about the bot in form of a User object.
at line 245
Message
sendMessage(
int $chat_id,
string $text,
bool $disable_web_page_preview = false,
int $reply_to_message_id = null,
string $reply_markup = null)
Send text messages.
at line 269
Message
forwardMessage(
int $chat_id,
int $from_chat_id,
int $message_id)
Forward messages of any kind.
at line 290
Message
sendPhoto(
int $chat_id,
string $photo,
string $caption = null,
int $reply_to_message_id = null,
string $reply_markup = null)
Send Photos.
at line 312
Message
sendAudio(
int $chat_id,
string $audio,
int $duration = null,
string $performer = null,
string $title = null,
int $reply_to_message_id = null,
string $reply_markup = null)
Send regular audio files.
at line 339
Message
sendVoice(
int $chat_id,
string $voice,
int $duration = null,
int $reply_to_message_id = null,
string $reply_markup = null)
Send voice audio files.
at line 358
Message
sendDocument(
int $chat_id,
string $document,
int $reply_to_message_id = null,
string $reply_markup = null)
Send general files.
at line 379
Message
sendSticker(
int $chat_id,
string $sticker,
int $reply_to_message_id = null,
string $reply_markup = null)
Send .webp stickers.
at line 405
Message
sendVideo(
int $chat_id,
string $video,
int $duration = null,
string $caption = null,
int $reply_to_message_id = null,
string $reply_markup = null)
Send Video File, Telegram clients support mp4 videos (other formats may be sent as Document).
at line 431
Message
sendLocation(
int $chat_id,
float $latitude,
float $longitude,
int $reply_to_message_id = null,
string $reply_markup = null)
Send point on the map.
at line 451
TelegramResponse
sendChatAction(
int $chat_id,
string $action)
Broadcast a Chat Action.
at line 482
UserProfilePhotos
getUserProfilePhotos(
int $user_id,
int $offset = null,
int $limit = null)
Returns a list of profile pictures for a user.
at line 501
TelegramResponse
setWebhook(
string $url,
string $certificate = null)
Set a Webhook to receive incoming updates via an outgoing webhook.
at line 522
Update
getWebhookUpdates()
Returns webhook updates sent by Telegram.
Works only if you set a webhook.
at line 534
TelegramResponse
removeWebhook()
Removes the outgoing webhook (if any).
at line 552
Update[]
getUpdates(
int|null $offset = null,
int|null $limit = null,
int|null $timeout = null)
Use this method to receive incoming updates using long polling.
at line 577
string
replyKeyboardMarkup(
array $keyboard,
bool $resize_keyboard = false,
bool $one_time_keyboard = false,
bool $selective = false)
Builds a custom keyboard markup.
at line 595
static
string
replyKeyboardHide(
bool $selective = false)
Hide the current custom keyboard and display the default letter-keyboard.
at line 611
static
string
forceReply(
bool $selective = false)
Display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply').
at line 673
bool
isMessageType(
string $type,
Update $update)
Determine if a given type is the message.
at line 689
string|null
detectMessageType(
Update $update)
Detect Message Type Based on Update Object.
at line 825
bool|TelegramResponse
__call($method, $arguments)
Magic method to process any "get" requests.