Merge pull request #3 from setiawanhu/dev

Fixing minor bugs
This commit is contained in:
Setiawan 2020-08-16 16:54:17 +07:00 committed by GitHub
commit 886d3034f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 24 deletions

View File

@ -26,7 +26,7 @@ class ClientMessages
* *
* <br> * <br>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.acceptUrlAuth</strong> method payload. It's fields will be sent as payload. * <strong>messages.acceptUrlAuth</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $messageId * @param mixed $messageId
@ -79,7 +79,7 @@ class ClientMessages
* </li> * </li>
* </ol> * </ol>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.addChatUser</strong> method payload. It's fields will be sent as payload. * <strong>messages.addChatUser</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $chatId * @param mixed $chatId
@ -107,7 +107,7 @@ class ClientMessages
* *
* <br> * <br>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.addChatUser</strong> method payload. It's fields will be sent as payload. * <strong>messages.addChatUser</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $hash * @param mixed $hash
@ -139,7 +139,7 @@ class ClientMessages
/** /**
* Clear recent stickers. * 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
* <strong>messages.clearRecentStickers</strong> method payload. It's fields will be sent as payload. * <strong>messages.clearRecentStickers</strong> method payload. It's fields will be sent as payload.
* *
* @param bool|TelegramObject $attached * @param bool|TelegramObject $attached
@ -183,7 +183,7 @@ class ClientMessages
* </li> * </li>
* </ol> * </ol>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.createChat</strong> method payload. It's fields will be sent as payload. * <strong>messages.createChat</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $title * @param mixed $title
@ -229,7 +229,7 @@ class ClientMessages
* </li> * </li>
* </ol> * </ol>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.deleteChatUser</strong> method payload. It's fields will be sent as payload. * <strong>messages.deleteChatUser</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $chatId * @param mixed $chatId
@ -275,7 +275,7 @@ class ClientMessages
* </li> * </li>
* </ol> * </ol>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.deleteHistory</strong> method payload. It's fields will be sent as payload. * <strong>messages.deleteHistory</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $peer * @param mixed $peer
@ -304,7 +304,7 @@ class ClientMessages
* *
* <br> * <br>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.deleteMessages</strong> method payload. It's fields will be sent as payload. * <strong>messages.deleteMessages</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $id * @param mixed $id
@ -328,7 +328,7 @@ class ClientMessages
/** /**
* Delete scheduled messages. * 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
* <strong>messages.deleteScheduledMessages</strong> method payload. It's fields will be sent as payload. * <strong>messages.deleteScheduledMessages</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $peer * @param mixed $peer
@ -352,7 +352,7 @@ class ClientMessages
/** /**
* Edit the description of a group/supergroup/channel. * 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
* <strong>messages.editChatAbout</strong> method payload. It's fields will be sent as payload. * <strong>messages.editChatAbout</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $peer * @param mixed $peer
@ -376,7 +376,7 @@ class ClientMessages
/** /**
* Make a user admin in a legacy group. * 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
* <strong>messages.editChatAdmin</strong> method payload. It's fields will be sent as payload. * <strong>messages.editChatAdmin</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $chatId * @param mixed $chatId
@ -402,7 +402,7 @@ class ClientMessages
/** /**
* Edit the default banned rights of a channel/supergroup/group. * 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
* <strong>messages.editChatDefaultBannedRights</strong> method payload. It's fields will be sent as payload. * <strong>messages.editChatDefaultBannedRights</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $peer * @param mixed $peer
@ -448,7 +448,7 @@ class ClientMessages
* </li> * </li>
* </ol> * </ol>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.sendMessage</strong> method payload. It's fields will be sent as payload. * <strong>messages.sendMessage</strong> method payload. It's fields will be sent as payload.
* *
* @param mixed $peer * @param mixed $peer
@ -477,7 +477,7 @@ class ClientMessages
* *
* <br> * <br>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.getPeerDialog</strong> method payload. It's fields will be sent as payload. * <strong>messages.getPeerDialog</strong> method payload. It's fields will be sent as payload.
* *
* @param int ...$peers * @param int ...$peers
@ -501,7 +501,7 @@ class ClientMessages
* *
* <br> * <br>
* *
* For convenience, the first argument may contains a TelegramObject which contains * For convenience, you may pass a TelegramObject to the first argument which contains
* <strong>messages.getHistory</strong> method payload. It's fields will be sent as payload. * <strong>messages.getHistory</strong> method payload. It's fields will be sent as payload.
* *
* @param array|TelegramObject $params * @param array|TelegramObject $params

View File

@ -67,7 +67,7 @@ class MultiSessionCommand extends Command
$this->exportMigration($tableName, $user ?? null); $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) public function exportMigration(string $tableName, string $relation = null)
{ {
if ($relation == null) { if (is_null($relation)) {
$relation = 'App/User'; $relation = 'App/User';
} }

View File

@ -41,7 +41,7 @@ class TelegramAccountLoginCommand extends Command
try { try {
MadelineProto::completePhoneLogin($code); MadelineProto::completePhoneLogin($code);
} catch (NeedTwoFactorAuthException $e) { } catch (NeedTwoFactorAuthException $e) {
$password = $this->ask("2FA Password (hint '{$e->account->hint}')"); $password = $this->secret("2FA Password (hint '{$e->account->hint}')");
MadelineProto::submit2FA($password); MadelineProto::submit2FA($password);
} catch (SignUpNeededException $e) { } catch (SignUpNeededException $e) {

View File

@ -45,10 +45,6 @@ class MadelineProtoFactory
*/ */
public function get($session, array $config = null) public function get($session, array $config = null)
{ {
if (is_null($config)) {
$config = config('telegram.settings');
}
if (is_int($session)) { if (is_int($session)) {
$session = $this->database->table($this->table)->find($session); $session = $this->database->table($this->table)->find($session);
@ -64,11 +60,16 @@ class MadelineProtoFactory
* Generating MadelineProto (session) instance. * Generating MadelineProto (session) instance.
* *
* @param string $sessionFile * @param string $sessionFile
* @param array $config * @param array|null $config if this parameter is null, then the config from <b>telegram.php</b>
* file will be used
* @return MadelineProto * @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/"))) { if (!file_exists(storage_path("app/telegram/"))) {
mkdir(storage_path("app/telegram"), 0755); mkdir(storage_path("app/telegram"), 0755);
} }