Closed foremtehan closed 1 year ago
Make sure the dl.php points to exactly the same session your bot is using.
this is from bot.php
MyEventHandler::startAndLoopBot('bot.madeline', 'MY_BOT_TOKEN', $settings);
and this is dl.php: (i copied this from previous error)
<?php require __DIR__.'/../vendor/autoload.php'; \danog\MadelineProto\API::downloadServer('/app/bot.madeline'); ?>
if it does help, it's also the /app structure:
bot.madeline
composer.json
composer.lock
docker-compose.yml
src
vendor
src folder:
.
..
bot.php
dl.php
madeline-d4321f2b52943273b62fa1a9b192d6eab236cfb2-81.phar
madeline-d4391f2b51943373b62fa2a9b192d6eab236cfb2-81.phar.lock
madeline.php
madeline.version
I've relaxed the dl.php checks in beta107, try checking now!
I update to 108 and also update examples/bot.php file
this time nothing happend when i send /dl
Hmm, could I get full logs?
OK fixed in beta109
i already pass the dl.php in bot.php file
/**
* Gets a download link for any file up to 4GB!
*/
#[FilterCommand('dl')]
public function downloadLink(Incoming&Message $message): void
{
if (!$message->replyToMsgId) {
$message->reply("This command must reply to a media message!");
return;
}
$message = $message->getReply();
if (!$message instanceof Message || !$message->media) {
$message->reply("This command must reply to a media message!");
return;
}
$message->reply("Download link: ".$message->media->getDownloadLink('https://my-domain/dl.php'));
}
bot got error:
APIWrapper, phpunitBot: Exception: Could not generate default download script (Please specify a download script URL when using getDownloadLink via CLI!), please create a dl.php file with the following content: <?php require 'vendor/autoload.php'; \danog\MadelineProto\API::downloadServer('/app/bot.madeline'); ?> and pass its URL to the second parameter of getDownloadLink in /app/vendor/danog/madelineproto/src/MTProtoTools/FileServer.php:89
Stack trace:
#0 /app/vendor/danog/madelineproto/src/EventHandler/Media.php(85): danog\MadelineProto\MTProto->getDownloadLink(Object(danog\MadelineProto\EventHandler\Media\Document), NULL)
#1 /app/src/bot.php(199): danog\MadelineProto\EventHandler\Media->getDownloadLink()
#2 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(406): MyEventHandler->downloadLink(Object(danog\MadelineProto\EventHandler\Message\PrivateMessage))
#3 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(596): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#4 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#5 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(406): Fiber->resume(Array)
#6 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(542): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#7 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#8 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(406): Fiber->resume(Array)
#9 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(596): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#10 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#11 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(406): Fiber->resume(NULL)
#12 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(596): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#13 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#14 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(406): Fiber->resume(NULL)
#15 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(542): Revolt\EventLoop\Internal\AbstractDriver->invokeMicrotasks()
#16 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#17 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(479): Fiber->start()
#18 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(533): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#19 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#20 /app/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(86): Fiber->resume()
#21 /app/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php(97): Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#22 /app/vendor/amphp/amp/src/Future.php(251): Revolt\EventLoop\Internal\DriverSuspension->suspend()
#23 /app/vendor/danog/madelineproto/src/Wrappers/Loop.php(124): Amp\Future->await()
#24 /app/vendor/danog/madelineproto/src/AbstractAPI.php(92): danog\MadelineProto\MTProto->loop()
#25 /app/vendor/danog/madelineproto/src/AbstractAPI.php(73): danog\MadelineProto\AbstractAPI->startAndLoopLogic('MyEventHandler', true)
#26 /app/vendor/danog/madelineproto/src/EventHandler.php(93): danog\MadelineProto\AbstractAPI->startAndLoopInternal('MyEventHandler')
Try restarting the container to reload the code (docker restart containername)
got this 1st error but it says diff session and print the html
Try opening the link you provided in the browser, you should get a "Telegram file download server (up to 4GB), powered by MadelineProto! Click here for more info on how to setup your very own Telegram file download server!" message
I can see it
Telegram file download server (up to 4GB), powered by MadelineProto! Click here for more info on how to setup your very own Telegram file download server!
i ran a local server with php and can also see the logs:
/app # php -S 0.0.0.0:8000 -t src [Wed Jul 19 07:02:24 2023] PHP 8.2.8 Development Server (http://0.0.0.0:8000) started [Wed Jul 19 07:02:30 2023] 172.18.0.1:36798 Accepted [Wed Jul 19 07:02:30 2023] 172.18.0.1:36798 [200]: GET /dl.php [Wed Jul 19 07:02:30 2023] 172.18.0.1:36798 Closing
i test this in github code space, can it be issue ?
Ah yes, this might be the issue then, try running on a server or on your local machine
While i setup the local env, i see phpstorm show warnings dont know if it true or not:
Stay tuned...
Yeah it's technically correct but I decided to avoid creating a huge inheritance tree just to make simple filters work, so I went with the easier path of making every update extend every simple filter and doing the filtering externally with reflection.
TL;DR you can ignore that warning
This is working now! (wsl/docker)
But looks like it has problem on videos, I've got error when i replied on a video:
Another issue, It set content-type to pdf for all files (IDM in windows append .pdf when downloading)
i can send you link if you're online
OK this should all be fixed in beta110
Everything looks good! thanks for your time
madeline 105 / docker
I used this snippet: https://github.com/danog/MadelineProto/blob/v8/examples/bot.php
replaced it wait my dl.php url:
when i reply in chat on the file with
/dl
i will get this error:when i visit
/dl.php
, i can see: