The PWRTelegram app has been updated!
Features:
- skip (private) messages download (add
Fixes:
- chat gallery
- scroll photos
- channels randomly disappear
- private chats with more than 100 messages do not load
Release Notes:
- now is based on telegram 5.10
- some internal functions have been
rewrited to be more efficient with bots
source code: https://bit.ly/2lwO0um
apk: https://bit.ly/2kulsBB
Features:
- skip (private) messages download (add
:f after token)Fixes:
- chat gallery
- scroll photos
- channels randomly disappear
- private chats with more than 100 messages do not load
Release Notes:
- now is based on telegram 5.10
- some internal functions have been
rewrited to be more efficient with bots
source code: https://bit.ly/2lwO0um
apk: https://bit.ly/2kulsBB
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
I am extremely proud to announce the release of some projects I've been working on for the last three months, in the context of the Telegram Contests.
Telegram
Telegram Contests
Here we announce Telegram coding contests in Android Java, iOS Swift, JS, C/C++. Discussion: @contests
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
First of all, madelineTon.js:
A pure JS client-side implementation of the Telegram TON blockchain protocol.
Interact directly with the TON blockchain with no middlemans, directly from your browser!
This is possible thanks to a client-side implementation of the ADNL P2P protocol (whitepaper).
Connection to the liteservers is made through a simple websocket proxy that simply acts as a TCP <=> websocket proxy.
All cryptography is done exclusively in the browser, allowing fully secure interaction with the chosen TON node.
The client is fully asynchronous, making use of workers and/or browser webcrypto APIs for cryptography (curves & AES).
TL, ECC w/ TON ADNL, BOC deserialization is implemented.
Possible applications are entirely client-side off-chain components for a distributed TON project; API explorers; and much more!
A pure JS client-side implementation of the Telegram TON blockchain protocol.
Interact directly with the TON blockchain with no middlemans, directly from your browser!
This is possible thanks to a client-side implementation of the ADNL P2P protocol (whitepaper).
Connection to the liteservers is made through a simple websocket proxy that simply acts as a TCP <=> websocket proxy.
All cryptography is done exclusively in the browser, allowing fully secure interaction with the chosen TON node.
The client is fully asynchronous, making use of workers and/or browser webcrypto APIs for cryptography (curves & AES).
TL, ECC w/ TON ADNL, BOC deserialization is implemented.
Possible applications are entirely client-side off-chain components for a distributed TON project; API explorers; and much more!
GitHub
GitHub - danog/madelineTon.js: Pure JS client-side implementation of the Telegram TON blockchain protocol
Pure JS client-side implementation of the Telegram TON blockchain protocol - danog/madelineTon.js
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
madelineTon.js is actually based on yet another project of mine, a pure JS Telegram MTProto client (madeline.js) which will be released soon ™️™️™️.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Next, I am proud to announce support for the TON protocol in MadelineProto.
MadelineProto is now capable of integrating with the Telegram TON blockchain, thanks to a fully native implementation of ADNL and the lite-client protocol.
It allows async interaction with liteservers in the same manner as the official
MadelineProto is now capable of integrating with the Telegram TON blockchain, thanks to a fully native implementation of ADNL and the lite-client protocol.
It allows async interaction with liteservers in the same manner as the official
lite-client, only with way more abstractions and ease of use.GitHub
MadelineProto/ton at v8 · danog/MadelineProto
Async PHP client API for the telegram MTProto protocol - danog/MadelineProto
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Instantiation
Usage:
For a full overview of async in MadelineProtoTon, take a look at the MadelineProto async docs.
For a full list of methods that can be used, simply look at the PHPDOC suggestions in your favorite IDE, or take a look at the
This API can be used to build web-facing HTTP APIs that query the TON blockchain (using the async http-server), off-chain elements for TON applications and so much more!
Since it's in PHP & integrated in MadelineProto, you can also use it in free webhosts (aka use the blockchain on 000webhost AAAAAAAAA ❤️❤️❤️❤️❤️)
use danog\MadelineProto\TON\API;
$API = new API(
[
'logger' => [
'logger' => Logger::ECHO_LOGGER
]
]
);
Usage:
$API->async(true);
$API->loop(
function () use ($API) {
yield $API->connect(__DIR__.'/ton-lite-client-test1.config.json');
var_dump(yield $API->liteServer->getTime());
}
);
For a full overview of async in MadelineProtoTon, take a look at the MadelineProto async docs.
For a full list of methods that can be used, simply look at the PHPDOC suggestions in your favorite IDE, or take a look at the
---functions--- section of the lite TL scheme (HTML docs coming soon).This API can be used to build web-facing HTTP APIs that query the TON blockchain (using the async http-server), off-chain elements for TON applications and so much more!
Since it's in PHP & integrated in MadelineProto, you can also use it in free webhosts (aka use the blockchain on 000webhost AAAAAAAAA ❤️❤️❤️❤️❤️)
docs.madelineproto.xyz
Async
MadelineProto now features async, for incredible speed improvements, and parallel processing, all powered by amphp.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Finally, feel free to take a look at my submission to the TON contest: https://github.com/danog/toncontest
The repository contains well-documented code for multiple TON smart contracts, a testing suite based on the official TON validator, and a build toolchain for TON.
The repository contains well-documented code for multiple TON smart contracts, a testing suite based on the official TON validator, and a build toolchain for TON.
GitHub
GitHub - danog/toncontest: My submission to the TON blockchain contest
My submission to the TON blockchain contest. Contribute to danog/toncontest development by creating an account on GitHub.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
This is not all: there are still some very cool projects I've yet to finalize and release, eventually you'll see them.
I wish you all a Merry Christmas, and a very happy new year!
❤️❤️❤️
I wish you all a Merry Christmas, and a very happy new year!
❤️❤️❤️
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
MadelineProto was updated to v5!
Introducing upload by URL, file renaming, parallelized downloads and uploads!
You can now use MadelineProto to rename Telegram files or upload them by URL: all uploads and downloads will be made 100% in parallel, 20 chunks at a time for maximum speed (value tweakable in the settings).
For more info, see the new file documentation.
Also introducing:
- Strictly typed, camelCase public API, now all methods can also be called in camelCase, with PHP type hinting for most parameters and return values.
- Full PHPDOC documentation for all the public API, for perfect documentation in your favorite IDE :)
- Several internal bugfixes, refactoring and general performance and stability improvements.
- Improved tests, to avoid backwards compatiblity issues with previous sessions when pushing.
- Clean composer dependencies, now you just have to require danog/madelineproto ^5.0 and nothing else in your composer.json!
Breaking changes:
- NONE :D; you don't have to change your code!
Introducing upload by URL, file renaming, parallelized downloads and uploads!
You can now use MadelineProto to rename Telegram files or upload them by URL: all uploads and downloads will be made 100% in parallel, 20 chunks at a time for maximum speed (value tweakable in the settings).
For more info, see the new file documentation.
Also introducing:
- Strictly typed, camelCase public API, now all methods can also be called in camelCase, with PHP type hinting for most parameters and return values.
- Full PHPDOC documentation for all the public API, for perfect documentation in your favorite IDE :)
- Several internal bugfixes, refactoring and general performance and stability improvements.
- Improved tests, to avoid backwards compatiblity issues with previous sessions when pushing.
- Clean composer dependencies, now you just have to require danog/madelineproto ^5.0 and nothing else in your composer.json!
Breaking changes:
- NONE :D; you don't have to change your code!
docs.madelineproto.xyz
Uploading and downloading files
MadelineProto provides fully parallelized wrapper methods to upload and download files that support bot API file ids, direct upload by URL and file renaming.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
downloadRenameBot.php
7.3 KB
FREEBIES
Here's a fully parallelized file rename + URL download bot based on MadelineProto.
Max file size: 1.5GB
A working instance can be found here: @pwrtelegrambot
Here's a fully parallelized file rename + URL download bot based on MadelineProto.
Max file size: 1.5GB
A working instance can be found here: @pwrtelegrambot
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
MadelineProto was updated!
MadelineProto 5.1 introduces several new features aimed at slashing boilerplate and obliterating bugs.
Features:
* Native error reporting: all errors surfacing from the event handler or MadelineProto will be automatically reported to the admin of the bot!
* Support for bot API file IDs with the
* Fixes for bot API object conversion, now you can convert MTProto results to bot API objects using the
Slashing boilerplate!
* Use the new
* Use the new
New settings!
* Use the new async updateSettings and getSettings methods to change settings, the old
New download methods: both methods support parallel downloads, resuming and partial downloads, all chosen automatically depending on headers!
* downloadToResponse downloads files to an async http-server: this is perfect for creating file download bots!
* downloadToBrowser downloads files directly to the browser.
Among other internal changes:
*
* Packagist install reports! Now all MadelineProto downloads through
!!! Thank you for 130.000 downloads !!!
MadelineProto 5.1 introduces several new features aimed at slashing boilerplate and obliterating bugs.
Features:
* Native error reporting: all errors surfacing from the event handler or MadelineProto will be automatically reported to the admin of the bot!
* Support for bot API file IDs with the
sendMedia and download* methods thanks to the new tg-file-decoder library (can also be used standalone!).* Fixes for bot API object conversion, now you can convert MTProto results to bot API objects using the
MTProtoToBotAPI method (and the other way around with BotAPIToMTProto)!Slashing boilerplate!
* Use the new
startAndLoop(EventHandler::class) method to automatically initialize MadelineProto, event handling, error reporting and the event loop, all in a single call!* Use the new
onStart method of the event handler to execute async operations on bot (re)startup!New settings!
* Use the new async updateSettings and getSettings methods to change settings, the old
$MadelineProto->settings behavior is not supported anymore.New download methods: both methods support parallel downloads, resuming and partial downloads, all chosen automatically depending on headers!
* downloadToResponse downloads files to an async http-server: this is perfect for creating file download bots!
* downloadToBrowser downloads files directly to the browser.
Among other internal changes:
*
yield from everything: all internal MadelineProto methods now use yield from for maximum performance!* Packagist install reports! Now all MadelineProto downloads through
madeline.php are reported to packagist!!!! Thank you for 130.000 downloads !!!
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
I'm also announcing some updates for the MadelineProto social channels.
- Introducing separate OT chat groups, to allow chatting about tech, politics and memes.
- Introducing a new international MadelineProto support group, for MadelineProto help and support.
- Finally introducing the official MadelineProto meme channel, full of only the dankest based memes!
- Introducing an official discussion group for AMPHP, the async, high-performance parallelized PHP library!
Also, finally introducing an official farsi MadelineProto channel: @madeline_farsi.
This channel will post farsi translations of the posts sent on the main channel, along with MadelineProto sources, AMPHP tips and much more!
Also, check out the official arabic MadelineProto channel: @madelineArabic
- Introducing separate OT chat groups, to allow chatting about tech, politics and memes.
- Introducing a new international MadelineProto support group, for MadelineProto help and support.
- Finally introducing the official MadelineProto meme channel, full of only the dankest based memes!
- Introducing an official discussion group for AMPHP, the async, high-performance parallelized PHP library!
Also, finally introducing an official farsi MadelineProto channel: @madeline_farsi.
This channel will post farsi translations of the posts sent on the main channel, along with MadelineProto sources, AMPHP tips and much more!
Also, check out the official arabic MadelineProto channel: @madelineArabic
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
> What is AMPHP (https://amphp.org)?
Amp is a non-blocking concurrency framework for PHP providing primitives to manage concurrency such as an event loop, promises, and asynchronous iterators.
> OK, in simpler words?
AMPHP is a high-performance, parallelized PHP library that allows you to write extremely fast, efficient programs that work in parallel using green threads.
> * b r a i n m e l t *
Y E S
———
MadelineProto is not written in PHP: MadelineProto is written using AMPHP.
What this means is that when you using MadelineProto (and async is enabled), all incoming messages are handled in parallel, each in a separate thread, even on webhosts.
This allow your bots to always be responsive, even while executing complex tasks.
However, it is vital that you also use AMPHP (not PHP!) when writing your bot.
What this means is that the following PHP functions and extensions cannot be used in MadelineProto bots (otherwise, all the benefits of AMPHP would be nullified): instead, you must use the correct AMPHP library (automatically included in madeline.php).
❌
❌
❌
❔You can also use amphp/postgres and amphp/redis for PostgreSQL and Redis!
❌
❌
❔ You should use it only once on bot startup, or else when reloading the bot (plugin source coming soon!)
———
In short, AMPHP is an awesome framework for using async PHP in 2020: you can join the official Telegram support group @amphpchat if you have any questions or suggestions on what else to add to AMPHP!
Amp is a non-blocking concurrency framework for PHP providing primitives to manage concurrency such as an event loop, promises, and asynchronous iterators.
> OK, in simpler words?
AMPHP is a high-performance, parallelized PHP library that allows you to write extremely fast, efficient programs that work in parallel using green threads.
> * b r a i n m e l t *
Y E S
———
MadelineProto is not written in PHP: MadelineProto is written using AMPHP.
What this means is that when you using MadelineProto (and async is enabled), all incoming messages are handled in parallel, each in a separate thread, even on webhosts.
This allow your bots to always be responsive, even while executing complex tasks.
However, it is vital that you also use AMPHP (not PHP!) when writing your bot.
What this means is that the following PHP functions and extensions cannot be used in MadelineProto bots (otherwise, all the benefits of AMPHP would be nullified): instead, you must use the correct AMPHP library (automatically included in madeline.php).
❌
file_get_contents
✅ amphp/file for files, amphp/http-client and $MadelineProto->fileGetContents for URLs❌
curl, guzzle
✅ amphp/http-client is async, much faster than other libraries, and also supports HTTP/2!❌
mysqli, PDO, sqlite
✅ amphp/mysql supports both MySQL and SQLite backends, and is fully async!❔You can also use amphp/postgres and amphp/redis for PostgreSQL and Redis!
❌
php-fpm
✅ amphp/http-server is a high-performance async HTTP/2 server, that can be interfaced with MadelineProto to create file download servers!❌
include, require
❓ Don't use this function very often, and most importantly, don't use it inside of the event handler code.❔ You should use it only once on bot startup, or else when reloading the bot (plugin source coming soon!)
———
In short, AMPHP is an awesome framework for using async PHP in 2020: you can join the official Telegram support group @amphpchat if you have any questions or suggestions on what else to add to AMPHP!
amphp.org
Asynchronous Multitasking PHP
Amp is a non-blocking concurrency library for PHP based on Revolt.
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
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!
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!
core.telegram.org
Telegram API Terms of Service
Terms of Service that all third-party client apps must comply with.
Forwarded from MadelineProto | Official Channel (Daniil Gentili 🇺🇦)
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:
You can also forward messages:
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.
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');
// Works OK with both bots and userbots
$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'
]],
]);
You can also forward messages:
// Send messages, showing the "Forwarded from" header
$id = $MadelineProto->broadcastForwardMessages(
from_peer: 101374607,
ids: [1, 2, 3, 4],
drop_author: false,
);
// Send messages WITHOUT showing the "Forwarded from" header
$id = $MadelineProto->broadcastForwardMessages(
from_peer: 101374607,
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.
docs.madelineproto.xyz
Broadcasting messages to all users
MadelineProto can be used to broadcast messages to all users, chats and channels of a bot or userbot.
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Introducing MadelineProto's biggest update yet, 8.0.0-beta100!
This version introduces plugins », bound methods », filters », a built-in cron system », IPC support for the event handler » and automatic static analysis for event handler code ».
See the following post for examples!
Other features:
- Thanks to the many translation contributors @ https://weblate.madelineproto.xyz/, MadelineProto is now localized in Hebrew, Persian, Kurdish, Uzbek, Russian, French and Italian!
- Added simplified
- You can now use
- You can now automatically pin messages broadcasted using
- You can now use
- Added
- The
- Added a custom
- Added a
- Added
- Added an
- You can now use
- Added support for
- Added a
- Added a new
- Added support for HTML lists in parseMode!
- Fixed parsing of markdown code blocks!
Breaking changes:
- Switched to a custom markdown parser with bot API MarkdownV2 syntax, which differs from the previous Markdown syntax supported by parsedown.
- Markdown text can't contain HTML anymore.
Fixes:
- Fixed file uploads with ext-uv!
- Fixed file re-uploads!
- Improve background broadcasting with the broadcast API using a pre-defined list of
- Fixed a bug that caused updates to get paused if an exception is thrown during onStart.
- Broadcast IDs are now unique across multiple broadcasts, even if previous broadcasts already completed their ID will never be re-used.
- Now uploadMedia, sendMedia and upload can upload files from string buffers created using
- Reduced memory usage during flood waits by tweaking config defaults.
- Reduced memory usage by clearing the min database automatically as needed.
- Automatically try caching all dialogs if a peer not found error is about to be thrown.
- Fixed some issues with pure phar installs.
- Fixed splitting of HTML and markdown messages
- Fixed formatting of multiline markdown codeblocks
- And many other performance improvements and bugfixes!
This version introduces plugins », bound methods », filters », a built-in cron system », IPC support for the event handler » and automatic static analysis for event handler code ».
See the following post for examples!
Other features:
- Thanks to the many translation contributors @ https://weblate.madelineproto.xyz/, MadelineProto is now localized in Hebrew, Persian, Kurdish, Uzbek, Russian, French and Italian!
- Added simplified
sendMessage, sendDocument, sendPhoto methods that return abstract Message objects with simplified properties and bound methods!- You can now use
Tools::callFork to fork a new green thread!- You can now automatically pin messages broadcasted using
broadcastMessages, broadcastForwardMessages by using the new pin: true parameter!- You can now use
sendMessageToAdmins to send messages to the bot's admin (the peers returned by getReportPeers).- Added
wrapUpdate, wrapMessage, wrapMedia methods to wrap low-level MTProto updates into an abstracted Message object with bound methods!- The
waveform attribute of Voice objects is now automatically encoded and decoded to an array of 100 integer values!- Added a custom
PeerNotInDbException class for "This peer is not present in the internal peer database" errors- Added a
label property to the Button class, directly indicating the button label (instead of manually fetching it as an array key).- Added
isForum method to check whether a given supergroup is a forum- Added an
entitiesToHtml method to convert a message and a set of Telegram entities to an HTML string! - You can now use
reportMemoryProfile() to generate and send a pprof memory profile to all report peers to debug the causes of high memory usage.- Added support for
pay, loginurl, webapp and tg://user?id= buttons in bot API syntax!- Added a
getAdminIds function that returns the IDs of the admin of the bot (equal to the peers returned by getReportPeers in the event handler).- Added a new
ParseMode enum!- Added support for HTML lists in parseMode!
- Fixed parsing of markdown code blocks!
Breaking changes:
- Switched to a custom markdown parser with bot API MarkdownV2 syntax, which differs from the previous Markdown syntax supported by parsedown.
- Markdown text can't contain HTML anymore.
Fixes:
- Fixed file uploads with ext-uv!
- Fixed file re-uploads!
- Improve background broadcasting with the broadcast API using a pre-defined list of
whitelist IDs!- Fixed a bug that caused updates to get paused if an exception is thrown during onStart.
- Broadcast IDs are now unique across multiple broadcasts, even if previous broadcasts already completed their ID will never be re-used.
- Now uploadMedia, sendMedia and upload can upload files from string buffers created using
ReadableBuffer.- Reduced memory usage during flood waits by tweaking config defaults.
- Reduced memory usage by clearing the min database automatically as needed.
- Automatically try caching all dialogs if a peer not found error is about to be thrown.
- Fixed some issues with pure phar installs.
- Fixed splitting of HTML and markdown messages
- Fixed formatting of multiline markdown codeblocks
- And many other performance improvements and bugfixes!
docs.madelineproto.xyz
Plugins
MadelineProto offers a native plugin system, based on event handlers!
Forwarded from MadelineProto | Official Channel (Daniil Gentili)
Here's a more detailed explanation of the most important new features of MadelineProto 8.0.0-beta100!
- Native plugin system
To create a plugin, simply create an event handler that extends PluginEventHandler.
For example, create a
See the documentation for more info on how to create MadelineProto plugins!
- Message objects with bound methods
Both plugins and normal bots can make use of bound update methods like
- Filters
Plugins and bots can now use three different filtering systems, to easily receive only updates satisfying certain conditions (incoming/outgoing, from group, channel, private, from an admin or a specific peer, with an audio/sticker/..., satisfying a certain regex or a certain /command, and much more!), see the documentation for more info!
- Built-in cron system
All event handler methods marked by the
- IPC support for the event handler
You can now call event handler and plugin methods from outside of the event handler, using
- Automatic static analysis of event handler code
Finally, all new bots and plugins will be automatically analyzed by MadelineProto, blocking execution if performance or security issues are detected!
See the documentation for info!
- Native plugin system
To create a plugin, simply create an event handler that extends PluginEventHandler.
For example, create a
plugins/Danogentili/PingPlugin.php file: <?php declare(strict_types=1);And use a plugin base to run all plugins included in the
namespace MadelinePlugin\Danogentili\PingPlugin;
use danog\MadelineProto\PluginEventHandler;
use danog\MadelineProto\EventHandler\Filter\FilterText;
use danog\MadelineProto\EventHandler\Message;
use danog\MadelineProto\EventHandler\SimpleFilter\Incoming;
class PingPlugin extends PluginEventHandler
{
#[FilterCommand('echo')]
public function echoCmd(Incoming & Message $message): void
{
// Contains the arguments of the command
$args = $message->commandArgs;
$message->reply($args[0] ?? '');
}
#[FilterRegex('/.*(mt?proto).*/i')]
public function testRegex(Incoming & Message $message): void
{
$message->reply("Did you mean to write MadelineProto instead of ".$message->matches[1].'?');
}
#[FilterText('ping')]
public function pingCommand(Incoming&Message $message): void
{
$message->reply("Pong");
}
}
plugins folder. See the documentation for more info on how to create MadelineProto plugins!
- Message objects with bound methods
Both plugins and normal bots can make use of bound update methods like
reply(), delete(), getReply(), getHTML() and simplified properties like chatId, senderId, command, commandArgs and many more, see the documentation for more info!- Filters
Plugins and bots can now use three different filtering systems, to easily receive only updates satisfying certain conditions (incoming/outgoing, from group, channel, private, from an admin or a specific peer, with an audio/sticker/..., satisfying a certain regex or a certain /command, and much more!), see the documentation for more info!
- Built-in cron system
All event handler methods marked by the
Cron attribute are now automatically invoked by MadelineProto every period seconds: use danog\MadelineProto\EventHandler\Attributes\Cron;See the documentation for more info!
class MyEventHandler extends SimpleEventHandler
{
/**
* This cron function will be executed forever, every 60 seconds.
*/
#[Cron(period: 60.0)]
public function cron1(): void
{
$this->sendMessageToAdmins("The bot is online, current time ".date(DATE_RFC850)."!");
}
}
- IPC support for the event handler
You can now call event handler and plugin methods from outside of the event handler, using
getEventHandler() on an API instance, see the docs for more info!- Automatic static analysis of event handler code
Finally, all new bots and plugins will be automatically analyzed by MadelineProto, blocking execution if performance or security issues are detected!
See the documentation for info!
docs.madelineproto.xyz
Plugins
MadelineProto offers a native plugin system, based on event handlers!