madelineproto | Unsorted

Telegram-канал madelineproto - MadelineProto | Official Channel

7257

Official MadelineProto channel. Italian Channel: @MadelineProtoIta Group: @pwrtelegramgroup

Subscribe to a channel

MadelineProto | Official Channel

MadelineProto can now be translated in your language!

Just head over to https://weblate.madelineproto.xyz/projects/madelineproto/madelineproto/ to start localizing MadelineProto's UI and TUI strings :D

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated (8.0.0-beta97)!

Features:
- Added support for automatic QR code login both via CLI and via web with start()!
- Added a new QR code login API!
- restart() can now be used to restart the IPC daemon (useful in order to apply updates after running composer update)

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated (8.0.0-beta94)!

Fixes:
- Fixed call aggregation syntax. Will introduce a PHP 8 named arguments version of this syntax in future versions.

Features:
- The docker image now uses libuv instead of the libev/libeio event loop drivers: libuv is the same event loop library used by V8/Node.js!
- The image now also includes the ext-memprof extension for optional memory profiling.

Читать полностью…

MadelineProto | Official Channel

Fixed a small issue with the broadcast API that may be triggered when serializing the session in beta90!

Run composer update to update to the latest version if you're using composer, otherwise run docker compose restart if you're using the phar version in docker to restart the daemon.

Читать полностью…

MadelineProto | Official Channel

By the way, as you may have guessed by the linux/riscv64 images I'm providing, I got myself a visionfive2 RISC-V board precisely for the purpose of improving PHP support on RISC-V.

I'm currently working on a RISC-V port of the PHP JIT compiler, will be documenting the process on my channel: /channel/daniilgentili/691 :)

Читать полностью…

MadelineProto | Official Channel

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'
]],
]);

Читать полностью…

MadelineProto | Official Channel

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 | Official Channel

MadelineProto was updated (8.0.0-beta66)!

Bugfixes:
- Fix issues in uploadFromStream, uploadFromCallable, downloadToBrowser
- MadelineProto now requires PHP 8.1.17+, 8.2.4+

The documentation was also fully updated for MadelineProto 8 and amp v3.

New Methods:
- messages.getBotApp
- messages.requestAppWebView
- bots.setBotInfo
- bots.getBotInfo
- stickers.changeSticker
- stickers.renameStickerSet
- stickers.deleteStickerSet

Changed Methods:
Added switch_webview param to messages.setInlineBotResults
Added from_switch_webview param to messages.requestSimpleWebView
Added hash param to help.getAppConfig
Added emojis param to stickers.createStickerSet
Added text_color param to stickers.createStickerSet
Added thumb_document_id param to stickers.setStickerSetThumb

New Constructors:
- updateGroupInvitePrivacyForbidden
- help.appConfigNotModified
- help.appConfig
- inputBotAppID
- inputBotAppShortName
- botAppNotModified
- botApp
- messages.botApp
- appWebViewResultUrl
- inlineBotWebView
- readParticipantDate

Changed Constructors:
Added attach_menu param to messageActionBotAllowed
Added app param to messageActionBotAllowed
Added autologin_token param to config
Removed phonecalls_enabled param from config
Removed ignore_phone_entities param from config
Removed pfs_enabled param from config
Removed saved_gifs_limit param from config
Removed stickers_faved_limit param from config
Removed pinned_dialogs_count_max param from config
Removed pinned_infolder_count_max param from config
Added switch_webview param to messages.botResults
Added keywords param to inputStickerSetItem
Added sponsor_info param to sponsoredMessage
Added additional_info param to sponsoredMessage
Added date param to messagePeerReaction

Deleted Constructors:
- messageActionAttachMenuBotAllowed

Читать полностью…

MadelineProto | Official Channel

Small update regarding this PHP bug: https://github.com/php/php-src/issues/10496

MadelineProto will never run on PHP 8.1.15, 8.1.16, 8.2.2, 8.2.3 due to a PHP, not MadelineProto bug.

I can't fix the problem because it's not a MadelineProto problem, it's a PHP problem.

A patch was already committed to php-src but it wasn't released yet: the fix will probably be present in PHP 8.1.17, PHP 8.2.4.

Until these two versions are released, all applications based on fibers will not work: this includes major libraries like amphp, revolt, psl and MadelineProto.

The only workaround for now is to compile php from scratch from the PHP-8.1, PHP-8.2 or master branches (which include the fix), or using an older version of PHP like PHP 8.1.14 or 8.2.1.

An easy way to use older versions of PHP is through docker.

