Implemented markdown and html parsing

This commit is contained in:
Daniil Gentili 2017-02-13 04:33:06 +01:00
parent a25adf2d7c
commit c86e35645e
2504 changed files with 3469 additions and 2532 deletions

View File

@ -50,8 +50,6 @@ Now copy .env.example to .env, edit the its values, read the docs and take a loo
### Dependencies
This project depends on [PHPStruct](https://github.com/danog/PHPStruct), [phpseclib](https://github.com/phpseclib/phpseclib)
To install dependencies install composer and run:
```
composer update
@ -305,6 +303,8 @@ var_dump($authorization);
See tests/testing.php for more examples.
Methods that allow sending message entities (messages.sendMessage for example) also have an additional parse_mode parameter that enables or disables html/markdown parsing of the message to be sent. See the method-specific documentation for more info.
Note that when you login as a bot, MadelineProto also logins using the [PWRTelegram](https://pwrtelegram.xyz) API, to allow persistant storage of peers, even after a logout and another login.
### Storing sessions

View File

@ -17,7 +17,9 @@
"danog/phpstruct": "dev-fast",
"phpseclib/phpseclib": "dev-ige",
"vlucas/phpdotenv": "^2.4",
"krakjoe/pthreads-polyfill": "dev-master"
"krakjoe/pthreads-polyfill": "dev-master",
"paquettg/php-html-parser": "^1.7",
"erusev/parsedown": "^1.6"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "^3.1"

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$User = $MadelineProto->account->changePhone(['phone_number' => string, 'phone_code_hash' => string, 'phone_code' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->checkUsername(['username' => string, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->confirmPhone(['phone_code_hash' => string, 'phone_code' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->deleteAccount(['reason' => string, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$AccountDaysTTL = $MadelineProto->account->getAccountTTL();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$account_Authorizations = $MadelineProto->account->getAuthorizations();
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$PeerNotifySettings = $MadelineProto->account->getNotifySettings(['peer' => InputNotifyPeer, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$account_Password = $MadelineProto->account->getPassword();
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$account_PasswordSettings = $MadelineProto->account->getPasswordSettings(['current_password_hash' => bytes, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$account_PrivacyRules = $MadelineProto->account->getPrivacy(['key' => InputPrivacyKey, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Vector_of_WallPaper = $MadelineProto->account->getWallPapers();
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->registerDevice(['token_type' => int, 'token' => string, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->reportPeer(['peer' => InputPeer, 'reason' => ReportReason, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->resetAuthorization(['hash' => long, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->resetNotifySettings();
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$auth_SentCode = $MadelineProto->account->sendChangePhoneCode(['allow_flashcall' => Bool, 'phone_number' => string, 'current_number' => Bool, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$auth_SentCode = $MadelineProto->account->sendConfirmPhoneCode(['allow_flashcall' => Bool, 'hash' => string, 'current_number' => Bool, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->setAccountTTL(['ttl' => AccountDaysTTL, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$account_PrivacyRules = $MadelineProto->account->setPrivacy(['key' => InputPrivacyKey, 'rules' => [InputPrivacyRule], ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->unregisterDevice(['token_type' => int, 'token' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->updateDeviceLocked(['period' => int, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->updateNotifySettings(['peer' => InputNotifyPeer, 'settings' => InputPeerNotifySettings, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->updatePasswordSettings(['current_password_hash' => bytes, 'new_settings' => account_PasswordInputSettings, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$User = $MadelineProto->account->updateProfile(['first_name' => string, 'last_name' => string, 'about' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->account->updateStatus(['offline' => Bool, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$User = $MadelineProto->account->updateUsername(['username' => string, ]);
```
```

View File

@ -37,4 +37,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->auth->bindTempAuthKey(['perm_auth_key_id' => long, 'nonce' => long, 'expires_at' => int, 'encrypted_message' => bytes, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->auth->cancelCode(['phone_number' => string, 'phone_code_hash' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$auth_Authorization = $MadelineProto->auth->checkPassword(['password_hash' => bytes, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$auth_CheckedPhone = $MadelineProto->auth->checkPhone(['phone_number' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->auth->dropTempAuthKeys(['except_auth_keys' => [long], ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$auth_ExportedAuthorization = $MadelineProto->auth->exportAuthorization(['dc_id' => int, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$auth_Authorization = $MadelineProto->auth->importAuthorization(['id' => int, 'bytes' => bytes, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$auth_Authorization = $MadelineProto->auth->importBotAuthorization(['api_id' => int, 'api_hash' => string, 'bot_auth_token' => string, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->auth->logOut();
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$auth_Authorization = $MadelineProto->auth->recoverPassword(['code' => string, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$auth_PasswordRecovery = $MadelineProto->auth->requestPasswordRecovery();
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$auth_SentCode = $MadelineProto->auth->resendCode(['phone_number' => string, 'phone_code_hash' => string, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->auth->resetAuthorizations();
```
```

View File

@ -38,4 +38,4 @@ if (isset($number)) {
}
$auth_SentCode = $MadelineProto->auth->sendCode(['allow_flashcall' => Bool, 'phone_number' => string, 'current_number' => Bool, 'api_id' => int, 'api_hash' => string, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->auth->sendInvites(['phone_numbers' => [string], 'message' => string, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$auth_Authorization = $MadelineProto->auth->signIn(['phone_number' => string, 'phone_code_hash' => string, 'phone_code' => string, ]);
```
```

View File

@ -38,4 +38,4 @@ if (isset($number)) {
}
$auth_Authorization = $MadelineProto->auth->signUp(['phone_number' => string, 'phone_code_hash' => string, 'phone_code' => string, 'first_name' => string, 'last_name' => string, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->channels->checkUsername(['channel' => InputChannel, 'username' => string, ]);
```
```

View File

@ -37,4 +37,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->createChannel(['broadcast' => Bool, 'megagroup' => Bool, 'title' => string, 'about' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->deleteChannel(['channel' => InputChannel, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$messages_AffectedMessages = $MadelineProto->channels->deleteMessages(['channel' => InputChannel, 'id' => [int], ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$messages_AffectedHistory = $MadelineProto->channels->deleteUserHistory(['channel' => InputChannel, 'user_id' => InputUser, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->channels->editAbout(['channel' => InputChannel, 'about' => string, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->editAdmin(['channel' => InputChannel, 'user_id' => InputUser, 'role' => ChannelParticipantRole, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->editPhoto(['channel' => InputChannel, 'photo' => InputChatPhoto, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->editTitle(['channel' => InputChannel, 'title' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$ExportedChatInvite = $MadelineProto->channels->exportInvite(['channel' => InputChannel, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$ExportedMessageLink = $MadelineProto->channels->exportMessageLink(['channel' => InputChannel, 'id' => int, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$messages_Chats = $MadelineProto->channels->getAdminedPublicChannels();
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$messages_Chats = $MadelineProto->channels->getChannels(['id' => [InputChannel], ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$messages_ChatFull = $MadelineProto->channels->getFullChannel(['channel' => InputChannel, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$messages_Messages = $MadelineProto->channels->getMessages(['channel' => InputChannel, 'id' => [int], ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$channels_ChannelParticipant = $MadelineProto->channels->getParticipant(['channel' => InputChannel, 'user_id' => InputUser, ]);
```
```

View File

@ -37,4 +37,4 @@ if (isset($number)) {
}
$channels_ChannelParticipants = $MadelineProto->channels->getParticipants(['channel' => InputChannel, 'filter' => ChannelParticipantsFilter, 'offset' => int, 'limit' => int, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->inviteToChannel(['channel' => InputChannel, 'users' => [InputUser], ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->joinChannel(['channel' => InputChannel, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->kickFromChannel(['channel' => InputChannel, 'user_id' => InputUser, 'kicked' => Bool, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->leaveChannel(['channel' => InputChannel, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->channels->readHistory(['channel' => InputChannel, 'max_id' => int, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->channels->reportSpam(['channel' => InputChannel, 'user_id' => InputUser, 'id' => [int], ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->toggleInvites(['channel' => InputChannel, 'enabled' => Bool, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->toggleSignatures(['channel' => InputChannel, 'enabled' => Bool, ]);
```
```

View File

@ -36,4 +36,4 @@ if (isset($number)) {
}
$Updates = $MadelineProto->channels->updatePinnedMessage(['silent' => Bool, 'channel' => InputChannel, 'id' => int, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->channels->updateUsername(['channel' => InputChannel, 'username' => string, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->contacts->block(['id' => InputUser, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$contacts_Link = $MadelineProto->contacts->deleteContact(['id' => InputUser, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->contacts->deleteContacts(['id' => [InputUser], ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Vector_of_int = $MadelineProto->contacts->exportCard();
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$contacts_Blocked = $MadelineProto->contacts->getBlocked(['offset' => int, 'limit' => int, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$contacts_Contacts = $MadelineProto->contacts->getContacts(['hash' => string, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Vector_of_ContactStatus = $MadelineProto->contacts->getStatuses();
```
```

View File

@ -41,4 +41,4 @@ if (isset($number)) {
}
$contacts_TopPeers = $MadelineProto->contacts->getTopPeers(['correspondents' => Bool, 'bots_pm' => Bool, 'bots_inline' => Bool, 'groups' => Bool, 'channels' => Bool, 'offset' => int, 'limit' => int, 'hash' => int, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$User = $MadelineProto->contacts->importCard(['export_card' => [int], ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$contacts_ImportedContacts = $MadelineProto->contacts->importContacts(['contacts' => [InputContact], 'replace' => Bool, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->contacts->resetTopPeerRating(['category' => TopPeerCategory, 'peer' => InputPeer, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$contacts_ResolvedPeer = $MadelineProto->contacts->resolveUsername(['username' => string, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$contacts_Found = $MadelineProto->contacts->search(['q' => string, 'limit' => int, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->contacts->unblock(['id' => InputUser, ]);
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$help_AppChangelog = $MadelineProto->help->getAppChangelog();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$help_AppUpdate = $MadelineProto->help->getAppUpdate();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$Config = $MadelineProto->help->getConfig();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$help_InviteText = $MadelineProto->help->getInviteText();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$NearestDc = $MadelineProto->help->getNearestDc();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$help_Support = $MadelineProto->help->getSupport();
```
```

View File

@ -29,4 +29,4 @@ if (isset($number)) {
}
$help_TermsOfService = $MadelineProto->help->getTermsOfService();
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->help->saveAppLog(['events' => [InputAppEvent], ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$Bool = $MadelineProto->help->setBotUpdatesStatus(['pending_updates_count' => int, 'message' => string, ]);
```
```

View File

@ -39,4 +39,4 @@ if (isset($number)) {
}
$X = $MadelineProto->initConnection(['api_id' => int, 'device_model' => string, 'system_version' => string, 'app_version' => string, 'lang_code' => string, 'query' => !X, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$X = $MadelineProto->invokeAfterMsg(['msg_id' => long, 'query' => !X, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$X = $MadelineProto->invokeAfterMsgs(['msg_ids' => [long], 'query' => !X, ]);
```
```

View File

@ -35,4 +35,4 @@ if (isset($number)) {
}
$X = $MadelineProto->invokeWithLayer(['layer' => int, 'query' => !X, ]);
```
```

View File

@ -34,4 +34,4 @@ if (isset($number)) {
}
$X = $MadelineProto->invokeWithoutUpdates(['query' => !X, ]);
```
```

Some files were not shown because too many files have changed in this diff Show More