MadelineProto | Persian Channel
332 subscribers
3 photos
1 file
44 links
کانال تلگرامی MadelineProto Farsi !
مرجع آموزش و آپدیت های مدلین به زبان فارسی!

👥 Persian Group: https://t.me/joinchat/DtxwN0RlsQoKyN-lpSuOEw

👥 English Group: https://t.me/joinchat/Bgrajz6K-aJS2Dc5HJ7dsA

📢 English Channel:
@MadelineProto
Download Telegram
من همچنین برخی از به روز رسانی ها را برای کانال های اجتماعی MadelineProto اعلام می کنم.

- معرفی گروههای چت جداگانه OT، تا امکان گفتگو در مورد فناوری ، سیاست و الگوهای رفتاری فراهم شود.
- معرفی یک گروه پشتیبانی بین المللی جدید MadelineProto برای کمک و پشتیبانی MadelineProto
- در آخر معرفی کانال رسمی meme MadelineProto ، تنها مملو از ممتازهای مبتنی بر الگوهای رفتاری!
- معرفی یک گروه گفتگوی رسمی برای AMPHP ، async و کتابخانه PHP موازی سازی شده با عملکرد بالا و کارآمد!

همچنین ، در انتها معرفی یک کانال رسمی فارسی MadelineProto:
@madeline_farsi
این کانال ترجمه های فارسی ارسال شده در کانال اصلی را به همراه منابع MadelineProto ، نکات AMPHP و موارد دیگر منتشر خواهد کرد!
https://t.me/c/1355706999/5
AMPHP چیست؟

Amp یک چارچوب همزمانی غیر مسدودکننده است که پی اچ پی را برای مدیریت همزمان از قبیل event loop ، promises و تکرارهای ناهمزمان فراهم می کند.

خوب، به عبارت ساده تر؟

AMPHP یک کتابخانه PHP با کارایی بالا و موازی است که به شما امکان می دهد برنامه هایی بسیار سریع و کارآمد بنویسید که به طور موازی با استفاده از تِردهای سبز کار می کنند.

* b r a i n m e l t *

بله!

---

MadelineProto در PHP نوشته نشده است: MadelineProto با استفاده از AMPHP نوشته شده است.
این بدان معنی است که وقتی از MadelineProto استفاده می کنید (و async فعال است) ، تمام پیام های دریافتی به صورت موازی ، هر یک در یک ترد جداگانه ، حتی در هاست های وب (هاست اشتراکی) هندل می شوند.

این امر به شما امکان می دهد تا رباتهای شما همیشه پاسخگو باشند ، حتی هنگام انجام کارهای پیچیده.

با این وجود ، بسیار مهم است که هنگام نوشتن ربات خود از AMPHP (نه PHP!) نیز استفاده کنید.
معنی این امر اینست که توابع PHP و پسوندهای زیر نمی توانند در رباتهای MadelineProto استفاده شوند (در غیر این صورت همه مزایای AMPHP باطل می شوند): در عوض ، شما باید از کتابخانه صحیح AMPHP (که بطور خودکار در madeline.php درج شده است) استفاده کنید.

file_get_contents
amphp/file برای فایلها ، amphp/http-client و $MadelineProto->fileGetContents برای آدرس های اینترنتی

curl, guzzle
amphp/http-client بصورت async است ، خیلی سریعتر از سایر کتابخانه ها ، و همچنین از HTTP/2 پشتیبانی می کند!

mysqli, PDO, sqlite
amphp/mysql از پشتیبان MySQL و SQLite پشتیبانی می کند ، و کاملاً async است!
همچنین شما میتوانید از amphp/postgres و amphp/redis برای PostgreSQL و Redis استفاده کنید!

php-fpm
amphp/http-server یک سرور HTTP/2 با عملکرد بالا و async است که می تواند برای ایجاد سرورهای دانلود فایل با MadelineProto رابط باشد!

