1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 04:59:00 +01:00
This commit is contained in:
Daniil Gentili 2023-07-08 22:24:31 +02:00
parent 83a6b48471
commit 47f53cf049
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
12 changed files with 37 additions and 71 deletions

View File

@ -92,6 +92,8 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* [Async Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven)
* [Self-restart on webhosts](https://docs.madelineproto.xyz/docs/UPDATES.html#self-restart-on-webhosts)
* [Async Event driven multi-account](https://docs.madelineproto.xyz/docs/UPDATES.html#async-event-driven-multiaccount)
* [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)
* [Database](https://docs.madelineproto.xyz/docs/DATABASE.html)
* [\danog\MadelineProto\Settings\Database\Memory: Memory backend settings.](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/Settings/Database/Memory.html)
@ -677,7 +679,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/account.reportProfilePhoto.html" name="account.reportProfilePhoto">Report a profile photo of a dialog: account.reportProfilePhoto</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.reportEncryptedSpam.html" name="messages.reportEncryptedSpam">Report a secret chat for spam: messages.reportEncryptedSpam</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#report-string-message-string-parsemode-void" name="report">Report an error to the previously set peer: report</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#reportmemoryprofile-void" name="reportMemoryProfile">Report: reportMemoryProfile</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#reportmemoryprofile-void" name="reportMemoryProfile">Report memory profile with memprof: reportMemoryProfile</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/channels.reportSpam.html" name="channels.reportSpam">Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup: channels.reportSpam</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getEmojiGroups.html" name="messages.getEmojiGroups">Represents a list of emoji categories, to be used when selecting custom emojis: messages.getEmojiGroups</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getEmojiStatusGroups.html" name="messages.getEmojiStatusGroups">Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status: messages.getEmojiStatusGroups</a>
@ -823,7 +825,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#uploadfromcallable-mixed-callable-int-size-string-mime-string-filename-callable-cb-bool-seekable-bool-encrypted-mixed" name="uploadFromCallable">Upload file from callable: uploadFromCallable</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#uploadfromstream-mixed-stream-int-size-string-mime-string-filename-callable-cb-bool-encrypted-mixed" name="uploadFromStream">Upload file from stream: uploadFromStream</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#uploadencrypted-filecallbackinterface-string-array-file-string-filename-callable-cb-mixed" name="uploadEncrypted">Upload file to secret chat: uploadEncrypted</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#upload-filecallbackinterface-string-array-file-string-filename-callable-cb-bool-encrypted-mixed" name="upload">Upload file: upload</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#upload-filecallbackinterface-string-array-resource-file-string-filename-callable-cb-bool-encrypted-mixed" name="upload">Upload file: upload</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.uploadRingtone.html" name="account.uploadRingtone">Upload notification sound, use account.saveRingtone to convert it and add it to the list of saved notification sounds: account.uploadRingtone</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.uploadTheme.html" name="account.uploadTheme">Upload theme: account.uploadTheme</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.setGameScore.html" name="messages.setGameScore">Use this method to set the score of the specified user in a game sent as a normal message (bots only): messages.setGameScore</a>

View File

@ -4,7 +4,6 @@
"apiChooseManualAutoTipWeb": "تێبینی بکە کە دەتوانیت API ID/hash ڕاستەوخۆ لە کۆدەکەدا دابین بکەیت بە بەکارهێنانی <a target=\"_blank\" href=\"%s\">ڕێکخستنەکان</a>.",
"constructor_not_found": "Constructor نەدۆزرایەوە بۆ جۆری: ",
"botapi_conversion_error": "ناتوانرێت %s بگۆڕێت بۆ ئۆبجێکتی API بۆت",
"last_byte_invalid": "دوا بایتی نادروستە",
"file_type_invalid": "جۆری پەڕگەی نادروست دۆزراوەتەوە (%s)",
"apiManualInstructions2": "کلیک لەسەر create application بکە",
"signupLastNameWeb": "ناوی کۆتایی",

View File

@ -117,6 +117,5 @@
"src_file_invalid": "منبع فایل نامعتبری لحاظ گردیده: ",
"bool_error": "نمی‌توان‌ boolean را استخراج کرد",
"sec_peer_not_in_db": "این peer مخفی در پایگاه داده (دیتابیس) داخلی peer وجود ندارد",
"last_byte_invalid": "last byte نامعتبر است",
"stream_handle_invalid": "یک کنترل‌کننده جریان (استریم هندل) نامعتبر لحاظ گردیده."
}

View File

@ -53,7 +53,6 @@
"long_not_16": "La valeur donnée ne fait pas 16 octets",
"long_not_32": "La valeur donnée ne fait pas 32 octets",
"long_not_64": "La valeur donnée ne fait pas 64 octets",
"last_byte_invalid": "Dernier octet invalide",
"call_error_3": "Impossible de trouver et de terminer l'appel %s",
"call_completing": "Fin de l'appel de %s...",
"call_confirming": "Confirmation de l'appel de %s...",

View File

@ -1,26 +1,26 @@
{
"go": "קדימה",
"apiChooseManualAutoTip": "שים לב שאתה יכול גם לספק את מזהה ה-API\/hash ישירות בקוד באמצעות ההגדרות: %s",
"apiChooseManualAutoTipWeb": "שים לב שאתה יכול גם לספק את מזהה ה-API\/hash ישירות בקוד באמצעות ה- <a target=\"_blank\" href=\"%s\">הגדרות<\/a>.",
"apiChoosePrompt": "בחירתך (m\/a): ",
"apiManualInstructions0": "התחבר ל https:\/\/my.telegram.org",
"apiChooseManualAutoTip": "שים לב שאתה יכול גם לספק את מזהה ה-API/hash ישירות בקוד באמצעות ההגדרות: %s",
"apiChooseManualAutoTipWeb": "שים לב שאתה יכול גם לספק את מזהה ה-API/hash ישירות בקוד באמצעות ה- <a target=\"_blank\" href=\"%s\">הגדרות</a>.",
"apiChoosePrompt": "בחירתך (m/a): ",
"apiManualInstructions0": "התחבר ל https://my.telegram.org",
"apiManualInstructions1": "לך ל API development tools",
"apiManualInstructions2": "לחץ על create application",
"apiAppInstructionsManual0": "שם האפליקציה שלך, יכול להיות כל שם",
"apiAppInstructionsManual1": "שם קצר לאפליקציה שלך, אותיות באנגלית בלבד, 5-32 תווים",
"apiAppInstructionsManual2": "קישור לאפליקציה\/לאתר שלך או t.me\/yourusername",
"apiAppInstructionsManual2": "קישור לאפליקציה/לאתר שלך או t.me/yourusername",
"apiAppInstructionsManual3": "הכל",
"apiAppInstructionsManual4": "תאר את האפליקציה שלך פה",
"apiManualWeb": "הזן את API ID ו API hash",
"apiManualPrompt0": "הזן את ה API ID שלך: ",
"apiManualPrompt1": "הזן את ה API Hash שלך: ",
"apiAutoWeb": "הזן את מספר הטלפון <b>שכבר רשום<\/b> בטלגרם כדי לקבל את ה API ID",
"apiAutoWeb": "הזן את מספר הטלפון <b>שכבר רשום</b> בטלגרם כדי לקבל את ה API ID",
"apiAutoPrompt0": "הזן את מספר הטלפון שכבר רשום בטלגרם: ",
"apiAutoPrompt1": "הזן את קוד האימות שקיבלת באפליקצית טגלרם: ",
"apiAppWeb": "הזן את פרטי ה API",
"apiAppInstructionsAuto0": "הזן את שם האפליקציה שלך, יכול להיות כל שם: ",
"apiAppInstructionsAuto1": "הזן שם קצר לאפליקציה שלך, אותיות באנגלית בלבד, 5-32 תווים: ",
"apiAppInstructionsAuto2": "הזן את הקישור לאפליקציה\/לאתר שלך או t.me\/yourusername: ",
"apiAppInstructionsAuto2": "הזן את הקישור לאפליקציה/לאתר שלך או t.me/yourusername: ",
"apiAppInstructionsAuto3": "הזן את פלטופרמת האפליקציה: ",
"apiAppInstructionsAuto4": "תאר את האפליקציה שלך: ",
"apiAppInstructionsAutoTypeOther": "אחר (פרט בתיאור)",
@ -116,7 +116,6 @@
"constructor_not_found": "הבנאי לא נמצא לסוג: ",
"botapi_conversion_error": "לא ניתן להמיר את %s לאובייקט bot API",
"non_text_conversion": "עדיין לא ניתן להמיר הודעות שאינן טקסט!",
"last_byte_invalid": "בייט אחרון לא חוקי",
"file_type_invalid": "זוהה סוג קובץ לא חוקי (%s)",
"secret_chat_skipping": "אין לי את הצ'אט הסודי %s במסד הנתונים, דילוג על הודעה..."
}

View File

@ -60,7 +60,6 @@
"constructor_not_found": "Costruttore non trovato per tipo: ",
"botapi_conversion_error": "Non sono risucito a convertire %s in un oggetto bot API",
"non_text_conversion": "Non posso ancora convertire messaggi media!",
"last_byte_invalid": "L'ultimo byte non è valido",
"file_type_invalid": "È stato fornito un tipo file errato",
"secret_chat_skipping": "Non ho la chat segreta %s nel database, ignorando messaggio...",
"done": "Fatto!",

View File

@ -116,7 +116,6 @@
"constructor_not_found": "Ushbu tur uchun konstruktor topilmadi: ",
"botapi_conversion_error": "%s bot API obyektiga aylantirib bolmadi",
"non_text_conversion": "Matnli boʻlmagan xabarlarni oʻzgartirib boʻlmaydi!",
"last_byte_invalid": "Oxirgi bayt yaroqsiz",
"file_type_invalid": "Yaroqsiz fayl turi aniqlandi (%s)",
"secret_chat_skipping": "Menda %s maxfiy chati maʼlumotlar bazasida yoʻq, xabar oʻtkazib yuborilmoqda..."
}

View File

@ -57,7 +57,7 @@ abstract class EventHandler extends AbstractAPI
* @param string $session Session name
* @param SettingsAbstract $settings Settings
*
* @return class-string<static>
* @return class-string|never The current class name will only be returned if we're currently including plugins.
*/
final public static function startAndLoop(string $session, SettingsAbstract $settings): string
{
@ -66,6 +66,7 @@ abstract class EventHandler extends AbstractAPI
}
$API = new API($session, $settings);
$API->startAndLoopInternal(static::class);
return static::class;
}
/**
* Start MadelineProto as a bot and the event handler.
@ -76,7 +77,7 @@ abstract class EventHandler extends AbstractAPI
* @param string $token Bot token
* @param SettingsAbstract $settings Settings
*
* @return class-string<static>
* @return class-string|never The current class name will only be returned if we're currently including plugins.
*/
final public static function startAndLoopBot(string $session, string $token, SettingsAbstract $settings): string
{
@ -86,6 +87,7 @@ abstract class EventHandler extends AbstractAPI
$API = new API($session, $settings);
$API->botLogin($token);
$API->startAndLoopInternal(static::class);
return static::class;
}
/** @internal */
final protected function reconnectFull(): bool
@ -233,11 +235,12 @@ abstract class EventHandler extends AbstractAPI
/**
* Obtain a path or a list of paths that will be recursively searched for plugins.
*
* Plugin filenames end with .madeline.php, and will be included automatically.
* Plugin filenames end with .plugin.php, and will be included automatically.
*
* @return non-empty-string|non-empty-list<non-empty-string>|null
*/
public function getPluginPaths(): string|array|null {
public function getPluginPaths(): string|array|null
{
return null;
}
/**
@ -253,34 +256,31 @@ abstract class EventHandler extends AbstractAPI
/**
* Obtain a list of plugin event handlers.
*/
final private function internalGetPlugins(): array {
private function internalGetPlugins(): array
{
$paths = $this->getPluginPaths();
if (is_string($paths)) {
if (\is_string($paths)) {
$paths = [$paths];
} elseif ($paths === null) {
$paths = [];
}
$recurse = static function (string $path) use (&$recurse): \Generator {
$plugins = $this->getPlugins();
$plugins = \array_values(\array_unique($plugins));
$recurse = static function (string $path) use (&$recurse, &$plugins): void {
foreach (listFiles($path) as $file) {
if (isDirectory($file)) {
yield from $recurse($file);
} elseif (isFile($file) && str_ends_with($file, ".madeline.php")) {
yield require $file;
$recurse($file);
} elseif (isFile($file) && \str_ends_with($file, ".plugin.php")) {
$plugins []= require $file;
}
}
};
$plugins = $this->getPlugins();
$plugins = \array_values(\array_unique($plugins));
self::$includingPlugins = true;
try {
foreach ($paths as $path) {
foreach ($recurse($path) as $plugin) {
$plugins []= $plugin;
}
}
self::$includingPlugins = true;
\array_map($recurse, $paths);
} finally {
self::$includingPlugins = false;
}
@ -289,7 +289,7 @@ abstract class EventHandler extends AbstractAPI
foreach ($plugins as $plugin) {
Assert::classExists($plugin);
Assert::true(is_subclass_of($plugin, self::class), "$plugin must extend ".self::class);
Assert::true(\is_subclass_of($plugin, self::class), "$plugin must extend ".self::class);
Assert::notEq($plugin, self::class);
}

View File

@ -865,7 +865,7 @@ abstract class InternalDoc
* type: string
* } : ($type is API::INFO_TYPE_TYPE ? string : ($type is \danog\MadelineProto\API::INFO_TYPE_ID ? int : array{_: string, user_id?: int, access_hash?: int, min?: bool, chat_id?: int, channel_id?: int}|array{_: string, user_id?: int, access_hash?: int, min?: bool}|array{_: string, channel_id: int, access_hash: int, min: bool})))
*/
public function getInfo(mixed $id, int $type = \danog\MadelineProto\API::INFO_TYPE_ALL): array|int
public function getInfo(mixed $id, int $type = \danog\MadelineProto\API::INFO_TYPE_ALL): array|string|int
{
return $this->wrapper->getAPI()->getInfo($id, $type);
}

View File

@ -73,7 +73,6 @@ final class Lang
'file_type_invalid' => 'جۆری پەڕگەی نادروست دۆزراوەتەوە (%s)',
'fingerprint_invalid' => 'پەنجەمۆری کلیل نادروستە!',
'go' => 'بڕۆ',
'last_byte_invalid' => 'دوا بایتی نادروستە',
'length_too_big' => 'درێژی زۆر گەورەیە',
'loginBot' => 'تۆکنی بۆتەکەت بنووسە: ',
'loginBotTokenWeb' => 'بۆت تۆکن',
@ -196,7 +195,6 @@ final class Lang
'file_type_invalid' => 'Invalid file type detected (%s)',
'fingerprint_invalid' => 'Invalid key fingerprint!',
'go' => 'Go',
'last_byte_invalid' => 'Invalid last byte',
'length_too_big' => 'Length is too big',
'loginBot' => 'Enter your bot token: ',
'loginBotTokenWeb' => 'Bot token',
@ -319,7 +317,6 @@ final class Lang
'file_type_invalid' => 'نوع فایل نامعتبر شناسایی شد (%s)',
'fingerprint_invalid' => 'اثرانگشت کلید نامعتبر است!',
'go' => 'برو',
'last_byte_invalid' => 'last byte نامعتبر است',
'length_too_big' => 'طول بسیار بزرگ است',
'loginBot' => 'توکن ربات‌تان را وارد کنید: ',
'loginBotTokenWeb' => 'توکن ربات',
@ -442,7 +439,6 @@ final class Lang
'file_type_invalid' => 'Invalid file type detected (%s)',
'fingerprint_invalid' => 'Invalid key fingerprint!',
'go' => 'Go',
'last_byte_invalid' => 'Dernier octet invalide',
'length_too_big' => 'Length is too big',
'loginBot' => 'Enter your bot token: ',
'loginBotTokenWeb' => 'Bot token',
@ -565,7 +561,6 @@ final class Lang
'file_type_invalid' => 'זוהה סוג קובץ לא חוקי (%s)',
'fingerprint_invalid' => 'טביעת אצבע לא חוקית של מפתח!',
'go' => 'קדימה',
'last_byte_invalid' => 'בייט אחרון לא חוקי',
'length_too_big' => 'האורך גדול מדי',
'loginBot' => 'הזן את הטוקן של הבוט שלך: ',
'loginBotTokenWeb' => 'טוקן הבוט',
@ -688,7 +683,6 @@ final class Lang
'file_type_invalid' => 'È stato fornito un tipo file errato',
'fingerprint_invalid' => 'fingerprint della chiave non valido!',
'go' => 'Vai',
'last_byte_invalid' => 'L\'ultimo byte non è valido',
'length_too_big' => 'Il valore fornito è troppo lungo',
'loginBot' => 'Inserisci il tuo bot token: ',
'loginBotTokenWeb' => 'Token del bot',
@ -811,7 +805,6 @@ final class Lang
'file_type_invalid' => 'Invalid file type detected (%s)',
'fingerprint_invalid' => 'Invalid key fingerprint!',
'go' => 'ОК',
'last_byte_invalid' => 'Invalid last byte',
'length_too_big' => 'Length is too big',
'loginBot' => 'Введите токен бота: ',
'loginBotTokenWeb' => 'Токен бота',
@ -934,7 +927,6 @@ final class Lang
'file_type_invalid' => 'Yaroqsiz fayl turi aniqlandi (%s)',
'fingerprint_invalid' => 'Barmoq izi yaroqsiz!',
'go' => 'Boshlash',
'last_byte_invalid' => 'Oxirgi bayt yaroqsiz',
'length_too_big' => 'Uzunlik juda katta',
'loginBot' => 'Bot tokeningizni kiriting ',
'loginBotTokenWeb' => 'Bot tokeni',
@ -1059,7 +1051,6 @@ final class Lang
'file_type_invalid' => 'Invalid file type detected (%s)',
'fingerprint_invalid' => 'Invalid key fingerprint!',
'go' => 'Go',
'last_byte_invalid' => 'Invalid last byte',
'length_too_big' => 'Length is too big',
'loginBot' => 'Enter your bot token: ',
'loginBotTokenWeb' => 'Bot token',

View File

@ -132,27 +132,6 @@ final class AppInfo extends SettingsAbstract
public function setApiId(int $apiId): self
{
$this->apiId = $apiId;
if ($apiId === 6) {
// TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes.
// All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans.
// This makes usage of all MTProto libraries very difficult, at least for new users.
// To help a bit, when the android API ID is used, the android app infos are spoofed too.
// THE ANDROID API HASH IS NOT PRESENT IN THIS REPOSITORY, AND WILL NOT BE GIVEN TO EVERYONE.
// This measure was NOT created with the intent to aid spammers, flooders, and other scum.
//
// I understand that automated account registration through headless libraries may indicate the creation of a botnet,
// ...and I understand why these automatic bans were implemented in the first place.
// Manual requests to activate numbers through recover@telegram.org will still be required for the majority of users of this library,
// ...those that choose to user their own API ID for their application.
//
// To be honest, I wrote this feature just for me, since I honestly don't want to
// ...go through the hassle of registering => recovering => logging in to every account I use for my services (mainly webradios and test userbots)
$this->deviceModel = 'LGENexus 5';
$this->systemVersion = 'SDK 28';
$this->appVersion = '4.9.1 (13613)';
$this->langPack = 'android';
}
return $this;
}

File diff suppressed because one or more lines are too long