Telegram Bot Api:forwardMessage方法

时间:2016-06-30 20:26:23

标签: php telegram telegram-bot

我正在尝试在电报机器人API中转发消息。尽管在sendMessage中使用了相同的chat_id,但它显示“Bad Request:chat_id为空”并且工作正常。

请求方法

https://api.telegram.org/bot{BOT_TOKEN}/forwardMessage?chat_id={CHAT_ID}&from_chat_id={ID}&message_id={MID}

结果:

{"ok":false,"error_code":400,"description":"Bad Request: chat_id is empty"}

更新

在此link报告了sendPhoto和sendDocument中类似问题的错误。

1 个答案:

答案 0 :(得分:1)

根据您提供的信息,很难说出什么不起作用 我只能说我可以转发这样的消息

$post = array("from_chat_id" => $from_chat, "chat_id" => $to_chat, "message_id" => $m_id);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.telegram.org/bot" . $token . "/forwardMessage");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_exec ($ch);
curl_close ($ch);