From 597c0519486fcb5528b176db5a2f340103d96ad1 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Mon, 10 Mar 2025 13:35:45 +0700 Subject: [PATCH] Telegram message to topik --- system/autoload/Message.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/system/autoload/Message.php b/system/autoload/Message.php index 3f632e46..9dc6d520 100644 --- a/system/autoload/Message.php +++ b/system/autoload/Message.php @@ -17,15 +17,18 @@ require $root_path . 'system/autoload/mail/SMTP.php'; class Message { - public static function sendTelegram($txt, $chat_id = null) + public static function sendTelegram($txt, $chat_id = null, $topik = '') { global $config; - run_hook('send_telegram', [$txt, $chat_id = null]); #HOOK + run_hook('send_telegram', [$txt, $chat_id, $topik]); #HOOK if (!empty($config['telegram_bot'])) { if (empty($chat_id)) { $chat_id = $config['telegram_target_id']; } - return Http::getData('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $chat_id . '&text=' . urlencode($txt)); + if (!empty($topik)) { + $topik = "message_thread_id=$topik&"; + } + return Http::getData('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?'.$topik.'chat_id=' . $chat_id . '&text=' . urlencode($txt)); } }