PHP Класс telegramBot

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$token

Открытые методы

Метод Описание
__construct ( $token )
forceReply ( boolean $selective = false ) : string Display a reply interface to the user (act as if the user has selected the bots message and tapped 'Reply').
forwardMessage ( integer $chat_id, integer $from_chat_id, integer $message_id ) : Array Forward messages of any kind.
getFile ( String $file_id ) : On Use this method to get basic info about a file and prepare it for downloading.
getFileData ( string $file_id, string $file_path ) : On Use this method to get file Data.
getMe ( ) : Array A simple method for testing your bot's auth token.
getUserProfilePhotos ( $user_id, integer $offset = null, integer $limit = null ) : Array Get user profile photos.
getWebhookUpdates ( ) : Array Returns webhook updates sent by Telegram.
pollUpdates ( integer $offset = null, integer $timeout = null, integer $limit = null ) : Array Use this method to receive incoming updates using long polling.
replyKeyboardHide ( boolean $selective = false ) : string Hide the current custom keyboard and display the default letter-keyboard.
replyKeyboardMarkup ( array $keyboard, boolean $resize_keyboard = false, boolean $one_time_keyboard = false, boolean $selective = false ) : string Builds a custom keyboard markup.
sendAudio ( integer $chat_id, string $audio, integer $duration = null, string $performer = null, string $title = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Audio.
sendChatAction ( integer $chat_id, string $action ) : Array Send Chat Action.
sendContact ( integer $chat_id, $phone_number, string $first_name, string $last_name = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Contact.
sendDocument ( integer $chat_id, string $document, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Document.
sendLocation ( integer $chat_id, float $latitude, float $longitude, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Location.
sendMessage ( integer $chat_id, string $text, string $parse_mode = null, boolean $disable_web_page_preview = false, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send text messages.
sendPhoto ( integer $chat_id, string $photo, string $caption = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Photos.
sendSticker ( integer $chat_id, string $sticker, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Sticker.
sendVenue ( integer $chat_id, float $latitude, float $longitude, string $title, string $address, string $foursquare_id = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Venue.
sendVideo ( integer $chat_id, string $video, integer $duration = null, string $caption = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Video.
sendVoice ( integer $chat_id, string $audio, integer $duration = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array Send Voice.
setWebhook ( string $url, $certificate = null ) : Array Set a Webhook to receive incoming updates via an outgoing webhook.

Приватные методы

Метод Описание
sendRequest ( $method, $params )
uploadFile ( $method, $data )

Описание методов

__construct() публичный Метод

public __construct ( $token )

forceReply() публичный статический Метод

Display a reply interface to the user (act as if the user has selected the bots message and tapped 'Reply').
public static forceReply ( boolean $selective = false ) : string
$selective boolean
Результат string

forwardMessage() публичный Метод

Forward messages of any kind.
public forwardMessage ( integer $chat_id, integer $from_chat_id, integer $message_id ) : Array
$chat_id integer
$from_chat_id integer
$message_id integer
Результат Array

getFile() публичный Метод

Use this method to get basic info about a file and prepare it for downloading.
public getFile ( String $file_id ) : On
$file_id String
Результат On success, a File object is returned

getFileData() публичный Метод

Use this method to get file Data.
См. также: getFile
public getFileData ( string $file_id, string $file_path ) : On
$file_id string
$file_path string Is taken from the getFile response
Результат On success, a File Data is returned

getMe() публичный Метод

Returns basic information about the bot in form of a User object.
public getMe ( ) : Array
Результат Array

getUserProfilePhotos() публичный Метод

Get user profile photos.
public getUserProfilePhotos ( $user_id, integer $offset = null, integer $limit = null ) : Array
$offset integer
$limit integer
Результат Array

getWebhookUpdates() публичный Метод

Works only if you set a webhook.
См. также: setWebhook
public getWebhookUpdates ( ) : Array
Результат Array

pollUpdates() публичный Метод

Use this method to receive incoming updates using long polling.
public pollUpdates ( integer $offset = null, integer $timeout = null, integer $limit = null ) : Array
$offset integer
$timeout integer
$limit integer
Результат Array

replyKeyboardHide() публичный статический Метод

Hide the current custom keyboard and display the default letter-keyboard.
public static replyKeyboardHide ( boolean $selective = false ) : string
$selective boolean
Результат string

replyKeyboardMarkup() публичный Метод

Builds a custom keyboard markup.
public replyKeyboardMarkup ( array $keyboard, boolean $resize_keyboard = false, boolean $one_time_keyboard = false, boolean $selective = false ) : string
$keyboard array
$resize_keyboard boolean
$one_time_keyboard boolean
$selective boolean
Результат string

sendAudio() публичный Метод

Send Audio.
public sendAudio ( integer $chat_id, string $audio, integer $duration = null, string $performer = null, string $title = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$audio string
$duration integer
$performer string
$title string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendChatAction() публичный Метод

Send Chat Action.
public sendChatAction ( integer $chat_id, string $action ) : Array
$chat_id integer
$action string
Результат Array

sendContact() публичный Метод

Send Contact.
public sendContact ( integer $chat_id, $phone_number, string $first_name, string $last_name = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$first_name string
$last_name string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendDocument() публичный Метод

Send Document.
public sendDocument ( integer $chat_id, string $document, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$document string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendLocation() публичный Метод

Send Location.
public sendLocation ( integer $chat_id, float $latitude, float $longitude, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$latitude float
$longitude float
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendMessage() публичный Метод

Send text messages.
public sendMessage ( integer $chat_id, string $text, string $parse_mode = null, boolean $disable_web_page_preview = false, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$text string
$parse_mode string
$disable_web_page_preview boolean
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendPhoto() публичный Метод

Send Photos.
public sendPhoto ( integer $chat_id, string $photo, string $caption = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$photo string
$caption string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendSticker() публичный Метод

Send Sticker.
public sendSticker ( integer $chat_id, string $sticker, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$sticker string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendVenue() публичный Метод

Send Venue.
public sendVenue ( integer $chat_id, float $latitude, float $longitude, string $title, string $address, string $foursquare_id = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$latitude float
$longitude float
$title string
$address string
$foursquare_id string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendVideo() публичный Метод

Send Video.
public sendVideo ( integer $chat_id, string $video, integer $duration = null, string $caption = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$video string
$duration integer
$caption string
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

sendVoice() публичный Метод

Send Voice.
public sendVoice ( integer $chat_id, string $audio, integer $duration = null, integer $reply_to_message_id = null, KeyboardMarkup $reply_markup = null ) : Array
$chat_id integer
$audio string
$duration integer
$reply_to_message_id integer
$reply_markup KeyboardMarkup
Результат Array

setWebhook() публичный Метод

Set a Webhook to receive incoming updates via an outgoing webhook.
public setWebhook ( string $url, $certificate = null ) : Array
$url string HTTPS url to send updates to. Use an empty string to remove webhook integration
Результат Array

Описание свойств

$token защищенное свойство

protected $token