如何解决downloadToFile方法madelineproto电报
我正在尝试从自己的服务器上的电报服务器下载某些媒体,我找到了某些媒体的文件ID,并以此方式使用它:
$new = 'CQACAgQAAxkBAAJHK18z8msj9lgi....';
$info = yield $MadelineProto->getDownloadInfo($new);
$output_file_name = yield $MadelineProto->downloadToFile($info,'10.mp3');
它创建了一个0 KB的文件,现在有人吗?
我也尝试使用onUpdateNewMessage方法获取文件ID,但是它返回了一个没有任何文件ID的数组,我试图在downloadToFile中使用它,但它甚至没有创建任何文件!!!
我尝试过
$output_file_name = yield $MadelineProto->downloadToFile($update,'10.mp3');
没有成功
$info = yield $MadelineProto->getDownloadInfo($update);
$output_file_name = yield $MadelineProto->downloadToFile($info,'10.mp3');
没有成功
$botAPI_file = yield $MadelineProto->MTProtoToBotAPI($update);
foreach (['audio','document','photo','sticker','video','voice','video_note'] as $type) {
if (isset($botAPI_file[$type]) && is_array($botAPI_file[$type])) {
$method = $type;
}
}
$result['file_type'] = $method;
if ($result['file_type'] == 'photo') {
$result['file_size'] = $botAPI_file[$method][0]['file_size'];
if (isset($botAPI_file[$method][0]['file_name'])) {
$result['file_name'] = $botAPI_file[$method][0]['file_name'];
$result['file_id'] = $botAPI_file[$method][0]['file_id'];
}
} else {
if (isset($botAPI_file[$method]['file_name'])) {
$result['file_name'] = $botAPI_file[$method]['file_name'];
}
if (isset($botAPI_file[$method]['file_size'])) {
$result['file_size'] = $botAPI_file[$method]['file_size'];
}
if (isset($botAPI_file[$method]['mime_type'])) {
$result['mime_type'] = $botAPI_file[$method]['mime_type'];
}
$result['file_id'] = $botAPI_file[$method]['file_id'];
}
if (!isset($result['mime_type'])) {
$result['mime_type'] = 'application/octet-stream';
}
if (!isset($result['file_name'])) {
$result['file_name'] = $result['file_id'].($method === 'sticker' ? '.webp' : '');
}
$output_file_name = yield $MadelineProto->downloadToFile($result['file_id'],'2.mp3');
我要做的就是将所有发送到特定机器人的媒体下载到我的服务器上。 有人可以帮助我吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。