include, require
از این عملکردها زیاد استفاده نکنید و از همه مهمتر ، آن را در داخل کلاس event handler استفاده نکنید.
شما باید هنگام راه اندازی بات ، فقط یک بار از آن استفاده کنید، یا در هنگام بارگیری مجدد ربات (به زودی سورس افزونه ارائه خواهد شد!)

---

به طور خلاصه ، AMPHP یک چارچوب عالی برای استفاده از PHP async در سال 2020 است: شما می توانید در صورت داشتن هرگونه سؤال یا پیشنهادی در مورد چیز دیگری که به AMPHP اضافه کنید می توانید به گروه رسمی تلگرامی پشتیبانی @amphpchat بپیوندید!
نسخه 5.1 میدلاین یک ویژگی خاص را ارائه می دهد:
native error reporting (گزارش خطاهای بومی).

گزارش خطای بومی، فرایند توسعه ربات های MadelineProto را بسیار ساده می کند.
به سادگی با مشخص کردن نام کاربری سرپرست ربات، کلیه خطاهای ایجاد شده توسط ربات(یا خود MadelineProto!) بطور خودکار به همراه فایل لاگ به مدیر گزارش می شوند.


در این نسخه شروع با استفاده از
unlink('MadelineProto.log');
میدلاین
را خراب میکند و کرش میکند.
در صورت نیاز به کاهش اندازه فایل لاگ، به این صورت کانفیگ کنید: $settings['logger']['max_size'] (minimum 100kb = 100*1000).

یک نمونه سورس برای MadelineProto 5.1:

<?php

if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

use danog\MadelineProto\EventHandler;
use danog\MadelineProto\Tools;
use danog\MadelineProto\API;
use danog\MadelineProto\Logger;
use danog\MadelineProto\RPCErrorException;

/**
* Event handler class.
*/
class MyEventHandler extends EventHandler
{
/**
* @var int|string Username or ID of bot admin
*/
const ADMIN = "danogentili"; // Change this
/**
* Get peer(s) where to report errors
*
* @return int|string|array
*/
public function getReportPeers()
{
return [self::ADMIN];
}
/**
* Called on startup, can contain async calls for initialization of the bot
*
* @return void
*/
public function onStart()
{
}
/**
* Handle updates from supergroups and channels
*
* @param array $update Update
*
* @return void
*/
public function onUpdateNewChannelMessage(array $update): \Generator
{
return $this->onUpdateNewMessage($update);
}
/**
* Handle updates from users.
*
* @param array $update Update
*
* @return \Generator
*/
public function onUpdateNewMessage(array $update): \Generator
{
if ($update['message']['_'] === 'messageEmpty' || $update['message']['out'] ?? false) {
return;
}
$res = \json_encode($update, JSON_PRETTY_PRINT);

try {
yield $this->messages->sendMessage(['peer' => $update, 'message' => "<code>$res</code>", 'reply_to_msg_id' => $update['message']['id'] ?? null, 'parse_mode' => 'HTML']);
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
}
} catch (RPCErrorException $e) {
$this->report("Surfaced: $e");
} catch (Exception $e) {
if (\stripos($e->getMessage(), 'invalid constructor given') === false) {
$this->report("Surfaced: $e");
}
}
}
}

$settings = [];

$MadelineProto = new API('bot.madeline', $settings);
$MadelineProto->startAndLoop(MyEventHandler::class);


متد جدید startAndLoop بصورت خودکار میدلاین را آماده سازی کرده ، async را فعال میکند، حالت لاگ را آماده میکند ، حالت گزارش خطا را آماده سازی میکند، بصورت try & cache رفتار میکند و همه خطاهایی که در کلاس event در ارتباط با peer ها رخ میدهد را نگه داری کرده و با استفاده از متد getReportPeers قابل دریافت و گزارشگیری هستند.