If you want, you ask the PHP devs to speed up the release of PHP 8.1.17 or PHP 8.2.4 by commenting on https://github.com/php/php-src/issues/10496, opening a new issue @ https://github.com/php/php-src/ and writing to the internals mailing list: internals@lists.php.net

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated (8.0.0-beta52)!

Features:
- Add separate RPC resend timeout
- Remove manual inclusion limitations for the release phar file
- Check for all missing extensions

Fixes:
- Fix getPwrChat
- Peer handler bugfixes

Читать полностью…

MadelineProto | Official Channel

Protip: use docker to easily install and use PHP 8.2.1:

docker run --rm -it -v $PWD:/app php:8.2.1 php /app/bot.php

This will run the bot.php file present in the current directory.

You can also use the php:8.2.1-apache and php:8.2.1-fpm images to set up a webserver, though if you're just using the event handler, running bots via CLI is the more reliable.

Читать полностью…

MadelineProto | Official Channel

The documentation was just rebuilt, the documentation links should work fine now.

Читать полностью…

MadelineProto | Official Channel

PSA: PHP 8.2.2 has a garbage collector bug which completely breaks all async applications based on fibers, including MadelineProto.

Until it is fixed, please stick to PHP 8.1 or PHP 8.2.1.

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated!

Fixes:
- Fix -503 Timeout errors when downloading files

Features:
- Full Psalm/IDE types for all API methods!
- Test fibers before the first login, providing a helpful message if the maximum number of startable fibers is too low.

Читать полностью…

MadelineProto | Official Channel

You can now use the following test script to test the maximum number of fibers that can be started on a webhost:

<?php

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

var_dump(\danog\MadelineProto\Tools::testFibers());



A very basic, low-load install of MadelineProto shouldershould use around 500 fibers (though that number should decrease in the next update).

In optimal conditions, the value of maxFibers should be exactly equal to 100000.

Читать полностью…

MadelineProto | Official Channel

Fixed a few issues in 8.0.0-beta98.

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated (8.0.0-beta95)!

Fixes:
- Improved self-restart logic on some webhosts
- Fixed redis driver

Also, I've updated the official docker image documentation to include detailed instructions on how to use mysql, postgres and redis with the official MadelineProto image!

I've also included a detailed example on how to use the official MadelineProto docker image via web with automatic HTTPS thanks to the caddy webserver!

I heavily recommend you use the official docker image instead of aapanel/cpanel/apache.

See here for more info: https://docs.madelineproto.xyz/docs/DOCKER.html

Читать полностью…

MadelineProto | Official Channel

Fixed an issue caused by a migration of the backend for the madeline.php alpha channel.

As usual, a warning: NEVER use this install method in production.
The madeline.php install script is as an alpha-level distribution channel for MadelineProto with frequent breaking changes distributed with automatic updates.
If you require a stable, semantically versioned install of MadelineProto with no automatic updates, please install MadelineProto using composer », or by downloading the phar file from the latest release.

Читать полностью…

MadelineProto | Official Channel

Made some performance improvements to the broadcast API in the new beta89!

Note that the process may still take up to 30 minutes to start depending on the number of users of the bot, but afterwards all messages are broadcasted as quickly as possible, and in parallel :)

Читать полностью…

MadelineProto | Official Channel

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.

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.

Читать полностью…

MadelineProto | Official Channel

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'
]],
]);


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.

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated (8.0.0-beta79)!

Features:
- Make getID work with usernames.
- Allow calling restart() and stop() from outside the event handler.
- Add a sendCustomEvent API method and an onUpdateCustomEvent event handler method
- Implement InputCheckPasswordSRP conversion: you can now provide a simple string where a InputCheckPasswordSRP object is required.

Fixes:
- Bypass eio touch issues
- Make username recaching atomic

New Methods:
- auth.resetLoginEmail
- messages.setChatWallPaper
- bots.reorderUsernames
- bots.toggleUsername
- chatlists.exportChatlistInvite
- chatlists.deleteExportedInvite
- chatlists.editExportedInvite
- chatlists.getExportedInvites
- chatlists.checkChatlistInvite
- chatlists.joinChatlistInvite
- chatlists.getChatlistUpdates
- chatlists.joinChatlistUpdates
- chatlists.hideChatlistUpdates
- chatlists.getLeaveChatlistSuggestions
- chatlists.leaveChatlist

Changed Methods:
Added for_chat param to account.uploadWallPaper
Added bot param to photos.updateProfilePhoto
Added bot param to photos.uploadProfilePhoto
Added bot param to bots.setBotInfo
Added name param to bots.setBotInfo
Added bot param to bots.getBotInfo

Deleted Methods:
- folders.deleteFolder
- messages.getAllChats (use getDialogIds/getDialogs/getFullDialogs instead)

New Constructors:
- messageActionSetChatWallPaper
- messageActionSetSameChatWallPaper
- dialogFilterChatlist
- inlineQueryPeerTypeBotPM
- inputChatlistDialogFilter
- exportedChatlistInvite
- chatlists.exportedChatlistInvite
- chatlists.exportedInvites
- chatlists.chatlistInviteAlready
- chatlists.chatlistInvite
- chatlists.chatlistUpdates
- bots.botInfo

Changed Constructors:
Added bot_can_edit param to user
Added crypto_currency param to messageActionGiftPremium
Added crypto_amount param to messageActionGiftPremium
Added wallpaper param to userFull
Added via_chatlist param to updateChannelParticipant
Added peer_types param to keyboardButtonSwitchInline
Added reset_available_period param to auth.sentCodeTypeEmailCode
Added reset_pending_date param to auth.sentCodeTypeEmailCode
Removed next_phone_login_date param from auth.sentCodeTypeEmailCode
Added via_chatlist param to channelAdminLogEventActionParticipantJoinByInvite
Added via_chatlist param to chatInviteImporter

Читать полностью…

MadelineProto | Official Channel

PHP 8.2.4 was finally released!

You can now use MadelineProto normally, without using older versions of PHP.

Make sure to run sudo apt-get update && sudo apt-get dist-upgrade -y on Ubuntu and Debian to pull the latest version!

The official docker image for php 8.2.4 was also released, if you want to keep using docker.

Ping your webhosts if they're still using the old version ;)

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated (8.0.0-beta55)!

Fixes:
- Adapted dns-over-https for new http-client beta.

Please note that when requiring madelineproto using composer, you should now specify a minimum-stability of beta, not dev.

For example, you can use the following composer.json:


{
"require": {
"danog/madelineproto": "^8"
},
"minimum-stability": "beta"
}

Читать полностью…

MadelineProto | Official Channel

Telegram API Update.

Please note that due to recent updates to Telegram's handling of SMS and the integration of new SMS providers like Firebase, Telegram is changing the way login codes are handled in third-party apps based on the Telegram API, like MadelineProto.

Starting on 18.02.2023, users logging into third-party apps will only be able to receive login codes via Telegram. It will no longer be possible to request an SMS to log into your app – just like when logging into Telegram's own desktop and web clients.

Exactly like with the Telegram Desktop and Web apps, if a user doesn’t have a Telegram account yet, they will need to create one first using an official mobile Telegram app.

TL;DR: You will still be able to use MadelineProto to login, but the code will only be received via Telegram, not SMS.

Читать полностью…

MadelineProto | Official Channel

PSA: The garbage collector bug also affects PHP 8.1.15.

Until it is fixed, please stick to PHP 8.1.14 or PHP 8.2.1.

Читать полностью…

MadelineProto | Official Channel

MadelineProto was updated!

Features:
- Update to layer 152
- getDialogs now fetches the entire member list for bots

New Methods:
- auth.requestFirebaseSms
- account.getDefaultProfilePhotoEmojis
- account.getDefaultGroupPhotoEmojis
- account.getAutoSaveSettings
- account.saveAutoSaveSettings
- account.deleteAutoSaveExceptions
- messages.sendBotRequestedPeer
- messages.getEmojiGroups
- messages.getEmojiStatusGroups
- messages.getEmojiProfilePhotoGroups
- messages.searchCustomEmoji
- messages.togglePeerTranslations

Changed Methods:
Added id param to messages.translateText
Removed msg_id param from messages.translateText
Removed from_lang param from messages.translateText
Added video_emoji_markup param to photos.uploadProfilePhoto
Added video_emoji_markup param to photos.uploadContactProfilePhoto
Added forum param to channels.createChannel

New Constructors:
- messageActionRequestedPeer
- auth.sentCodeSuccess
- updateAutoSaveSettings
- keyboardButtonRequestPeer
- auth.sentCodeTypeFirebaseSms
- videoSizeEmojiMarkup
- videoSizeStickerMarkup
- requestPeerTypeUser
- requestPeerTypeChat
- requestPeerTypeBroadcast
- emojiListNotModified
- emojiList
- emojiGroup
- messages.emojiGroupsNotModified
- messages.emojiGroups
- textWithEntities
- messages.translateResult
- autoSaveSettings
- autoSaveException
- account.autoSaveSettings

