PHP 클래스 Longman\TelegramBot\Request

파일 보기 프로젝트 열기: akalongman/php-telegram-bot 1 사용 예제들

공개 메소드들

메소드 설명
answerCallbackQuery ( array $data ) : ServerResponse Use this method to send answers to callback queries sent from inline keyboards. On success, True is returned.
answerInlineQuery ( array $data ) : ServerResponse Use this method to send answers to an inline query. On success, True is returned.
downloadFile ( Longman\TelegramBot\Entities\File $file ) : boolean Download file
editMessageCaption ( array $data ) : ServerResponse Use this method to edit captions of messages sent by the bot or via the bot (for inline bots).
editMessageReplyMarkup ( array $data ) : ServerResponse Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
editMessageText ( array $data ) : ServerResponse Use this method to edit text and game messages sent by the bot or via the bot (for inline bots).
emptyResponse ( ) : ServerResponse Return an empty Server Response
execute ( string $action, array $data = [] ) : string Execute HTTP Request
forwardMessage ( array $data ) : ServerResponse Use this method to forward messages of any kind. On success, the sent Message is returned
generateGeneralFakeServerResponse ( array $data = [] ) : array Generate general fake server response
getChat ( array $data ) : ServerResponse 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.
getChatAdministrators ( array $data ) : ServerResponse Use this method to get a list of administrators in a chat.
getChatMember ( array $data ) : ServerResponse Use this method to get information about a member of a chat. Returns a ChatMember object on success.
getChatMembersCount ( array $data ) : ServerResponse Use this method to get the number of members in a chat. Returns Int on success.
getFile ( array $data ) : ServerResponse Use this method to get basic info about a file and prepare it for downloading. On success, a File object is returned.
getInput ( ) : string Set input from custom input or stdin and return it
getMe ( ) : ServerResponse Returns basic information about the bot in form of a User object
getUpdates ( array $data ) : ServerResponse Get updates
getUserProfilePhotos ( array $data ) : ServerResponse Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
getWebhookInfo ( ) : ServerResponse Use this method to get current webhook status.
initialize ( Telegram $telegram ) Initialize
kickChatMember ( array $data ) : ServerResponse Use this method to kick a user from a group or a supergroup. Returns True on success.
leaveChat ( array $data ) : ServerResponse Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
send ( string $action, array $data = [] ) : ServerResponse Send command
sendAudio ( array $data, string $file = null ) : ServerResponse Use this method to send audio files
sendChatAction ( array $data ) : ServerResponse Use this method when you need to tell the user that something is happening on the bot's side.
sendContact ( array $data ) : ServerResponse Use this method to send phone contacts. On success, the sent Message is returned.
sendDocument ( array $data, string $file = null ) : ServerResponse Use this method to send general files. On success, the sent Message is returned.
sendLocation ( array $data ) : ServerResponse Use this method to send point on the map. On success, the sent Message is returned.
sendMessage ( array $data ) : ServerResponse Use this method to send text messages. On success, the sent Message is returned
sendPhoto ( array $data, string $file = null ) : ServerResponse Use this method to send photos. On success, the sent Message is returned
sendSticker ( array $data, string $file = null ) : ServerResponse Use this method to send .webp stickers. On success, the sent Message is returned.
sendToActiveChats ( string $callback_function, array $data, boolean $send_groups = true, boolean $send_super_groups = true, boolean $send_users = true, string $date_from = null, string $date_to = null ) : array Send message to all active chats
sendVenue ( array $data ) : ServerResponse Use this method to send information about a venue. On success, the sent Message is returned.
sendVideo ( array $data, string $file = null ) : ServerResponse Use this method to send video files. On success, the sent Message is returned.
sendVoice ( array $data, string $file = null ) : ServerResponse Use this method to send audio files. On success, the sent Message is returned.
setWebhook ( string $url = '', string $file = null ) : ServerResponse Set webhook
unbanChatMember ( array $data ) : ServerResponse Use this method to unban a previously kicked user in a supergroup. Returns True on success.

보호된 메소드들

메소드 설명
encodeFile ( string $file ) : resource Encode file

비공개 메소드들

메소드 설명
assignEncodedFile ( array &$data, string $field, string $file ) Assign an encoded file to a data array
ensureNonEmptyData ( array $data ) Make sure the data isn't empty, else throw an exception
ensureValidAction ( string $action ) Make sure the action is valid, else throw an exception
setUpRequestParams ( array $data ) : array Properly set up the request params

메소드 상세

answerCallbackQuery() 공개 정적인 메소드

The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
public static answerCallbackQuery ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

answerInlineQuery() 공개 정적인 메소드

No more than 50 results per query are allowed.
public static answerInlineQuery ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

downloadFile() 공개 정적인 메소드

Download file
public static downloadFile ( Longman\TelegramBot\Entities\File $file ) : boolean
$file Longman\TelegramBot\Entities\File
리턴 boolean

editMessageCaption() 공개 정적인 메소드

On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
public static editMessageCaption ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

editMessageReplyMarkup() 공개 정적인 메소드

On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
public static editMessageReplyMarkup ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

editMessageText() 공개 정적인 메소드

On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
public static editMessageText ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

emptyResponse() 공개 정적인 메소드