همچنین کمک می کند به عدم تکرار در تعاریف و کدها و اضافات $MadelineProto->loop() که در سورسهای بهم ریختگی ایجاد کرده است را حذف می کند.
از میان سایر ویژگی های جدید ، می توان از متد onStart بصورت async برای اجرای متدها در هنگام راه اندازی ربات (به جای $MadelineProto->loop() خارج از ربات) استفاده کرد.
درمورد اهمیت لاگ گیری:

برای یک برنامه نویس ، برنامه نویسی بدون لاگ مانند رانندگی با چشمان بسته است: هر لحظه می توانستید با یک دیوار تصادف کنید ، و حتی نمی خواهید در آینده با آن مواجه شوید.

بسیاری از مواقع می بینم که کاربران MadelineProto از من درخواست کمک می کنند و می گویند که "رباتهایشان کار نمی کنند" یا "دیروز کار میکرده" ، و اغلب من را به خاطر اشتباهات خودشان سرزنش می کنند.

این دقیقاً به همین دلیل است که شما نیاز به لاگ دارید: با لاگ، می توانید بفهمید که چه اشتباهی در کدتان (یا سورس من!) رخ داده است، و فوراً خطا را برطرف کنید.

اکنون MadelineProto به شما اجازه می دهد گزارش خطای خودکار را با لاگ کامل و ردیابی اکسپشن ها به محض کرش اسکریپت انجام دهید (به طور خودکار بازیابی ربات از هرگونه خطا) .

اگر لاگ فعال باشد و از getReportPeers + startAndLoop استفاده کنید: این یک ویژگی بسیار مفید برای دولاپرها است ، و می تواند به شما کمک کند تا قبل از اینکه کاربران متوجه خطا و مشکل شوند، شما مشکلات را پیدا کرده و برطرف کنید.


منابع:
- Error reporting
- Logging
- Exceptions
آموزش استفاده از نسخه جدید میدلاین (قابلیت استفاده از MySQL بجای رم) روی هاست

سلام دوستان
همونطور که شاید بدونین میدلاین هنوز این نسخه رو بصورت phar منتشر نکرده و فقط روی سرور و با استفاده از composer میشه از این ورژن استفاده کرد
ولی من یه نسخه غیر رسمی از این ورژن رو برای هاست ها آماده کردم که میتونین موقتا تا آپدیت جدید میدلاین برای هاست ها از این نسخه استفاده کنین