Changed Constructors:
Added video_emoji_markup param to inputChatUploadedPhoto
Added translations_disabled param to chatFull
Added translations_disabled param to channelFull
Added future_auth_token param to auth.authorization
Added translations_disabled param to userFull
Added send_photos param to chatBannedRights
Added send_videos param to chatBannedRights
Added send_roundvideos param to chatBannedRights
Added send_audios param to chatBannedRights
Added send_voices param to chatBannedRights
Added send_docs param to chatBannedRights
Added send_plain param to chatBannedRights
Added allow_firebase param to codeSettings
Added token param to codeSettings
Added app_sandbox param to codeSettings
Added upgrade param to inputStorePaymentPremiumSubscription
Added transaction param to premiumSubscriptionOption

Deleted Constructors:
- messages.translateNoResult
- messages.translateResultText

Читать полностью…

MadelineProto | Official Channel

MadelineProto 8 was updated!

Features:
- Added a new \danog\MadelineProto\RPCError\FloodWaitError exception type, which will be thrown for FLOOD_WAIT_ errors. It contains useful getWaitTime() and wait() methods to easily fetch or wait for the required amount of time.

Also, I've created a final release for MadelineProto 7.
If you don't want to use the latest v8 beta, you can still install MadelineProto 7 using composer, or by downloading and including this phar file: https://github.com/danog/MadelineProto/releases/download/7.0.152/madeline.phar

Please note that I won't provide support for legacy installs of MadelineProto 7.

Читать полностью…

MadelineProto | Official Channel

Released a new beta:

Breaking changes:

- Removed the deprecated $MadelineProto->startAndLoop method. Please use MyEventHandler::startAndLoop instead, remove any new \danog\MadelineProto\API line you have in your code if you're only using the event handler.
- Removed support for the long-deprecated snake_case methods, now only camelCase is supported (get_info will not work, only getInfo; and so on).
- onStart now blocks all updates until it finishes executing. Use the amphp async primitives to start long-running processes in onStart like starting a webserver.
- You can't assign arbitrary properties to an API instance anymore.

Features:
- Added an extractMessageId method.

Fixes:
- Fixed getPwrChat
- Properly handle PTS exceptions
- Avoid fiber leaks by completely refactoring the loop API
- Fix garbage collection of API instances. To properly garbage collect API instances, run EventLoop::run() after unsetting all API instances; or if you just destroyed one instance and others are still running, keep using MadelineProto as usual, the garbage collector callbacks will be invoked by the event loop automatically.

Deprecations:
- The \danog\Loop\Generic\PeriodicLoop and \danog\Loop\Generic\GenericLoop classes were deprecated.
The alternatives are the new \danog\Loop\PeriodicLoop and \danog\Loop\GenericLoop, with a new and refactored API, see https://github.com/danog/loop for the new API. The old classes are still available, but will be removed in the next major release (v9).
- The async and loop methods were deprecated, and will be removed in the next major release (v9).
- All coroutine-related methods (Tools::callFork, etc) were deprecated, and will be removed in the next major release (v9).
Use the amphp APIs, instead (ie \Amp\async or \Revolt\EventLoop::queue instead of Tools::callFork, Amp\Promise\awaitAll instead of Tools::all etc).
- Coroutine support in the event handler will be completely removed in the next major release (v9).

Читать полностью…

MadelineProto | Official Channel

Fixed a bunch of long-time bugs in madeline.php (including some that were present even in v7):

- Finally fully fixed "Could not connect to MadelineProto" IPC issues.
- Fixed a fiber memory leak that caused "Fiber stack allocate failed" or "Fiber stack protect failed" issues on systems with a low max_map_count
- Fixed FILE_PART_0 issues when concurrently uploading+truncating report logs.


A note on "Fiber stack allocate failed" and "Fiber stack protect failed" errors.

MadelineProto + Amphp v3 + PHP 8.1 make use of mmap to map stack space for each fiber (aka green thread), with 2 mmap'ed areas per fiber (one area for the stack + a protected stack guard area at the end).

The "Fiber stack allocate failed" and "Fiber stack protect failed" errors occur when the maximum number of mmap'ed regions is reached: you should increase the vm.max_map_count kernel config to 262144 to fix them.

These errors will still occur on heavily-loaded instances of MadelineProto: run the following command as root to avoid these errors:

echo 262144 | sudo tee /proc/sys/vm/max_map_count

To persist the change across reboots:

echo vm.max_map_count=262144 | sudo tee /etc/sysctl.d/40-madelineproto.conf


On Windows and WSL, increasing the size of the pagefile might help; please switch to native Linux if the issue persists.

Читать полностью…
Subscribe to a channel