1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 17:24:40 +01:00

Cleanup changelog

This commit is contained in:
Daniil Gentili 2023-07-15 16:34:54 +02:00
parent 6991133d50
commit 6cc71a5c8e
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
8 changed files with 32 additions and 91 deletions

1
.gitignore vendored
View File

@ -149,3 +149,4 @@ config.json
/docker-compose.yml
/Caddyfile
/tt.php
/changelog

View File

@ -1,92 +1,12 @@
Introducing MadelineProto's biggest update yet, 8.0.0-beta100!
This version introduces [plugins](https://docs.madelineproto.xyz/docs/PLUGINS.html), [bound methods](https://docs.madelineproto.xyz/docs/UPDATES.html#bound-methods), [filters](https://docs.madelineproto.xyz/docs/FILTERS.html), [a built-in cron system](https://docs.madelineproto.xyz/docs/UPDATES.html#cron), [IPC support for the event handler](https://docs.madelineproto.xyz/docs/UPDATES.html#persisting-data-and-ipc) and automatic static analysis for event handler code.
This version introduces [plugins »](https://docs.madelineproto.xyz/docs/PLUGINS.html), [bound methods »](https://docs.madelineproto.xyz/docs/UPDATES.html#bound-methods), [filters »](https://docs.madelineproto.xyz/docs/FILTERS.html), [a built-in cron system »](https://docs.madelineproto.xyz/docs/UPDATES.html#cron), [IPC support for the event handler »](https://docs.madelineproto.xyz/docs/UPDATES.html#persisting-data-and-ipc) and [automatic static analysis for event handler code »](https://docs.madelineproto.xyz/docs/UPDATES.html#automatic-static-analysis).
- [Plugins](https://docs.madelineproto.xyz/docs/PLUGINS.html)
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);
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](https://docs.madelineproto.xyz/docs/PLUGINS.html) for more info on how to create MadelineProto plugins!
- [Message](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Message.html) objects with bound methods
Both plugins and normal bots can make use of [bound update methods](https://docs.madelineproto.xyz/docs/UPDATES.html#bound-methods) like `reply()`, `delete()`, `getReply()`, `getHTML()` and simplified properties like `chatId`, `senderId`, `command`, `commandArgs` and many more, see the [documentation](https://docs.madelineproto.xyz/docs/UPDATES.html#bound-methods) for more info!
- [Filters](https://docs.madelineproto.xyz/docs/FILTERS.html)
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](https://docs.madelineproto.xyz/docs/FILTERS.html) for more info!
- [Built-in cron system](https://docs.madelineproto.xyz/docs/UPDATES.html#cron)
All 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](https://docs.madelineproto.xyz/docs/UPDATES.html#cron) for more info!
- [IPC support for the event handler](https://docs.madelineproto.xyz/docs/UPDATES.html#persisting-data-and-ipc)
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](https://docs.madelineproto.xyz/docs/PLUGINS.html#limitations)!
- 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 [following post](https://t.me/MadelineProto/630) 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](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Message.html) objects with simplified properties and bound methods!
- Added simplified [sendMessage](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendmessage-int-string-peer-string-message-parsemode-parsemode-danog-madelineproto-parsemode-text-int-null-replytomsgid-null-int-null-topmsgid-null-array-null-replymarkup-null-int-null-sendas-null-int-null-scheduledate-null-bool-silent-false-bool-noforwards-false-bool-background-false-bool-cleardraft-false-bool-nowebpage-false-bool-updatestickersetsorder-false-danog-madelineproto-eventhandler-message), [sendDocument](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#senddocument-int-string-peer-message-media-localfile-remoteurl-botapifileid-readablestream-file-message-media-localfile-remoteurl-botapifileid-readablestream-null-thumb-null-string-caption-parsemode-parsemode-danog-madelineproto-parsemode-text-callable-callback-null-string-filename-null-string-mimetype-null-int-ttl-null-bool-spoiler-false-int-null-replytomsgid-null-int-null-topmsgid-null-array-null-replymarkup-null-int-null-sendas-null-int-null-scheduledate-null-bool-silent-false-bool-noforwards-false-bool-background-false-bool-cleardraft-false-bool-updatestickersetsorder-false-danog-madelineproto-eventhandler-message), [sendPhoto](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendphoto-int-string-peer-message-media-localfile-remoteurl-botapifileid-readablestream-file-string-caption-parsemode-parsemode-danog-madelineproto-parsemode-text-callable-callback-null-string-filename-null-int-ttl-null-bool-spoiler-false-int-null-replytomsgid-null-int-null-topmsgid-null-array-null-replymarkup-null-int-null-sendas-null-int-null-scheduledate-null-bool-silent-false-bool-noforwards-false-bool-background-false-bool-cleardraft-false-bool-updatestickersetsorder-false-danog-madelineproto-eventhandler-message) methods that return abstract [Message](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Message.html) 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`).
@ -99,6 +19,13 @@ Other features:
- 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`, `login_url`, `web_app` 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](https://core.telegram.org/bots/api#markdownv2-style) 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!
@ -111,4 +38,6 @@ Fixes:
- 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!

View File

@ -102,6 +102,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* [Restarting](https://docs.madelineproto.xyz/docs/UPDATES.html#restarting)
* [Self-restart on webhosts](https://docs.madelineproto.xyz/docs/UPDATES.html#self-restart-on-webhosts)
* [Multi-account](https://docs.madelineproto.xyz/docs/UPDATES.html#multiaccount)
* [Automatic static analysis](https://docs.madelineproto.xyz/docs/UPDATES.html#automatic-static-analysis)
* [Webhook (for HTTP APIs)](https://docs.madelineproto.xyz/docs/UPDATES.html#webhook)
* [getUpdates (only for Javascript APIs)](https://docs.madelineproto.xyz/docs/UPDATES.html#getUpdates)
* [Noop (default)](https://docs.madelineproto.xyz/docs/UPDATES.html#noop)
@ -413,7 +414,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#extractmessageupdate-array-updates-array" name="extractMessageUpdate">Extract an update message constructor from an Updates constructor: extractMessageUpdate</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#extractbotapifile-array-info-array" name="extractBotAPIFile">Extract file info from bot API message: extractBotAPIFile</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getCustomEmojiDocuments.html" name="messages.getCustomEmojiDocuments">Fetch custom emoji stickers »: messages.getCustomEmojiDocuments</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/chatlists.getChatlistUpdates.html" name="chatlists.getChatlistUpdates">Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »): chatlists.getChatlistUpdates</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/chatlists.getChatlistUpdates.html" name="chatlists.getChatlistUpdates">Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlistupdateperiod seconds (as per the related client configuration parameter »): chatlists.getChatlistUpdates</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getSavedRingtones.html" name="account.getSavedRingtones">Fetch saved notification sounds: account.getSavedRingtones</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getMessageEditData.html" name="messages.getMessageEditData">Find out if a media message's caption can be edited: messages.getMessageEditData</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.finishTakeoutSession.html" name="account.finishTakeoutSession">Finish account takeout session: account.finishTakeoutSession</a>
@ -575,7 +576,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getUnreadMentions.html" name="messages.getUnreadMentions">Get unread messages where we were mentioned: messages.getUnreadMentions</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getUnreadReactions.html" name="messages.getUnreadReactions">Get unread reactions to messages you sent: messages.getUnreadReactions</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getWebAuthorizations.html" name="account.getWebAuthorizations">Get web login widget authorizations: account.getWebAuthorizations</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getMessageReadParticipants.html" name="messages.getMessageReadParticipants">Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info »: messages.getMessageReadParticipants</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getMessageReadParticipants.html" name="messages.getMessageReadParticipants">Get which users read a specific message: only available for groups and supergroups with less than chatreadmarksizethreshold members, read receipts will be stored for chatreadmarkexpireperiod seconds after the message was sent, see client configuration for more info »: messages.getMessageReadParticipants</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getNotifySettings.html" name="account.getNotifySettings">Gets current notification settings for a given user/group, from all users/all groups: account.getNotifySettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFeaturedEmojiStickers.html" name="messages.getFeaturedEmojiStickers">Gets featured custom emoji stickersets: messages.getFeaturedEmojiStickers</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDefaultHistoryTTL.html" name="messages.getDefaultHistoryTTL">Gets the default value of the Time-To-Live setting, applied to all new chats: messages.getDefaultHistoryTTL</a>
@ -637,7 +638,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#mtprotototdcli-mixed-params-mixed" name="MTProtoToTdcli">MTProto to TDCLI params: MTProtoToTdcli</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.editChatAdmin.html" name="messages.editChatAdmin">Make a user admin in a basic group: messages.editChatAdmin</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#htmltomessageentities-string-html-danog-madelineproto-tl-conversion-domentities-object-containing-message-and-entities" name="htmlToMessageEntities">Manually convert HTML to a message and a set of entities: htmlToMessageEntities</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#markdowntomessageentities-string-markdown-danog-madelineproto-tl-conversion-domentities-object-containing-message-and-entities" name="markdownToMessageEntities">Manually convert markdown to a message and a set of entities: markdownToMessageEntities</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#markdowntomessageentities-string-markdown-danog-madelineproto-tl-conversion-markdownentities-object-containing-message-and-entities" name="markdownToMessageEntities">Manually convert markdown to a message and a set of entities: markdownToMessageEntities</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.markDialogUnread.html" name="messages.markDialogUnread">Manually mark dialog as unread: messages.markDialogUnread</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.readHistory.html" name="channels.readHistory">Mark channel/supergroup history as read: channels.readHistory</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.readMessageContents.html" name="channels.readMessageContents">Mark channel/supergroup message contents as read: channels.readMessageContents</a>

View File

@ -26,7 +26,6 @@
"require": {
"php-64bit": ">=8.1",
"danog/primemodule": "^1",
"erusev/parsedown": "^1.7",
"symfony/polyfill-mbstring": "*",
"ext-mbstring": "*",
"ext-json": "*",

2
docs

@ -1 +1 @@
Subproject commit d24140ca57f743943341d38777f1246f038ce63b
Subproject commit 1dae2c3bc73effbcd19cb61fe16e61050c1d6553

View File

@ -30,9 +30,7 @@ use danog\MadelineProto\EventHandler\Filter\FilterText;
use danog\MadelineProto\EventHandler\Message;
use danog\MadelineProto\EventHandler\SimpleFilter\FromAdmin;
use danog\MadelineProto\EventHandler\SimpleFilter\Incoming;
use danog\MadelineProto\LocalFile;
use danog\MadelineProto\Logger;
use danog\MadelineProto\RemoteUrl;
use danog\MadelineProto\Settings;
use danog\MadelineProto\Settings\Database\Mysql;
use danog\MadelineProto\Settings\Database\Postgres;

View File

@ -336,6 +336,19 @@ class EntitiesTest extends MadelineTestCase
],
],
],
[
'markdown',
'![link ](https://google.com/)',
'link ',
[
[
'offset' => 0,
'length' => 4,
'type' => 'text_url',
'url' => 'https://google.com/'
],
],
],
[
'html',
'<a href="https://google.com/">link </a>test',

View File

@ -31,7 +31,7 @@ if [ "$TAG" == "" ]; then
fi
if [ "$TAG" != "7777" ]; then
grep -q "const RELEASE = '$TAG'" src/MTProto.php || {
grep -q "const RELEASE = '$TAG'" src/API.php || {
echo "The RELEASE constant is not up to date!"
exit 1
}