برای نصب نسخه غیر رسمی میدلاین باید توی سورستون بجای تکه کد:
if (!file_exists('madeline.php')) {
copy('http://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

شما باید تکه کد پایین رو جایگزین کنین:
if (!file_exists('MadelineProto.php')) {
copy('https://MadelineProto.realsamy.ir/', 'MadelineProto.php');
}
include 'MadelineProto.php';

این تکه کد بجای نسخه رسمی قدیمی میدلاین، نسخه غیررسمی جدید (با قابلیت استفاده از MySQL بجای رم) رو نصب میکنه
البته بخاطر phar نبودن این نسخه و مدت زمانی که برای extract کردن فایل لازمه، نصب این فایل ممکنه یکم بیشتر از نسخه های قبلی طول بکشه (چون حجم فایل حدود 100 مگابایته)

ضمنا برای فعال کردن استفاده از MySQL باید از تنظیمات پایین توی سورستون استفاده کنین:
$settings = [
'db' => [
'type' => 'mysql',
'mysql' => [
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'USERNAME',
'password' => 'PASSWORD',
'database' => 'DATABASE',
]
],
];

استفاده از این نسخه یه سری توضیحات لازم داره
اول اینکه این نسخه فقط برای ورژن پی اچ پی 7.4 به بالا هست و روی نسخه های پایینتر پی اچ پی جواب نمیده.
دوم اینکه برای اتصال به دیتابیس هاست پیشفرض همونطور که میبینید 127.0.0.1 هست که برای خودم روی هاست سیپنل جواب نداد و آیپی هاستینگ که توی صفحه اصلی سیپنل با اسم Shared IP Address مشخص شده جواب داد، ترجیحا اول آیپی پیشفرض رو تست کنین و اگه جواب نگرفتین آیپی هاستینگ رو استفاده کنین!

خیلی مخلصیم❤️
Sorry about all of this drama guys, didn't mean to hurt anyone.
MadelineProto is a free and open source project, and people can do what they want with it, I can't control you.

You can earn money on your sources, you can obfuscate your sources.

Personally, I do not approve of spamming and flooding with MadelineProto, and I would very much appreciate if a percentage of your earnings was contributed to me, as the developer of the original library.
However, if you decide to obfuscate sell your source, I'm 100% fine with it.

Previously some deobfuscated sources were posted on the official @madeline_farsi channel without the permission of the original creators, and in violation of internal MadelineProto admin rules.

I'm sorry about this, won't happen again.

The only thing I want is an open and international MadelineProto community with lots of sources and resources for MadelineProto users.
I don't have much time to work on MadelineProto myself these days, but I always appreciate people taking their time to help out the MadelineProto community.

Thank you all for the support ❤️
سلام به تمام اعضای کانال بزرگ میدلاین
چند روز پیش بنا به درخواست شما و بی احتیاطی بنده سورسی از یکی از دوستان بصورت دیکد شده در کانال قرار گرفت و باعث رنجش و آزرده خاطر شدن بعضی از دوستان شد
هدف ما فقط نشان دادن قدرت کتابخانه میدلاین بود که باعث نقض قوانین کپی رایت شد
بابت این اتفاق ازتون معذرت می‌خوام
#صفا

Hello to all members of the big madeline channel
A few days ago, at your request and with the carelessness of my servant, a source from a friend was decoded on the channel and caused annoyance and annoyance to some friends.
Our only goal was to show the power of the madeline Library, which violated copyright laws
I apologize for this
#Safa
MadelineProto | Persian Channel
Sorry about all of this drama guys, didn't mean to hurt anyone. MadelineProto is a free and open source project, and people can do what they want with it, I can't control you. You can earn money on your sources, you can obfuscate your sources. Personally…
با عرض پوزش در مورد همه این اتفاقات، هدف ما صدمه زدن به کسی نیست.
میدلاین یک پروژه آزاد و منبع باز است و مردم می توانند آنچه را که می خواهند با آن انجام دهند ، من نمی توانم شما را کنترل کنم.

می توانید از منابع خود درآمد کسب کنید ، می توانید منابع خود را دچار مشکل کنید.

به شخصه ، من ارسال پیام مکرر با میدلاین را تأیید نمی کنم ، و اگر درصدی از درآمد شما به عنوان توسعه دهنده کتابخانه اصلی به من کمک می کرد ، ممنون میشدم.
با این حال ، اگر تصمیم دارید که سورس انکد شده خود را به فروش برسانید ، من 100٪ با آن موافق هستم.

پیش از این برخی از سورس های دیکد شده بدون مجوز از سازندگان اصلی در کانال رسمی madeline_farsi ارسال شده بودند و شامل نقض قوانین داخلی میدلاین بودند.

با عرض پوزش در مورد این اتفاق ، تکرار نمیشود.

تنها چیزی که من می خواهم یک جامعه باز و بین المللی میدلاین است که دارای سورس و منابع زیادی برای کاربران میدلاین است.
من این روزها وقت زیادی برای کار کردن در کتابخانه میدلاین ندارم ، اما من همیشه از افرادی که وقت خود را صرف کمک به جامعه میدلاین می کنند قدردانی می کنم.

با تشکر از همه شما برای حمایت❤️
One more thing: I can't just replace my entire admin team just because someone tells me to.

As I said too many times, I don't know the language, and I just need to trust people, trust that they won't betray me.
The only thing I can do is just ask everyone to behave their very best, and apologize, if they did wrong.

MadelineProto is an MTProto library; the MadelineProto community is diverse and (very) iranian; MadelineProto is not about drama and rudeness.

This is a call to action both for users and admins: please, be nice to each other, recognize your mistakes and accept apologies.

MadelineProto is not about drama, MadeineProto is an MTProto library.
Let's keep it that way.
در حالی که همه ما منتظر MadelineProto 6 هستیم ، در اینجا چند منبع پلاگین کاملاً شسته و رفته کاملاً همگام برای MadelineProto وجود دارد:


realGuys/MadelineProtoPluginSystem -
یک مثال و بیس ساده جهت استفاده از افزونه ساده و در عین حال قدرتمند میدلاین پروتو به صورت پلاگین.

MohsenJS/MadelineProtoPluginSystem -
یک سیستم پلاگین MadelineProto با پشتیبانی از الگوهای و گفتگوها


در صورتی که شما چیز دیگری را بر پایه ی میدلاین پروتو توسعه داده اید، می توانید من را در گروه ها صدا بزنید، من آن را در این کانال منتشر خواهم کرد.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
MadelineProto was updated!

MadelineProto 6 introduces ultra-fast startup with a built-in IPC server, PHP transpilation using phabel.io, MySQL/Postgres/redis database support to reduce RAM usage, and new, IDE-friendly settings.

The main event:
- MadelineProto is now transpiled using phabel.io!

Phabel.io is a PHP transpiler that allows native usage of PHP 8+ features in projects and libraries, while allowing maintainers to publish a version targeting lower versions of php.
Async await syntax is also supported!

Usage:
composer require --dev phabel/phabel

You can now publish your packagist package, and it will be automatically transpiled to any PHP version supported by phabel.

After git tagging a new release, just run:

vendor/bin/phabel publish

💡 Your PHP 7 users can now install your PHP 8 library 💡
💡 All your dependencies will also be transpiled to the correct PHP version. 💡

Supported PHP versions:

Syntax/feature support:
- 8.0+
- async/await syntax

Target:
- 7.1+
- 🐘 5.6, 7.0 in final testing stage.
- 💡 5.4, 5.5 support coming soon!

- Now MadelineProto has a built-in IPC server, this means:

Very fast startup for small scripts: ~0.02 seconds, before was 1-5 seconds

To use this IPC server, just use MadelineProto normally:

$API = new \danog\MadelineProto\API('session.madeline');
$API->start();
$API->messages->sendMessage(['peer' => $_POST['peer'], 'message' => $_POST['message']]);

This is useful for small sendMessage.php scripts, to be called from outside; for maximum performance in bots use an async event handler.

- New IDE-friendly settings API!
- Async MySQL/Postgres/redis integration:

Use a database to reduce memory usage to 1-5 MB even for thousands of groups!
See here for examples and documentation.
Native database integration in the event handler is also now supported!

Other brand-new features in MadelineProto 6:
- New PHP API documentation
- Updated Telegram API to layer 131
- Updated tg-file-decoder library
- New localization keys for all UI elements
- New settings for custom HTML, Javascript and CSS in login page templates
- New PSR logger API
- New session conversion API

Coming up soon: **** **IP implementation ;)

Internal improvements:
- Many, many bugfixes, stability fixes and performance improvements
- RPC requests are containerized by default, when possible
- Complete refactoring of MTProto message subsystem
- Added a periodic garbage collector
- Implemented native PHP prime factorization (C++ factorization is still recommended using prime.madelineproto.xyz)
MadelineProto | Persian Channel pinned «MadelineProto was updated! MadelineProto 6 introduces ultra-fast startup with a built-in IPC server, PHP transpilation using phabel.io, MySQL/Postgres/redis database support to reduce RAM usage, and new, IDE-friendly settings. The main event: - MadelineProto…»
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Introducing MadelineProto 7!

This update is mandatory for all MadelineProto users.

Due to 64-bit user IDs and Telegram's new API TOS, starting from January 1, 2022, old MadelineProto instances will stop working completely: even now, legacy instances can't login due to UPDATE_APP_TO_LOGIN errors.

If you're using MadelineProto 1 through 6, visit the releases page to view changelogs and upgrade tips.
You can also open an issue or visit the support group if you encounter issues while upgrading.

For most usecases, no changes are needed: however, graphical clients based on MadelineProto must implement sponsored messages.

Features:
- MadelineProto 7 provides a simple cached API to work with sponsored messages:
=> getSponsoredMessages
Get sponsored messages for channel, returns a list of sponsored message objects.
=> viewSponsoredMessage
Mark sponsored message as read.

Clients must then handle fetched sponsored messages as described in the API documentation.

- Layer 135! See the API documentation for a list of changed methods and constructors in layer 131-133.
Changes in layer 133-135:

Added methods:
- account.setAuthorizationTTL
- account.changeAuthorizationSettings
- messages.getSearchResultsCalendar
- messages.getSearchResultsPositions
- messages.hideChatJoinRequest
- messages.hideAllChatJoinRequests
- messages.toggleNoForwards
- messages.saveDefaultSendAs
- channels.getSendAs

Changed methods:
- Renamed channels.deleteUserHistory to channels.deleteParticipantHistory; the old method still works.
- Added base_theme param to account.installTheme
- Added min_date, max_date params to messages.deleteHistory
- Added send_as param to messages.sendMessage, messages.sendMedia, messages.sendMultiMedia, messages.forwardMessages, messages.sendInlineBotResult
- Added request_needed, title params to messages.exportChatInvite, messages.editExportedChatInvite
- Added requested, q params to messages.getChatInviteImporters
- Renamed user_id=>participant in channels.reportSpam


Changed Constructors
- Added requests_pending param to chatFull
- Added recent_requesters param to chatFull
- Added requests_pending param to channelFull
- Added recent_requesters param to channelFull
- Added default_send_as param to channelFull
- Added request_chat_broadcast param to peerSettings
- Added request_chat_title param to peerSettings
- Added request_chat_date param to peerSettings
- Added private_forward_name param to userFull
- Added authorization_ttl_days param to account.authorizations
- Added request_needed param to chatInviteExported
- Added requested param to chatInviteExported
- Added title param to chatInviteExported
- Added request_needed param to chatInvite
- Added about param to chatInvite
- Added via_request param to channelParticipantSelf

New Constructors
- messageActionChatJoinedByRequest
- updatePendingJoinRequests
- updateBotChatInviteRequester
- inputKeyboardButtonUserProfile
- keyboardButtonUserProfile
- channelAdminLogEventActionParticipantJoinByRequest
- channelAdminLogEventActionToggleNoForwards
- channelAdminLogEventActionSendMessage

- New simplified EventHandler::startAndLoop API!
- Added support for t.me/+ invite links!
- New sponsored message API!
- Improved DB ORM API, used for example in the event handler!
- New FFI-based prime.madelineproto.xyz factorization module!
- An all new thread-safe madeline.php autoupdater!
- PHP 8.1 support!
- Zend hashmaps are now periodically reallocated to clean up RAM!

Deprecations:
- Dropped 32-bit support.
Android users can install 64-bit builds of php using Termux.
Raspberry pi users can use a 64-bit distro like archlinuxarm.org.
- madeline.php supports only php 7.1+
- composer supports only php 8+ (7.1+ support coming back soon)

Fixes:
- Fixed a side-channel reported by Theo von Arx and Kenneth G. Paterson @ ETH Zürich.

Internal improvements:
- Many, many internal bugfixes and performance improvements!
- Switched to the new RSA-OAEP-based authkey flow.
- Native openssl integration for faster crypto!
- Removed loads of legacy 32-bit hacks, greatly improving performance!
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
As usual, bot.php on github always contains a constantly-updated example source for the latest version of MadelineProto :)
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Note: it seems like some versions of the eio extension may cause a corruption of the phar file, make sure to disable it to avoid issues.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Re-added php 7.1+ support for composer releases; madeline.php always supported php 7.1+.

