Documentation

Request
in package

Class Request

Table of Contents

$actions  : array<string|int, mixed>
Available actions to send
$actions_need_dummy_param  : array<string|int, mixed>
Some methods need a dummy param due to certain cURL issues.
$api_base_uri  : string
URI of the Telegram API
$client  : Client
Guzzle Client object
$input  : string
Input value of the request
$limiter_enabled  : bool
Request limiter
$limiter_interval  : float
Request limiter's interval between checks
$telegram  : Telegram
Telegram object
__callStatic()  : ServerResponse
Any statically called method should be relayed to the `send` method.
addStickerToSet()  :
answerCallbackQuery()  :
answerInlineQuery()  :
answerPreCheckoutQuery()  :
answerShippingQuery()  :
createNewStickerSet()  :
deleteChatPhoto()  :
deleteChatStickerSet()  :
deleteMessage()  :
deleteStickerFromSet()  :
deleteWebhook()  :
downloadFile()  : bool
Download file
editMessageCaption()  :
editMessageLiveLocation()  :
editMessageMedia()  :
editMessageReplyMarkup()  :
editMessageText()  :
emptyResponse()  : ServerResponse
Return an empty Server Response
encodeFile()  : resource
Encode file
execute()  : string
Execute HTTP Request
exportChatInviteLink()  :
forwardMessage()  :
generateGeneralFakeServerResponse()  : array<string|int, mixed>
Generate general fake server response
getChat()  :
getChatAdministrators()  :
getChatMember()  :
getChatMembersCount()  :
getFile()  :
getGameHighScores()  :
getInput()  : string
Set input from custom input or stdin and return it
getMe()  :
getStickerSet()  :
getUpdates()  :
getUserProfilePhotos()  :
getWebhookInfo()  :
initialize()  : mixed
Initialize
kickChatMember()  :
leaveChat()  :
pinChatMessage()  :
promoteChatMember()  :
restrictChatMember()  :
send()  : ServerResponse
Send command
sendAnimation()  :
sendAudio()  :
sendChatAction()  :
sendContact()  :
sendDocument()  :
sendGame()  :
sendInvoice()  :
sendLocation()  :
sendMediaGroup()  :
sendMessage()  : ServerResponse
Use this method to send text messages. On success, the sent Message is returned
sendPhoto()  :
sendSticker()  :
sendToActiveChats()  : array<string|int, mixed>
Send message to all active chats
sendVenue()  :
sendVideo()  :
sendVideoNote()  :
sendVoice()  :
setChatDescription()  :
setChatPhoto()  :
setChatStickerSet()  :
setChatTitle()  :
setClient()  : mixed
Set a custom Guzzle HTTP Client object
setGameScore()  :
setLimiter()  : mixed
Enable request limiter
setPassportDataErrors()  :
setStickerPositionInSet()  :
setWebhook()  :
stopMessageLiveLocation()  :
unbanChatMember()  :
unpinChatMessage()  :
uploadStickerFile()  :
addDummyParamIfNecessary()  : mixed
Add a dummy parameter if the passed action requires it.
ensureNonEmptyData()  : mixed
Make sure the data isn't empty, else throw an exception
ensureValidAction()  : mixed
Make sure the action is valid, else throw an exception
limitTelegramRequests()  : mixed
This functions delays API requests to prevent reaching Telegram API limits Can be disabled while in execution by 'Request::setLimiter(false)'
setUpRequestParams()  : array<string|int, mixed>
Properly set up the request params

Properties

$actions

Available actions to send

private static array<string|int, mixed> $actions = ['getUpdates', 'setWebhook', 'deleteWebhook', 'getWebhookInfo', 'getMe', 'sendMessage', 'forwardMessage', 'sendPhoto', 'sendAudio', 'sendDocument', 'sendSticker', 'sendVideo', 'sendAnimation', 'sendVoice', 'sendVideoNote', 'sendMediaGroup', 'sendLocation', 'editMessageLiveLocation', 'stopMessageLiveLocation', 'sendVenue', 'sendContact', 'sendChatAction', 'getUserProfilePhotos', 'getFile', 'kickChatMember', 'unbanChatMember', 'restrictChatMember', 'promoteChatMember', 'exportChatInviteLink', 'setChatPhoto', 'deleteChatPhoto', 'setChatTitle', 'setChatDescription', 'pinChatMessage', 'unpinChatMessage', 'leaveChat', 'getChat', 'getChatAdministrators', 'getChatMembersCount', 'getChatMember', 'setChatStickerSet', 'deleteChatStickerSet', 'answerCallbackQuery', 'answerInlineQuery', 'editMessageText', 'editMessageCaption', 'editMessageMedia', 'editMessageReplyMarkup', 'deleteMessage', 'getStickerSet', 'uploadStickerFile', 'createNewStickerSet', 'addStickerToSet', 'setStickerPositionInSet', 'deleteStickerFromSet', 'sendInvoice', 'answerShippingQuery', 'answerPreCheckoutQuery', 'setPassportDataErrors', 'sendGame', 'setGameScore', 'getGameHighScores']

