From 80caf5e4546336e9abef84a01d2344068ada01a1 Mon Sep 17 00:00:00 2001 From: Setiawan Hu Date: Fri, 14 Aug 2020 00:53:24 +0700 Subject: [PATCH 1/4] Updated TelegramAccountLoginCommand updated: - Asking the 2FA password as secret instead plain string --- src/Commands/TelegramAccountLoginCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/TelegramAccountLoginCommand.php b/src/Commands/TelegramAccountLoginCommand.php index 1a083a2..80ef49b 100644 --- a/src/Commands/TelegramAccountLoginCommand.php +++ b/src/Commands/TelegramAccountLoginCommand.php @@ -41,7 +41,7 @@ class TelegramAccountLoginCommand extends Command try { MadelineProto::completePhoneLogin($code); } catch (NeedTwoFactorAuthException $e) { - $password = $this->ask("2FA Password (hint '{$e->account->hint}')"); + $password = $this->secret("2FA Password (hint '{$e->account->hint}')"); MadelineProto::submit2FA($password); } catch (SignUpNeededException $e) { From 5bcf730685b44acd4d69421aab752e10cc7fe15d Mon Sep 17 00:00:00 2001 From: Setiawan Hu Date: Fri, 14 Aug 2020 00:54:51 +0700 Subject: [PATCH 2/4] Updated MultiSessionCommand updated: - updated wording - code refactoring --- src/Commands/MultiSessionCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/MultiSessionCommand.php b/src/Commands/MultiSessionCommand.php index 6e415aa..4b61481 100644 --- a/src/Commands/MultiSessionCommand.php +++ b/src/Commands/MultiSessionCommand.php @@ -67,7 +67,7 @@ class MultiSessionCommand extends Command $this->exportMigration($tableName, $user ?? null); - $this->info('Migration file exported.'); + $this->info('Migration file generated.'); } /** @@ -78,7 +78,7 @@ class MultiSessionCommand extends Command */ public function exportMigration(string $tableName, string $relation = null) { - if ($relation == null) { + if (is_null($relation)) { $relation = 'App/User'; } From 1b543ab25ad3f5596308fe220f88de5a9938d00b Mon Sep 17 00:00:00 2001 From: Setiawan Hu Date: Fri, 14 Aug 2020 00:55:26 +0700 Subject: [PATCH 3/4] Updated MadelineProtoFactory updated: - moving the null config logic to make() method --- src/Factories/MadelineProtoFactory.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Factories/MadelineProtoFactory.php b/src/Factories/MadelineProtoFactory.php index f48f635..9577b3c 100644 --- a/src/Factories/MadelineProtoFactory.php +++ b/src/Factories/MadelineProtoFactory.php @@ -45,10 +45,6 @@ class MadelineProtoFactory */ public function get($session, array $config = null) { - if (is_null($config)) { - $config = config('telegram.settings'); - } - if (is_int($session)) { $session = $this->database->table($this->table)->find($session); @@ -64,11 +60,16 @@ class MadelineProtoFactory * Generating MadelineProto (session) instance. * * @param string $sessionFile - * @param array $config + * @param array|null $config if this parameter is null, then the config from telegram.php + * file will be used * @return MadelineProto */ - public function make(string $sessionFile, array $config) + public function make(string $sessionFile, array $config = null) { + if (is_null($config)) { + $config = config('telegram.settings'); + } + if (!file_exists(storage_path("app/telegram/"))) { mkdir(storage_path("app/telegram"), 0755); } From 00d08a9aa75c3fa4ef8f6a3f2a637040495ceb66 Mon Sep 17 00:00:00 2001 From: Setiawan Hu Date: Fri, 14 Aug 2020 17:08:58 +0700 Subject: [PATCH 4/4] Updated documentation --- src/ClientMessages.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ClientMessages.php b/src/ClientMessages.php index 2fcb4ef..5bea70c 100644 --- a/src/ClientMessages.php +++ b/src/ClientMessages.php @@ -26,7 +26,7 @@ class ClientMessages * *
* - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.acceptUrlAuth method payload. It's fields will be sent as payload. * * @param mixed $messageId @@ -79,7 +79,7 @@ class ClientMessages * * * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.addChatUser method payload. It's fields will be sent as payload. * * @param mixed $chatId @@ -107,7 +107,7 @@ class ClientMessages * *
* - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.addChatUser method payload. It's fields will be sent as payload. * * @param mixed $hash @@ -139,7 +139,7 @@ class ClientMessages /** * Clear recent stickers. * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.clearRecentStickers method payload. It's fields will be sent as payload. * * @param bool|TelegramObject $attached @@ -183,7 +183,7 @@ class ClientMessages * * * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.createChat method payload. It's fields will be sent as payload. * * @param mixed $title @@ -229,7 +229,7 @@ class ClientMessages * * * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.deleteChatUser method payload. It's fields will be sent as payload. * * @param mixed $chatId @@ -275,7 +275,7 @@ class ClientMessages * * * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.deleteHistory method payload. It's fields will be sent as payload. * * @param mixed $peer @@ -304,7 +304,7 @@ class ClientMessages * *
* - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.deleteMessages method payload. It's fields will be sent as payload. * * @param mixed $id @@ -328,7 +328,7 @@ class ClientMessages /** * Delete scheduled messages. * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.deleteScheduledMessages method payload. It's fields will be sent as payload. * * @param mixed $peer @@ -352,7 +352,7 @@ class ClientMessages /** * Edit the description of a group/supergroup/channel. * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.editChatAbout method payload. It's fields will be sent as payload. * * @param mixed $peer @@ -376,7 +376,7 @@ class ClientMessages /** * Make a user admin in a legacy group. * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.editChatAdmin method payload. It's fields will be sent as payload. * * @param mixed $chatId @@ -402,7 +402,7 @@ class ClientMessages /** * Edit the default banned rights of a channel/supergroup/group. * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.editChatDefaultBannedRights method payload. It's fields will be sent as payload. * * @param mixed $peer @@ -448,7 +448,7 @@ class ClientMessages * * * - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.sendMessage method payload. It's fields will be sent as payload. * * @param mixed $peer @@ -477,7 +477,7 @@ class ClientMessages * *
* - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.getPeerDialog method payload. It's fields will be sent as payload. * * @param int ...$peers @@ -501,7 +501,7 @@ class ClientMessages * *
* - * For convenience, the first argument may contains a TelegramObject which contains + * For convenience, you may pass a TelegramObject to the first argument which contains * messages.getHistory method payload. It's fields will be sent as payload. * * @param array|TelegramObject $params