As usual, legacy PHP versions are supported but php 8.1 is recommended for huge performance improvements with JIT and now amphp fibers :D

Also note that madeline.php phar builds will not behave properly with opcache, so use composer builds to make use of opcache and JIT on PHP 8+.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Fixed Permission Denied errors on Windows caused by flock platform quirks.
This fixes madeline.php and downloads to files as well.
Forwarded from Daniil Gentili's news channel (Daniil Gentili)
Happy New Year everyone!

As a small present for any Blender user subscribed to this channel, I just created an AUR package for BlendNet: an open source plugin that allows distributing CPU and GPU renders across multiple machines.

BlendNet natively integrates with major cloud providers like AWS, Azure or GCP, and also supports self-hosting your own render farm.
My blendnet AUR package provides systemd units and configuration to quickly deploy your own self-hosted CUDA GPU-accelerated Blendnet render farm.

Feel free to check out the new arch BlendNet wiki page for more info: https://wiki.archlinux.org/title/Blender#BlendNet

Have fun Blendering in the new year!
MadelineProto was updated (8.0.0-beta80)!

Features:
- Introducing a new broadcasting API!
- You can now specify a custom serializer type for your ORM properties (one of the variants of the SerializerType enum, or null to choose the best serializer automatically (the default)).

Fixes:
- The documentation was updated, including human-readable descriptions for the latest layer.
- Postgres now uses the new BYTEA amphp APIs
- Multiple fixes and improvements.
MadelineProto now offers a simple broadcast API, that can be used to asynchronously broadcast messages to all users of a bot or userbot in the background, without incurring in timeouts or other issues.

