PHP Class telegramBot

Exibir arquivo Open project: mgp25/telegram-bot-api Class Usage Examples

Protected Properties

Property Type Description
$token

Public Methods

Method Description
__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.

Private Methods

Method Description
sendRequest ( $method, $params )
uploadFile ( $method, $data )

Method Details

__construct() public method

public __construct ( $token )

forceReply() public static method

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
return string

forwardMessage() public method

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
return Array

getFile() public method

Use this method to get basic info about a file and prepare it for downloading.
public getFile ( String $file_id ) : On
$file_id String
return On success, a File object is returned

getFileData() public method

Use this method to get file Data.
See also: getFile
public getFileData ( string $file_id, string $file_path ) : On
$file_id string
$file_path string Is taken from the getFile response
return On success, a File Data is returned

getMe() public method

Returns basic information about the bot in form of a User object.
public getMe ( ) : Array
return Array

getUserProfilePhotos() public method

Get user profile photos.
public getUserProfilePhotos ( $user_id, integer $offset = null, integer $limit = null ) : Array
$offset integer
$limit integer
return Array

getWebhookUpdates() public method

Works only if you set a webhook.
See also: setWebhook
public getWebhookUpdates ( ) : Array
return Array

pollUpdates() public method

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
return Array

replyKeyboardHide() public static method

Hide the current custom keyboard and display the default letter-keyboard.
public static replyKeyboardHide ( boolean $selective = false ) : string
$selective boolean
return string

replyKeyboardMarkup() public method

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
return string

sendAudio() public method

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
return Array

sendChatAction() public method

Send Chat Action.
public sendChatAction ( integer $chat_id, string $action ) : Array
$chat_id integer
$action string
return Array

sendContact() public method

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
return Array

sendDocument() public method

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
return Array

sendLocation() public method

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
return Array

sendMessage() public method

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
return Array

sendPhoto() public method

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
return Array

sendSticker() public method

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
return Array

sendVenue() public method

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
return Array

sendVideo() public method

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
return Array

sendVoice() public method

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
return Array

setWebhook() public method

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
return Array

Property Details

$token protected_oe property

protected $token