TGViewer
PWRTelegram API channel PWRTelegram API channel @pwrtelegram · 719 subscribers
Post #505 735

Forwarded from MadelineProto | Official Channel (Daniil Gentili)

MadelineProto was updated (8.0.0-beta101)!

After introducing plugins », bound methods », filters », a built-in cron system », IPC support for the event handler » and automatic static analysis for event handler code » in beta100, beta101 brings some bugfixes and the getDownloadLink function!

getDownloadLink can be used to fetch a direct download link for any file up to 4GB, even using a bot API file ID!

Other features:
- Added an openFileAppendOnly function, that can be used to asynchronously open a file in append-only mode!

Fixes:
- Improved the markdownEscape function!
- Translated even more MadelineProto UI elements!
- Improve the static analyzer.
- Made some fixes to simple filters.
- Relax markdown parser.


Here's an example on how to use the new getDownloadLink() function:

<?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();

$link = $MadelineProto->getDownloadLink($MessageMedia);


$MessageMedia can be a a media object or even a bot API file ID (files up to 4GB are supported!).

You can also use the new getDownloadLink() bound method:

class MyEventHandler extends SimpleEventHandler {
/**
* 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());
}
}


In both cases, the download link will be generated automatically if running via web.

If running via cli (or if URL rewriting is enabled), an additional step is required, see the documentation for more info.
docs.madelineproto.xyz Plugins MadelineProto offers a native plugin system, based on event handlers!
More from @pwrtelegram
  1. May 11, 2025And then, a long overdue post about my Autonomous System (AS198747), and an over more over…
  2. May 11, 2025The first series of posts I'll be adding here will be some technical deep dives into the p…
  3. May 11, 2025Happy to announce I've launched a blog, where I'll be posting news about all my different…
  4. Aug 25, 2024#FreeDurov.
  5. May 30, 2024MadelineProto was updated! MadelineProto 8.1.0 introduces an official Grafana dashboard fo…
  6. Apr 27, 2024MadelineProto was updated! 8.0.0 is the first stable release of MadelineProto v8! For the…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →