Add progress for renaming
This commit is contained in:
parent
e2fb6dbfe6
commit
f64efb021c
@ -88,8 +88,9 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
}
|
||||
if (isset($this->states[$peerId])) {
|
||||
$name = $update['message']['message'];
|
||||
list($file, $id) = $this->states[$peerId];
|
||||
list($url, $id) = $this->states[$peerId];
|
||||
unset($this->states[$peerId]);
|
||||
$method = 'uploadFromTgFile';
|
||||
} else {
|
||||
$url = \explode(' ', $update['message']['message'], 2);
|
||||
$name = \trim($url[1] ?? \basename($update['message']['message']));
|
||||
@ -100,9 +101,10 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
if (\strpos($url, 'http') !== 0) {
|
||||
$url = "http://$url";
|
||||
}
|
||||
|
||||
$method = 'uploadFromUrl';
|
||||
}
|
||||
$id = yield $this->messages->sendMessage(['peer' => $peerId, 'message' => 'Preparing...', 'reply_to_msg_id' => $messageId])['id'];
|
||||
$file = yield $this->uploadFromUrl(new \danog\MadelineProto\FileCallback(
|
||||
$file = yield $this->$method(new \danog\MadelineProto\FileCallback(
|
||||
$url,
|
||||
function ($progress) use ($peerId, $id) {
|
||||
static $prev = 0;
|
||||
@ -117,7 +119,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
yield $this->messages->sendMedia(
|
||||
[
|
||||
'peer' => $peerId,
|
||||
|
Loading…
Reference in New Issue
Block a user