You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GeekQu_sspanel/app/Utils/Telegram.php

40 lines
934 B
PHTML

9 years ago
<?php
namespace App\Utils;
use App\Services\Config;
8 years ago
use Exception;
use TelegramBot\Api\BotApi;
9 years ago
class Telegram
{
/**
8 years ago
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
9 years ago
*/
public static function Send($messageText)
{
if (Config::get('enable_telegram') == 'true') {
8 years ago
$bot = new BotApi(Config::get('telegram_token'));
8 years ago
try {
$bot->sendMessage(Config::get('telegram_chatid'), $messageText);
8 years ago
} catch (Exception $e) {
echo $e->getMessage();
}
9 years ago
}
}
8 years ago
9 years ago
public static function SendMarkdown($messageText)
{
if (Config::get('enable_telegram') == 'true') {
8 years ago
$bot = new BotApi(Config::get('telegram_token'));
8 years ago
try {
8 years ago
$bot->sendMessage(Config::get('telegram_chatid'), $messageText, 'Markdown');
} catch (Exception $e) {
echo $e->getMessage();
}
9 years ago
}
}
}