No request to telegram are sent, this function is used in commands that don't need to fire a message after execution
public static emptyResponse ( ) : ServerResponse
리턴 Longman\TelegramBot\Entities\ServerResponse

encodeFile() 보호된 정적인 메소드

Encode file
protected static encodeFile ( string $file ) : resource
$file string
리턴 resource

execute() 공개 정적인 메소드

Execute HTTP Request
public static execute ( string $action, array $data = [] ) : string
$action string Action to execute
$data array Data to attach to the execution
리턴 string Result of the HTTP Request

forwardMessage() 공개 정적인 메소드

Use this method to forward messages of any kind. On success, the sent Message is returned
public static forwardMessage ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

generateGeneralFakeServerResponse() 공개 정적인 메소드

Generate general fake server response
public static generateGeneralFakeServerResponse ( array $data = [] ) : array
$data array Data to add to fake response
리턴 array Fake response data

getChat() 공개 정적인 메소드

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.
public static getChat ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getChatAdministrators() 공개 정적인 메소드

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.
public static getChatAdministrators ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getChatMember() 공개 정적인 메소드

Use this method to get information about a member of a chat. Returns a ChatMember object on success.
public static getChatMember ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getChatMembersCount() 공개 정적인 메소드

Use this method to get the number of members in a chat. Returns Int on success.
public static getChatMembersCount ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getFile() 공개 정적인 메소드

For the moment, bots can download files of up to 20MB in size. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where 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.
public static getFile ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getInput() 공개 정적인 메소드

Set input from custom input or stdin and return it
public static getInput ( ) : string
리턴 string

getMe() 공개 정적인 메소드

Returns basic information about the bot in form of a User object
public static getMe ( ) : ServerResponse
리턴 Longman\TelegramBot\Entities\ServerResponse

getUpdates() 공개 정적인 메소드

Get updates
public static getUpdates ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getUserProfilePhotos() 공개 정적인 메소드

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
public static getUserProfilePhotos ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

getWebhookInfo() 공개 정적인 메소드

Use this method to get current webhook status.
public static getWebhookInfo ( ) : ServerResponse
리턴 Longman\TelegramBot\Entities\ServerResponse

initialize() 공개 정적인 메소드

Initialize
public static initialize ( Telegram $telegram )
$telegram Telegram

kickChatMember() 공개 정적인 메소드

In the case of supergroups, 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 group for this to work.
public static kickChatMember ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

leaveChat() 공개 정적인 메소드

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
public static leaveChat ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

send() 공개 정적인 메소드

Send command
public static send ( string $action, array $data = [] ) : ServerResponse
$action string
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

sendAudio() 공개 정적인 메소드

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. For sending voice messages, use the sendVoice method instead.
public static sendAudio ( array $data, string $file = null ) : ServerResponse
$data array
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

sendChatAction() 공개 정적인 메소드

The status is set for 5 seconds or less. (when a message arrives from your bot, Telegram clients clear its typing status)
public static sendChatAction ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

sendContact() 공개 정적인 메소드

Use this method to send phone contacts. On success, the sent Message is returned.
public static sendContact ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

sendDocument() 공개 정적인 메소드

Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
public static sendDocument ( array $data, string $file = null ) : ServerResponse
$data array
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

sendLocation() 공개 정적인 메소드

Use this method to send point on the map. On success, the sent Message is returned.
public static sendLocation ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

sendMessage() 공개 정적인 메소드

Use this method to send text messages. On success, the sent Message is returned
public static sendMessage ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

sendPhoto() 공개 정적인 메소드

Use this method to send photos. On success, the sent Message is returned
public static sendPhoto ( array $data, string $file = null ) : ServerResponse
$data array
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

sendSticker() 공개 정적인 메소드

Use this method to send .webp stickers. On success, the sent Message is returned.
public static sendSticker ( array $data, string $file = null ) : ServerResponse
$data array
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

sendToActiveChats() 공개 정적인 메소드

Send message to all active chats
public static sendToActiveChats ( string $callback_function, array $data, boolean $send_groups = true, boolean $send_super_groups = true, boolean $send_users = true, string $date_from = null, string $date_to = null ) : array
$callback_function string
$data array
$send_groups boolean
$send_super_groups boolean
$send_users boolean
$date_from string
$date_to string
리턴 array

sendVenue() 공개 정적인 메소드

Use this method to send information about a venue. On success, the sent Message is returned.
public static sendVenue ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse

sendVideo() 공개 정적인 메소드

Telegram clients support mp4 videos (other formats may be sent as Document). Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
public static sendVideo ( array $data, string $file = null ) : ServerResponse
$data array
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

sendVoice() 공개 정적인 메소드

Telegram clients will 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). Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
public static sendVoice ( array $data, string $file = null ) : ServerResponse
$data array
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

setWebhook() 공개 정적인 메소드

Set webhook
public static setWebhook ( string $url = '', string $file = null ) : ServerResponse
$url string
$file string
리턴 Longman\TelegramBot\Entities\ServerResponse

unbanChatMember() 공개 정적인 메소드

The user will not return to the group automatically, but will be able to join via link, etc. The bot must be an administrator in the group for this to work.
public static unbanChatMember ( array $data ) : ServerResponse
$data array
리턴 Longman\TelegramBot\Entities\ServerResponse