Note that unlike the bot API, MadelineProto can be used to fetch the full list of users, chats and channels of a normal bot, simply using its bot token.

Here's a simple example, explaining how to broadcast a message and a photo to every user of a bot:
<?php
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('bot.madeline');

// The UI will ask you to insert your bot token here
$MadelineProto->start();

$id = $MadelineProto->broadcastMessages([
['message' => 'This broadcast is powered by @MadelineProto!'],
['message' => 'This media broadcast is powered by @MadelineProto!', 'media' => [
'_' => 'inputMediaUploadedPhoto',
'file' => 'https://docs.madelineproto.xyz/logo-hover.png'
]],
]);

Here's a simplified example, just for bots:

<?php
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('bot.madeline');

$MadelineProto->botLogin('1234:token');

$id = $MadelineProto->broadcastMessages([
['message' => 'This broadcast is powered by @MadelineProto!'],
['message' => 'This media broadcast is powered by @MadelineProto!', 'media' => [
'_' => 'inputMediaUploadedPhoto',
'file' => 'https://docs.madelineproto.xyz/logo-hover.png'
]],
]);

You can also forward messages:

// Send messages, showing the "Forwarded from" header
$id = $MadelineProto->broadcastForwardMessages(
from_peer: 101374607,
message_ids: [1, 2, 3, 4],
drop_author: false,
);

// Send messages WITHOUT showing the "Forwarded from" header
$id = $MadelineProto->broadcastForwardMessages(
from_peer: 101374607,
message_ids: [1, 2, 3, 4],
drop_author: true,
);

The methods return an integer ID that can be used to:

- Get the current broadcast progress with getBroadcastProgress
- Cancel the broadcast using cancelBroadcast

Note that to avoid manually polling the progress, MadelineProto will also periodically emit updateBroadcastProgress updates to the event handler, containing a Progress object for all broadcasts currently in-progress.

Filtering is also available, as well as support for custom broadcast actions.

See here » for a full example of the broadcast API, and here » for the full documentation.