Skip to content

Commit

Permalink
Merge pull request #3 from setiawanhu/dev
Browse files Browse the repository at this point in the history
Fixing minor bugs
  • Loading branch information
setiawanhu authored Aug 16, 2020
2 parents e094d09 + 00d08a9 commit 886d303
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
30 changes: 15 additions & 15 deletions src/ClientMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($messages)
*
* <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.
*
* @param mixed $messageId
Expand Down Expand Up @@ -79,7 +79,7 @@ public function acceptUrlAuth($messageId, int $buttonId = 0, array $extra = []):
* </li>
* </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.
*
* @param mixed $chatId
Expand Down Expand Up @@ -107,7 +107,7 @@ public function addChatUser($chatId, $userId = '', int $forwardLimit = 1): Teleg
*
* <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.
*
* @param mixed $hash
Expand Down Expand Up @@ -139,7 +139,7 @@ public function clearAllDrafts(): bool
/**
* 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.
*
* @param bool|TelegramObject $attached
Expand Down Expand Up @@ -183,7 +183,7 @@ public function clearRecentStickers($attached = false): bool
* </li>
* </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.
*
* @param mixed $title
Expand Down Expand Up @@ -229,7 +229,7 @@ public function createChat($title, array $users = []): TelegramObject
* </li>
* </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.
*
* @param mixed $chatId
Expand Down Expand Up @@ -275,7 +275,7 @@ public function deleteChatUser($chatId, $userId): TelegramObject
* </li>
* </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.
*
* @param mixed $peer
Expand Down Expand Up @@ -304,7 +304,7 @@ public function deleteHistory($peer, int $maxId = 0, array $extra = []): Telegra
*
* <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.
*
* @param mixed $id
Expand All @@ -328,7 +328,7 @@ public function deleteMessages($id, bool $revoke = false): TelegramObject
/**
* 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.
*
* @param mixed $peer
Expand All @@ -352,7 +352,7 @@ public function deleteScheduledMessages($peer, array $id = []): TelegramObject
/**
* 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.
*
* @param mixed $peer
Expand All @@ -376,7 +376,7 @@ public function editChatAbout($peer, string $about = ''): TelegramObject
/**
* 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.
*
* @param mixed $chatId
Expand All @@ -402,7 +402,7 @@ public function editChatAdmin($chatId, $userId, bool $isAdmin): bool
/**
* 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.
*
* @param mixed $peer
Expand Down Expand Up @@ -448,7 +448,7 @@ public function editChatDefaultBannedRights($peer, array $bannedRights): Telegra
* </li>
* </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.
*
* @param mixed $peer
Expand Down Expand Up @@ -477,7 +477,7 @@ public function sendMessage($peer, string $message = '', array $extra = []): Tel
*
* <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.
*
* @param int ...$peers
Expand All @@ -501,7 +501,7 @@ public function getPeerDialogs(...$peers): TelegramObject
*
* <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.
*
* @param array|TelegramObject $params
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/MultiSessionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function handle()

$this->exportMigration($tableName, $user ?? null);

$this->info('Migration file exported.');
$this->info('Migration file generated.');
}

/**
Expand All @@ -78,7 +78,7 @@ public function handle()
*/
public function exportMigration(string $tableName, string $relation = null)
{
if ($relation == null) {
if (is_null($relation)) {
$relation = 'App/User';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/TelegramAccountLoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle()
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) {
Expand Down
13 changes: 7 additions & 6 deletions src/Factories/MadelineProtoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ public function __construct(DatabaseManager $manager, string $table)
*/
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);

Expand All @@ -64,11 +60,16 @@ public function get($session, array $config = null)
* Generating MadelineProto (session) instance.
*
* @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
*/
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);
}
Expand Down

0 comments on commit 886d303

Please sign in to comment.