Archived
1
0
Fork 0
This repository has been archived on 2020-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
news-script/Publisher/Telegram.php

24 lines
602 B
PHP

<?php
class Telegram extends Publisher {
protected $client;
protected $chat_id;
public function __construct($config) {
super::__construct($config);
if ($config['TELEGRAM'] === true) {
$this->chat_id = $config['TELEGRAM_CHAT_ID'];
$this->client = new Longman\TelegramBot\Telegram(
$config['TELEGRAM_API_KEY'],
$config['TELEGRAM_BOT_NAME']
);
}
}
public function _publish(string $text): void {
\Longman\TelegramBot\Request::sendMessage([
'chat_id' => $this->chat_id,
'text' => $text,
'parse_mode' => 'Markdown'
]);
}
}