【发布时间】:2016-10-01 17:56:43
【问题描述】:
我在电报中创建了一个频道,并添加了一个机器人作为频道的管理员。当我向频道发送消息时,机器人没有回答,为什么?
我可以使用 /sendmessage
发送消息https://api.telegram.org/bot[key]/sendmessage?chat_id=@MyChannelID&text=This 文字是从机器人到频道。
我正在使用: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);
}
?>
【问题讨论】:
-
您是否在
@BotFather中设置了/setprivacy? -
是的,我启用了隐私,机器人是频道的管理员之一。聊天机器人在群聊中有响应,但在频道中没有。
标签: php channel telegram-bot