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.
Remove Telegram Command to the Command Bus.
Remove Telegram Commands from the Command Bus.
Returns list of available commands.
Send text messages.
Forward messages of any kind.
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.
Magic method to process any "get" requests.
Set the IoC Container.
Get the IoC Container.
Check if IoC Container has been set.
No description
No description
No description
No description
Details
at line 88
__construct(
string $token = null,
bool $async = false,
string|HttpClientInterface $http_client_handler = null)
Instantiates a new Telegram super-class object.
at line 118
TelegramClient
getClient()
Returns the TelegramClient service.
at line 128
string
getAccessToken()
Returns Telegram Bot API Access Token.
at line 138
TelegramResponse
getLastResponse()
Returns the last response returned from API request.
at line 152
Api
setAccessToken(
string $accessToken)
Sets the bot access token to use with API requests.
at line 170
Api
setAsyncRequest(
bool $isAsyncRequest)
Make this request asynchronous (non-blocking).
at line 182
bool
isAsyncRequest()
Check if this is an asynchronous request (non-blocking).
at line 192
CommandBus
getCommandBus()
Returns SDK's Command Bus.
at line 208
CommandBus
addCommand(
CommandInterface|string $command)
Add Telegram Command to the Command Bus.
at line 220
CommandBus
addCommands(
array $commands)
Add Telegram Commands to the Command Bus.
at line 232
CommandBus
removeCommand(
string $name)
Remove Telegram Command to the Command Bus.
at line 244
CommandBus
removeCommands(
array $names)
Remove Telegram Commands from the Command Bus.
at line 254
Command[]
getCommands()
Returns list of available commands.
at line 267
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 301
Message
sendMessage(
array $params)
Send text messages.
$params = [
'chatid' => '',
'text' => '',
'parsemode' => '',
'disablewebpagepreview' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 329
Message
forwardMessage(
array $params)
Forward messages of any kind.
$params = [
'chatid' => '',
'fromchatid' => '',
'messageid' => '',
];
at line 361
Message
sendPhoto(
array $params)
Send Photos.
$params = [
'chatid' => '',
'photo' => '',
'caption' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 395
Message
sendAudio(
array $params)
Send regular audio files.
$params = [
'chatid' => '',
'audio' => '',
'duration' => '',
'performer' => '',
'title' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 423
Message
sendDocument(
array $params)
Send general files.
$params = [
'chatid' => '',
'document' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 453
Message
sendSticker(
array $params)
Send .webp stickers.
$params = [
'chatid' => '',
'sticker' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 490
Message
sendVideo(
array $params)
Send Video File, Telegram clients support mp4 videos (other formats may be sent as Document).
$params = [
'chatid' => '',
'video' => '',
'duration' => '',
'caption' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 520
Message
sendVoice(
array $params)
Send voice audio files.
$params = [
'chatid' => '',
'voice' => '',
'duration' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 550
Message
sendLocation(
array $params)
Send point on the map.
$params = [
'chatid' => '',
'latitude' => '',
'longitude' => '',
'replytomessageid' => '',
'reply_markup' => '',
];
at line 578
TelegramResponse
sendChatAction(
array $params)
Broadcast a Chat Action.
$params = [
'chat_id' => '',
'action' => '',
];
at line 619
UserProfilePhotos
getUserProfilePhotos(
array $params)
Returns a list of profile pictures for a user.
$params = [
'user_id' => '',
'offset' => '',
'limit' => '',
];
at line 647
File
getFile(
array $params)
Returns basic info about a file and prepare it for downloading.
$params = [
'file_id' => '',
];
The file can then be downloaded via the link
https://api.telegram.org/file/bot
at line 676
TelegramResponse
setWebhook(
array $params)
Set a Webhook to receive incoming updates via an outgoing webhook.
$params = [
'url' => '',
'certificate' => '',
];
at line 697
Update
getWebhookUpdates()
Returns webhook updates sent by Telegram.
Works only if you set a webhook.
at line 709
TelegramResponse
removeWebhook()
Removes the outgoing webhook (if any).
at line 737
Update[]
getUpdates(
array $params = array())
Use this method to receive incoming updates using long polling.
$params = [
'offset' => '',
'limit' => '',
'timeout' => '',
];
at line 775
string
replyKeyboardMarkup(
array $params)
Builds a custom keyboard markup.
$params = [
'keyboard' => '',
'resizekeyboard' => '',
'onetime_keyboard' => '',
'selective' => '',
];
at line 799
static
string
replyKeyboardHide(
array $params = array())
Hide the current custom keyboard and display the default letter-keyboard.
$params = [
'hide_keyboard' => true,
'selective' => false,
];
at line 823
static
string
forceReply(
array $params = array())
Display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply').
$params = [
'force_reply' => true,
'selective' => false,
];
at line 885
bool
isMessageType(
string $type,
Update|Message $object)
Determine if a given type is the message.
at line 905
string|null
detectMessageType(
Update|Message $object)
Detect Message Type Based on Update or Message Object.
at line 1050
bool|TelegramResponse
__call($method, $arguments)
Magic method to process any "get" requests.
at line 1076
static
void
setContainer(
Container $container)
Set the IoC Container.
at line 1086
Container
getContainer()
Get the IoC Container.
at line 1096
boolean
hasContainer()
Check if IoC Container has been set.