Bad*_*chi 6 php channel telegram-bot
我在电报中创建了一个频道,并添加了一个机器人作为该频道的管理员。当我向频道发送消息时,机器人没有回复,为什么?
我可以使用/sendmessage发送消息
https://api.telegram.org/bot[key]/sendmessage?chat_id=@MyChannelID&text=此文本是从机器人到频道的。
我正在使用: https: //github.com/Eleirbag89/TelegramBotPHP
这是一个简单的机器人测试代码:
<?php
include 'connection.php';
include("Telegram.php");
define('bot_id', '227493781:AAE2x0l3BRrjGN3S8wMVo9zOTYbbwr8');
$telegram = new Telegram(bot_id);
$text = $telegram->Text();
$chat_id = $telegram->ChatID();
if ($text == "call") {
$content = array('chat_id' => $chat_id, 'text' => "This is test message!!!");
$telegram->sendMessage($content);
}
?>
Run Code Online (Sandbox Code Playgroud)