我想使用MadelineProto从电报通道获取所有消息。我根据他们的文档执行了以下步骤:https://docs.madelineproto.xyz/API_docs/methods/messages.getHistory.html
以下是我的代码
<?php
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$channel = '-1001433544229';
$offset_id = 0;
$limit = 100;
$messages_Messages = $MadelineProto->messages->getHistory(
['peer' => $channel,
'offset_id' => 0,
'offset_date' => 0,
'add_offset' => 0,
'limit' => $limit,
'max_id' => 9999999999,
'min_id' => 0,
'hash' => 0]);
echo json_encode($messages_Messages);
问题是它返回一个空对象。问题出在哪里?会不会有一个更新,我们不能再从Telegram的通道中检索消息了?提前谢谢。
发布于 2021-02-06 05:25:09
在询问了madeline proto社区的一些人之后,结果发现解决方案只是添加了
$MadelineProto->async(false)
在$MadelineProto->start();方法之后。
https://stackoverflow.com/questions/66016579
复制相似问题