PHP code example of valentino / telegram-bot-message-extension
1. Go to this page and download the library: Download valentino/telegram-bot-message-extension library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
valentino / telegram-bot-message-extension example snippets
use TelegramBotMessageExtension\Message;
$id = 0; // telegram channel id
$token = ''; // telegram bot token
// create a message object
$message = new Message($token, $id);
//send single text message
$singleMessage = $message->sendSingleMessage("<b>Hi!</b>\n<i>There</i>\n", "HTML");
//send sticker
$sticker = $message->sendSticker('CAACAgIAAxkBAAETkGNiblYnE7xLE5GJ1kABRAaf3WTd4QACrxQAAs7y2UmyHBuHGFJROCQE');
//send a queue. parameter must be an array of arrays, that describes each message. [[],[],[]]
$queue = $message->sendMessagesQueue([
[
'method' => 'sendMessage',
'delay' => 2000000,
'param' => [
'text' => '<i>Hello!</i>',
'parse_mode' => 'HTML'
]
],[
'method' => 'sendSticker',
'delay' => 2000000,
'param' => [
'sticker' => 'CAACAgIAAxkBAAETkGNiblYnE7xLE5GJ1kABRAaf3WTd4QACrxQAAs7y2UmyHBuHGFJROCQE'
]
]
]);