Community chat: https://t.me/hamster_kombat_chat_2
Twitter: x.com/hamster_kombat
YouTube: https://www.youtube.com/@HamsterKombat_Official
Bot: https://t.me/hamster_kombat_bot
Game: https://t.me/hamster_kombat_bot/
Last updated 4 months ago
Your easy, fun crypto trading app for buying and trading any crypto on the market.
📱 App: @Blum
🆘 Help: @BlumSupport
ℹ️ Chat: @BlumCrypto_Chat
Last updated 3 months, 3 weeks ago
Turn your endless taps into a financial tool.
Join @tapswap_bot
Collaboration - @taping_Guru
Last updated 1 week, 3 days ago
As a birthday present for Telegram's ?th birthday, MadelineProto now supports VoIP calls again!
Try calling the Magna Luna webradio @magicalcrazypony to hear some cool songs, powered by @MadelineProto!
The new MadelineProto VoIP implementation is written in pure PHP, so it works even on free webhosts!
Check out the new VoIP documentation for more info on how to write your very own Telegram webradio using MadelineProto!
Features (8.0.0-beta131):
- VoIP calls!
- You can now play()
audio files of any format, local files, stream URLs or even stream data using AMP streams!
- You can now play()
audio files even on webhosts, by pre-converting the files using @libtgvoip_bot!
- Added a downloadToReturnedStream
method!
- Updated to layer 161!
New Methods:
- contacts.setBlocked- stories.activateStealthMode- stories.sendReactionChanged Methods:
Added my_stories_from param to contacts.blockAdded my_stories_from param to contacts.unblockAdded my_stories_from param to contacts.getBlockedAdded media_areas param to stories.sendStoryAdded media_areas param to stories.editStoryAdded just_contacts param to stories.getStoryViewsListAdded reactions_first param to stories.getStoryViewsListAdded q param to stories.getStoryViewsListAdded offset param to stories.getStoryViewsListRemoved offset_date param from stories.getStoryViewsListRemoved offset_id param from stories.getStoryViewsListNew Constructors:
- updateStoriesStealthMode- updateSentStoryReaction- storiesStealthMode- mediaAreaCoordinates- mediaAreaVenue- inputMediaAreaVenue- mediaAreaGeoPointChanged Constructors:
Added blocked_my_stories_from param to userFullAdded blocked_my_stories_from param to updatePeerBlockedAdded reactions_count param to storyViewsAdded media_areas param to storyItemAdded sent_reaction param to storyItemAdded stealth_mode param to stories.allStoriesNotModifiedAdded stealth_mode param to stories.allStoriesAdded blocked param to storyViewAdded blocked_my_stories_from param to storyViewAdded reaction param to storyViewAdded reactions_count param to stories.storyViewsListAdded next_offset param to stories.storyViewsListFixes:
- Greatly improved performance by deferring all ORM operations!
- CDN fixes!
- Fix connection to the database when a password is accidentally provided but none is needed
- Removed all generator polyfilling code and deprecated generator functions!
As a side note, I'm very happy of how the current VoIP implementation turned out, and it was a lot of fun to write!
Adding native webhost support required me to write a pure PHP OGG OPUS muxer and demuxer, as well as a full reimplementation of the GrVP protocol in pure PHP: doing it in such a high-level language allowed me to easily use amphp's libraries to easily add support for URLs, streams and all audio formats.
I also wrote a PHP FFI wrapper for libopus for this project, I'll probably split it to a separate package along with the OGG muxer/demuxer because it's really useful :)
docs.madelineproto.xyz
Telegram VoIP phone calls
MadelineProto provides an easy wrapper to work with phone calls.
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 plugins/Danogentili/PingPlugin.php…
Here's a more detailed explanation of the most important new features of MadelineProto 8.0.0-beta100!
- Native plugin systemTo 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);
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");
}
}
``
And use a [plugin base](https://raw.githubusercontent.com/danog/MadelineProto/v8/examples/PluginBase.php) to run all plugins included in the
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!
- FiltersPlugins 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 systemAll event handler methods marked by the Cron
attribute are now automatically invoked by MadelineProto every period
seconds:
```
use danog\MadelineProto\EventHandler\Attributes\Cron;
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)."!");
}
}
```
See the documentation for more info!
- IPC support for the event handlerYou 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 codeFinally, 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!
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 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!
MadelineProto was updated (8.0.0-beta87)!
MadelineProto now offers an official docker image for the linux/amd64
, linux/arm64
and linux/riscv64
platforms!
The image comes with all dependencies pre-configured.
Both opcache and JIT are enabled by default, for maximum performance!
To get started, install docker
:
curl \-fsSL https://get.docker.com | sudo sh
Then increase the max_map_count
sysctl configuration to avoid "Fiber stack allocate failed" and "Fiber stack protect failed" errors, since the PHP engine mmaps two memory regions per fiber.
echo 262144 | sudo tee /proc/sys/vm/max\_map\_count
echo vm.max\_map\_count=262144 | sudo tee /etc/sysctl.d/40\-madelineproto.conf
Then, create the following docker\-compose.yml
file:
services:
bot:
image: hub.madelineproto.xyz/danog/madelineproto
restart: unless\-stopped
tty: true
volumes:
\- .:/app
command: php /app/bot.php
Then, create a bot.php
file with your code, and run this command to log into the bot:
docker run \-\-rm \-it \-\-init \-v $PWD:/app hub.madelineproto.xyz/danog/madelineproto php /app/bot.php
After logging in, press ctrl-c to close the temporary container.
Finally, simply run this command to start the bot in the background.
docker compose up \-\-pull always \-d
Use docker compose logs
to view MadelineProto logs and docker compose ps
to view the status of your bot!
See the documentation for more info about the docker image.
Other features:
- Add getType method
- Add support for emojis with <emoji id="1234">***?***</emoji>
, <tg\-emoji emoji\-id="1234>***?***</tg\-emoji>
HTML tags and tg://emoji?id=1234
HTML/markdown links, in addition to the pre-existing emoji:id
HTML/markdown links.
- Add showPrompt
AppInfo
setting, to allow throwing an exception instead of showing a readline/UI prompt if no API ID was configured.
Fixes:
- Change name of parameter of broadcastForwardMessages
from ids
to message_ids
to avoid confusion.
docs.madelineproto.xyz
MadelineProto on Docker
MadelineProto offers an official MadelineProto docker image for the linux/amd64, linux/arm64 and linux/riscv64 platforms @ hub.madelineproto.xyz/danog/madelineproto.
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 cancelBroadcastNote 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.
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.
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.
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.getSendAsChanged methods:
Renamed channels.deleteUserHistory to channels.deleteParticipantHistory; the old method still works.
Added base_theme param to account.installThemeAdded min_date, max_date params to messages.deleteHistoryAdded send_as param to messages.sendMessage, messages.sendMedia, messages.sendMultiMedia, messages.forwardMessages, messages.sendInlineBotResultAdded request_needed, title params to messages.exportChatInvite, messages.editExportedChatInviteAdded requested, q params to messages.getChatInviteImportersRenamed user_id=>participant in channels.reportSpamChanged Constructors
Added requests_pending param to chatFullAdded recent_requesters param to chatFullAdded requests_pending param to channelFullAdded recent_requesters param to channelFullAdded default_send_as param to channelFullAdded request_chat_broadcast param to peerSettingsAdded request_chat_title param to peerSettingsAdded request_chat_date param to peerSettingsAdded private_forward_name param to userFullAdded authorization_ttl_days param to account.authorizationsAdded request_needed param to chatInviteExportedAdded requested param to chatInviteExportedAdded title param to chatInviteExportedAdded request_needed param to chatInviteAdded about param to chatInviteAdded via_request param to channelParticipantSelfNew 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
We welcome all developers to use our API and source code to create Telegram-like messaging applications on our platform…
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 syntaxTarget:
- ✅ 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)
Community chat: https://t.me/hamster_kombat_chat_2
Twitter: x.com/hamster_kombat
YouTube: https://www.youtube.com/@HamsterKombat_Official
Bot: https://t.me/hamster_kombat_bot
Game: https://t.me/hamster_kombat_bot/
Last updated 4 months ago
Your easy, fun crypto trading app for buying and trading any crypto on the market.
📱 App: @Blum
🆘 Help: @BlumSupport
ℹ️ Chat: @BlumCrypto_Chat
Last updated 3 months, 3 weeks ago
Turn your endless taps into a financial tool.
Join @tapswap_bot
Collaboration - @taping_Guru
Last updated 1 week, 3 days ago