This is basically the list of all methods listed on the official API documentation.

Tags
link
https://core.telegram.org/bots/api

$actions_need_dummy_param

Some methods need a dummy param due to certain cURL issues.

private static array<string|int, mixed> $actions_need_dummy_param = ['deleteWebhook', 'getWebhookInfo', 'getMe']
Tags
see
Request::addDummyParamIfNecessary()

$api_base_uri

URI of the Telegram API

private static string $api_base_uri = 'https://api.telegram.org'

$input

Input value of the request

private static string $input

$limiter_enabled

Request limiter

private static bool $limiter_enabled

$limiter_interval

Request limiter's interval between checks

private static float $limiter_interval

Methods

__callStatic()

Any statically called method should be relayed to the `send` method.

public static __callStatic(string $action, array<string|int, mixed> $data) : ServerResponse
Parameters
$action : string
$data : array<string|int, mixed>
Tags
throws
TelegramException
Return values
ServerResponse

addStickerToSet()

public static addStickerToSet(array<string|int, mixed> $data) :

Use this method to add a new sticker to a set created by the bot. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

answerCallbackQuery()

public static answerCallbackQuery(array<string|int, mixed> $data) :

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

Parameters
$data : array<string|int, mixed>
Return values

answerInlineQuery()

public static answerInlineQuery(array<string|int, mixed> $data) :

Use this method to send answers to an inline query. On success, True is returned.

Parameters
$data : array<string|int, mixed>
Return values

answerPreCheckoutQuery()

public static answerPreCheckoutQuery(array<string|int, mixed> $data) :

Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned.

Parameters
$data : array<string|int, mixed>
Return values

answerShippingQuery()

public static answerShippingQuery(array<string|int, mixed> $data) :

If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.

Parameters
$data : array<string|int, mixed>
Return values

createNewStickerSet()

public static createNewStickerSet(array<string|int, mixed> $data) :

Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

deleteChatPhoto()

public static deleteChatPhoto(array<string|int, mixed> $data) :

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

deleteChatStickerSet()

public static deleteChatStickerSet(array<string|int, mixed> $data) :

Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

deleteMessage()

public static deleteMessage(array<string|int, mixed> $data) :

Use this method to delete a message, including service messages, with certain limitations. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

deleteStickerFromSet()

public static deleteStickerFromSet(array<string|int, mixed> $data) :

Use this method to delete a sticker from a set created by the bot. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

deleteWebhook()

public static deleteWebhook() :

Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.

Return values

editMessageCaption()

public static editMessageCaption(array<string|int, mixed> $data) :

Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

Parameters
$data : array<string|int, mixed>
Return values

editMessageLiveLocation()

public static editMessageLiveLocation(array<string|int, mixed> $data) :

Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.

Parameters
$data : array<string|int, mixed>
Return values

editMessageMedia()

public static editMessageMedia(array<string|int, mixed> $data) :

Use this method to edit audio, document, photo, or video messages. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.

Parameters
$data : array<string|int, mixed>
Return values

editMessageReplyMarkup()

public static editMessageReplyMarkup(array<string|int, mixed> $data) :

Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

Parameters
$data : array<string|int, mixed>
Return values

editMessageText()

public static editMessageText(array<string|int, mixed> $data) :

Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

Parameters
$data : array<string|int, mixed>
Return values

emptyResponse()

Return an empty Server Response

public static emptyResponse() : ServerResponse

No request to telegram are sent, this function is used in commands that don't need to fire a message after execution

Tags
throws
TelegramException
Return values
ServerResponse

