\UbillingTelegram
Telegram bot API implementation
Synopsis
class UbillingTelegram
{
- // constants
- const QUEUE_PATH = 'content/telegram/';
- const MESSAGE_LIMIT = 4095;
- // members
- protected array $altCfg = ;
- protected string $botToken = '';
- protected bool $debug = false;
- protected string $apiUrl = 'https://api.telegram.org/bot';
- // methods
- public void __construct()
- public void setToken()
- public void setDebug()
- protected void loadAlter()
- protected void setOptions()
- protected void setApiUrl()
- public bool sendMessage()
- public int getQueueCount()
- public array getQueueData()
- public int deleteMessage()
- protected array getUpdatesRaw()
- public array getBotChats()
- public array getBotContacts()
- public array makeKeyboard()
- protected array splitMessage()
- public string/bool directPushMessage()
- protected string/bool apiSendMessage()
- public string setWebHook()
- public string getWebHookInfo()
- public array getChatInfo()
- public string getFilePath()
- public mixed downloadFile()
- protected array preprocessMessageData()
- public array getHookData()
Constants
Name | Value |
---|---|
QUEUE_PATH | 'content/telegram/' |
MESSAGE_LIMIT | 4095 |
Members
protected
- $altCfg
—
array
Contains system alter config as key=>value -
$apiUrl
Contains base Telegram API URL - $botToken
—
string
Contains current instance bot token - $debug
—
bool
Default debug flag wich enables telegram replies display
Methods
protected
- apiSendMessage() — Sends message to some chat id via Telegram API
- getUpdatesRaw() — Returns raw updates array
- loadAlter() — Loads system alter config into protected property for further usage
- preprocessMessageData() — Returns preprocessed message in standard, fixed fields format
- setApiUrl() — Setter of custom API URL (legacy fallback)
- setOptions() — Sets some current instance options if required
- splitMessage() — Split message into chunks of safe size
public
- __construct() — Creates new Telegram object instance
- deleteMessage() — Deletes message from local queue
- directPushMessage() — Sends message to some chat id using Telegram API
- downloadFile() — Returns some file content
- getBotChats() — Returns all messages received by bot
- getBotContacts() — Returns current bot contacts list as chat_id=>name
- getChatInfo() — Returns chat data array by its chatId
- getFilePath() — Returns file path by its file ID
- getHookData() — Returns webhook data
- getQueueCount() — Returns count of messages available in queue
- getQueueData() — Returns array containing all messages queue data as index=>data
- getWebHookInfo() — Returns bot web hook info
- makeKeyboard() — Preprocess keyboard for sending with directPushMessage
- sendMessage() — Stores message in telegram sending queue. Use this method in your modules.
- setDebug() — Object instance debug state setter
- setToken() — Sets current instance auth token
- setWebHook() — Sets HTTPS web hook URL for some bot