encodeFile()

Encode file

public static encodeFile(string $file) : resource
Parameters
$file : string
Tags
throws
TelegramException
Return values
resource

execute()

Execute HTTP Request

public static execute(string $action[, array<string|int, mixed> $data = [] ]) : string
Parameters
$action : string

Action to execute

$data : array<string|int, mixed> = []

Data to attach to the execution

Tags
throws
TelegramException
Return values
string

Result of the HTTP Request

public static exportChatInviteLink(array<string|int, mixed> $data) :

Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success.

Parameters
$data : array<string|int, mixed>
Return values

forwardMessage()

public static forwardMessage(array<string|int, mixed> $data) :

Use this method to forward messages of any kind. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

generateGeneralFakeServerResponse()

Generate general fake server response

public static generateGeneralFakeServerResponse([array<string|int, mixed> $data = [] ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed> = []

Data to add to fake response

Return values
array<string|int, mixed>

Fake response data

getChat()

public static getChat(array<string|int, mixed> $data) :

Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.

Parameters
$data : array<string|int, mixed>
Return values

getChatAdministrators()

public static getChatAdministrators(array<string|int, mixed> $data) :

Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.

Parameters
$data : array<string|int, mixed>
Return values

getChatMember()

public static getChatMember(array<string|int, mixed> $data) :

Use this method to get information about a member of a chat. Returns a ChatMember object on success.

Parameters
$data : array<string|int, mixed>
Return values

getChatMembersCount()

public static getChatMembersCount(array<string|int, mixed> $data) :

Use this method to get the number of members in a chat. Returns Int on success.

Parameters
$data : array<string|int, mixed>
Return values

getFile()

public static getFile(array<string|int, mixed> $data) :

Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.

Parameters
$data : array<string|int, mixed>
Return values

getGameHighScores()

public static getGameHighScores(array<string|int, mixed> $data) :

Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.

Parameters
$data : array<string|int, mixed>
Return values

getInput()

Set input from custom input or stdin and return it

public static getInput() : string
Tags
throws
TelegramException
Return values
string

getMe()

public static getMe() :

A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.

Return values

getStickerSet()

public static getStickerSet(array<string|int, mixed> $data) :

Use this method to get a sticker set. On success, a StickerSet object is returned.

Parameters
$data : array<string|int, mixed>
Return values

getUpdates()

public static getUpdates(array<string|int, mixed> $data) :

Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.

Parameters
$data : array<string|int, mixed>
Return values

getUserProfilePhotos()

public static getUserProfilePhotos(array<string|int, mixed> $data) :

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

Parameters
$data : array<string|int, mixed>
Return values

getWebhookInfo()

public static getWebhookInfo() :

Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

Return values

kickChatMember()

public static kickChatMember(array<string|int, mixed> $data) :

Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

leaveChat()

public static leaveChat(array<string|int, mixed> $data) :

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

pinChatMessage()

public static pinChatMessage(array<string|int, mixed> $data) :

Use this method to pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

promoteChatMember()

public static promoteChatMember(array<string|int, mixed> $data) :

Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

restrictChatMember()

public static restrictChatMember(array<string|int, mixed> $data) :

Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

send()

Send command

public static send(string $action[, array<string|int, mixed> $data = [] ]) : ServerResponse
Parameters
$action : string
$data : array<string|int, mixed> = []
Tags
todo

Fake response doesn't need json encoding?

todo

Write debug entry on failure

throws
TelegramException
Return values
ServerResponse

sendAnimation()

public static sendAnimation(array<string|int, mixed> $data) :

Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.

Parameters
$data : array<string|int, mixed>
Return values

sendAudio()

public static sendAudio(array<string|int, mixed> $data) :

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.

Parameters
$data : array<string|int, mixed>
Return values

sendChatAction()

public static sendChatAction(array<string|int, mixed> $data) :

Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

sendContact()

public static sendContact(array<string|int, mixed> $data) :

Use this method to send phone contacts. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendDocument()

public static sendDocument(array<string|int, mixed> $data) :

Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

Parameters
$data : array<string|int, mixed>
Return values

sendGame()

public static sendGame(array<string|int, mixed> $data) :

Use this method to send a game. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendInvoice()

public static sendInvoice(array<string|int, mixed> $data) :

Use this method to send invoices. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendLocation()

public static sendLocation(array<string|int, mixed> $data) :

Use this method to send point on the map. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendMediaGroup()

public static sendMediaGroup(array<string|int, mixed> $data) :

Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendPhoto()

public static sendPhoto(array<string|int, mixed> $data) :

Use this method to send photos. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendSticker()

public static sendSticker(array<string|int, mixed> $data) :

Use this method to send .webp stickers. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendToActiveChats()

Send message to all active chats

public static sendToActiveChats(string $callback_function, array<string|int, mixed> $data, array<string|int, mixed> $select_chats_params) : array<string|int, mixed>
Parameters
$callback_function : string
$data : array<string|int, mixed>
$select_chats_params : array<string|int, mixed>
Tags
throws
TelegramException
Return values
array<string|int, mixed>

sendVenue()

public static sendVenue(array<string|int, mixed> $data) :

Use this method to send information about a venue. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendVideo()

public static sendVideo(array<string|int, mixed> $data) :

Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

Parameters
$data : array<string|int, mixed>
Return values

sendVideoNote()

public static sendVideoNote(array<string|int, mixed> $data) :

Use this method to send video messages. On success, the sent Message is returned.

Parameters
$data : array<string|int, mixed>
Return values

sendVoice()

public static sendVoice(array<string|int, mixed> $data) :

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

Parameters
$data : array<string|int, mixed>
Return values

setChatDescription()

public static setChatDescription(array<string|int, mixed> $data) :

Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

setChatPhoto()

public static setChatPhoto(array<string|int, mixed> $data) :

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

setChatStickerSet()

public static setChatStickerSet(array<string|int, mixed> $data) :

Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

setChatTitle()

public static setChatTitle(array<string|int, mixed> $data) :

Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

setClient()

Set a custom Guzzle HTTP Client object

public static setClient(Client $client) : mixed
Parameters
$client : Client
Tags
throws
TelegramException
Return values
mixed

setGameScore()

public static setGameScore(array<string|int, mixed> $data) :

Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

Parameters
$data : array<string|int, mixed>
Return values

setLimiter()

Enable request limiter

public static setLimiter([bool $enable = true ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$enable : bool = true
$options : array<string|int, mixed> = []
Tags
throws
TelegramException
Return values
mixed

setPassportDataErrors()

public static setPassportDataErrors(array<string|int, mixed> $data) :

Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.

Parameters
$data : array<string|int, mixed>
Return values

setStickerPositionInSet()

public static setStickerPositionInSet(array<string|int, mixed> $data) :

Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

setWebhook()

public static setWebhook(array<string|int, mixed> $data) :

Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns true.

Parameters
$data : array<string|int, mixed>
Return values

stopMessageLiveLocation()

public static stopMessageLiveLocation(array<string|int, mixed> $data) :

Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.

Parameters
$data : array<string|int, mixed>
Return values

unbanChatMember()

public static unbanChatMember(array<string|int, mixed> $data) :

Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

unpinChatMessage()

public static unpinChatMessage(array<string|int, mixed> $data) :

Use this method to unpin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.

Parameters
$data : array<string|int, mixed>
Return values

uploadStickerFile()

public static uploadStickerFile(array<string|int, mixed> $data) :

Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.

Parameters
$data : array<string|int, mixed>
Return values

addDummyParamIfNecessary()

Add a dummy parameter if the passed action requires it.

protected static addDummyParamIfNecessary(string $action, array<string|int, mixed> &$data) : mixed

If a method doesn't require parameters, we need to add a dummy one anyway, because of some cURL version failed POST request without parameters.

Parameters
$action : string
$data : array<string|int, mixed>
Tags
link
https://github.com/php-telegram-bot/core/pull/228
todo

Would be nice to find a better solution for this!

Return values
mixed

ensureNonEmptyData()

Make sure the data isn't empty, else throw an exception

private static ensureNonEmptyData(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
throws
TelegramException
Return values
mixed

ensureValidAction()

Make sure the action is valid, else throw an exception

private static ensureValidAction(string $action) : mixed
Parameters
$action : string
Tags
throws
TelegramException
Return values
mixed

setUpRequestParams()

Properly set up the request params

private static setUpRequestParams(array<string|int, mixed> $data) : array<string|int, mixed>

If any item of the array is a resource, reformat it to a multipart request. Else, just return the passed data as form params.

Parameters
$data : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results