@@ -26,15 +26,15 @@ |
||
| 26 | 26 | InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null |
| 27 | 27 | ): PromiseInterface { |
| 28 | 28 | return $this->api->sendMessage( |
| 29 | - chatId: $this->id, |
|
| 30 | - text: $text, |
|
| 31 | - parseMode: $parseMode, |
|
| 32 | - entities: $entities, |
|
| 33 | - disableWebPagePreview: $disableWebPagePreview, |
|
| 34 | - disableNotification: $disableNotification, |
|
| 35 | - replyToMessageId: $replyToMessageId, |
|
| 36 | - allowSendingWithoutReply: $allowSendingWithoutReply, |
|
| 37 | - replyMarkup: $replyMarkup |
|
| 29 | + chatId : $this->id, |
|
| 30 | + text : $text, |
|
| 31 | + parseMode : $parseMode, |
|
| 32 | + entities : $entities, |
|
| 33 | + disableWebPagePreview : $disableWebPagePreview, |
|
| 34 | + disableNotification : $disableNotification, |
|
| 35 | + replyToMessageId : $replyToMessageId, |
|
| 36 | + allowSendingWithoutReply : $allowSendingWithoutReply, |
|
| 37 | + replyMarkup : $replyMarkup |
|
| 38 | 38 | ); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | $this->gifFileId ?? $this->mpeg4FileId ?? $this->photoFileId ?? $this->stickerFileId ?? $this->videoFileId ?? |
| 20 | 20 | $this->voiceFileId ?? $this->fileId; |
| 21 | 21 | return $this->api->getFile($fileId)->then( |
| 22 | - function (File $file) { |
|
| 22 | + function(File $file) { |
|
| 23 | 23 | return $this->api->downloadFile($file->filePath); |
| 24 | 24 | } |
| 25 | 25 | )->then( |
| 26 | - function (StreamInterface $stream) use ($path) { |
|
| 26 | + function(StreamInterface $stream) use ($path) { |
|
| 27 | 27 | return file_put_contents($path, $stream); |
| 28 | 28 | } |
| 29 | 29 | ); |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | ?int $cacheTime = null |
| 19 | 19 | ): PromiseInterface { |
| 20 | 20 | return $this->api->answerCallbackQuery( |
| 21 | - callbackQueryId: $this->id, |
|
| 22 | - text: $text, |
|
| 23 | - showAlert: $showAlert, |
|
| 24 | - url: $url, |
|
| 25 | - cacheTime: $cacheTime |
|
| 21 | + callbackQueryId : $this->id, |
|
| 22 | + text : $text, |
|
| 23 | + showAlert : $showAlert, |
|
| 24 | + url : $url, |
|
| 25 | + cacheTime : $cacheTime |
|
| 26 | 26 | ); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | public function ban(int|string $chatId, ?int $untilDate = null, ?bool $revokeMessages = null): PromiseInterface |
| 15 | 15 | { |
| 16 | 16 | return $this->api->kickChatMember( |
| 17 | - chatId: $chatId, |
|
| 18 | - userId: $this->id, |
|
| 19 | - untilDate: $untilDate, |
|
| 20 | - revokeMessages: $revokeMessages |
|
| 17 | + chatId : $chatId, |
|
| 18 | + userId : $this->id, |
|
| 19 | + untilDate : $untilDate, |
|
| 20 | + revokeMessages : $revokeMessages |
|
| 21 | 21 | ); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function unban(int|string $chatId, ?bool $onlyIfBanned = null): PromiseInterface |
| 25 | 25 | { |
| 26 | 26 | return $this->api->unbanChatMember( |
| 27 | - chatId: $chatId, |
|
| 28 | - userId: $this->id, |
|
| 29 | - onlyIfBanned: $onlyIfBanned |
|
| 27 | + chatId : $chatId, |
|
| 28 | + userId : $this->id, |
|
| 29 | + onlyIfBanned : $onlyIfBanned |
|
| 30 | 30 | ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -45,19 +45,19 @@ discard block |
||
| 45 | 45 | ?bool $canPinMessages = null |
| 46 | 46 | ): PromiseInterface { |
| 47 | 47 | return $this->api->promoteChatMember( |
| 48 | - chatId: $chatId, |
|
| 49 | - userId: $this->id, |
|
| 50 | - isAnonymous: $isAnonymous, |
|
| 51 | - canManageChat: $canManageChat, |
|
| 52 | - canPostMessages: $canPostMessages, |
|
| 53 | - canEditMessages: $canEditMessages, |
|
| 54 | - canDeleteMessages: $canDeleteMessages, |
|
| 55 | - canManageVoiceChats: $canManageVoiceChats, |
|
| 56 | - canRestrictMembers: $canRestrictMembers, |
|
| 57 | - canPromoteMembers: $canPromoteMembers, |
|
| 58 | - canChangeInfo: $canChangeInfo, |
|
| 59 | - canInviteUsers: $canInviteUsers, |
|
| 60 | - canPinMessages: $canPinMessages |
|
| 48 | + chatId : $chatId, |
|
| 49 | + userId : $this->id, |
|
| 50 | + isAnonymous : $isAnonymous, |
|
| 51 | + canManageChat : $canManageChat, |
|
| 52 | + canPostMessages : $canPostMessages, |
|
| 53 | + canEditMessages : $canEditMessages, |
|
| 54 | + canDeleteMessages : $canDeleteMessages, |
|
| 55 | + canManageVoiceChats : $canManageVoiceChats, |
|
| 56 | + canRestrictMembers : $canRestrictMembers, |
|
| 57 | + canPromoteMembers : $canPromoteMembers, |
|
| 58 | + canChangeInfo : $canChangeInfo, |
|
| 59 | + canInviteUsers : $canInviteUsers, |
|
| 60 | + canPinMessages : $canPinMessages |
|
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | ?int $untilDate = null |
| 73 | 73 | ): PromiseInterface { |
| 74 | 74 | return $this->api->restrictChatMember( |
| 75 | - chatId: $chatId, |
|
| 76 | - userId: $this->id, |
|
| 77 | - permissions: $permissions, |
|
| 78 | - untilDate: $untilDate |
|
| 75 | + chatId : $chatId, |
|
| 76 | + userId : $this->id, |
|
| 77 | + permissions : $permissions, |
|
| 78 | + untilDate : $untilDate |
|
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -18,16 +18,16 @@ discard block |
||
| 18 | 18 | public function kickMember(int $userId, ?int $untilDate = null, ?bool $revokeMessages = null): PromiseInterface |
| 19 | 19 | { |
| 20 | 20 | return $this->api->kickChatMember( |
| 21 | - chatId: $this->id, |
|
| 22 | - userId: $userId, |
|
| 23 | - untilDate: $untilDate, |
|
| 24 | - revokeMessages: $revokeMessages |
|
| 21 | + chatId : $this->id, |
|
| 22 | + userId : $userId, |
|
| 23 | + untilDate : $untilDate, |
|
| 24 | + revokeMessages : $revokeMessages |
|
| 25 | 25 | ); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function unbanMember(int $userId, ?bool $onlyIfBanned = null): PromiseInterface |
| 29 | 29 | { |
| 30 | - return $this->api->unbanChatMember(chatId: $this->id, userId: $userId, onlyIfBanned: $onlyIfBanned); |
|
| 30 | + return $this->api->unbanChatMember(chatId : $this->id, userId : $userId, onlyIfBanned : $onlyIfBanned); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function restrictMember( |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | ?int $untilDate = null |
| 37 | 37 | ): PromiseInterface { |
| 38 | 38 | return $this->api->restrictChatMember( |
| 39 | - chatId: $this->id, |
|
| 40 | - userId: $userId, |
|
| 41 | - permissions: $permissions, |
|
| 42 | - untilDate: $untilDate |
|
| 39 | + chatId : $this->id, |
|
| 40 | + userId : $userId, |
|
| 41 | + permissions : $permissions, |
|
| 42 | + untilDate : $untilDate |
|
| 43 | 43 | ); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | \ No newline at end of file |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | public function ban(?int $untilDate = null, ?bool $revokeMessages = null): PromiseInterface |
| 14 | 14 | { |
| 15 | 15 | return $this->api->kickChatMember( |
| 16 | - chatId: $this->chat->id, |
|
| 17 | - userId: $this->newChatMember->user->id, |
|
| 18 | - untilDate: $untilDate, |
|
| 19 | - revokeMessages: $revokeMessages |
|
| 16 | + chatId : $this->chat->id, |
|
| 17 | + userId : $this->newChatMember->user->id, |
|
| 18 | + untilDate : $untilDate, |
|
| 19 | + revokeMessages : $revokeMessages |
|
| 20 | 20 | ); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function unban(?bool $onlyIfBanned = null): PromiseInterface |
| 24 | 24 | { |
| 25 | 25 | return $this->api->unbanChatMember( |
| 26 | - chatId: $this->chat->id, |
|
| 27 | - userId: $this->newChatMember->user->id, |
|
| 28 | - onlyIfBanned: $onlyIfBanned |
|
| 26 | + chatId : $this->chat->id, |
|
| 27 | + userId : $this->newChatMember->user->id, |
|
| 28 | + onlyIfBanned : $onlyIfBanned |
|
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | ?bool $canPinMessages = null |
| 44 | 44 | ): PromiseInterface { |
| 45 | 45 | return $this->api->promoteChatMember( |
| 46 | - chatId: $this->chat->id, |
|
| 47 | - userId: $this->newChatMember->user->id, |
|
| 48 | - isAnonymous: $isAnonymous, |
|
| 49 | - canManageChat: $canManageChat, |
|
| 50 | - canPostMessages: $canPostMessages, |
|
| 51 | - canEditMessages: $canEditMessages, |
|
| 52 | - canDeleteMessages: $canDeleteMessages, |
|
| 53 | - canManageVoiceChats: $canManageVoiceChats, |
|
| 54 | - canRestrictMembers: $canRestrictMembers, |
|
| 55 | - canPromoteMembers: $canPromoteMembers, |
|
| 56 | - canChangeInfo: $canChangeInfo, |
|
| 57 | - canInviteUsers: $canInviteUsers, |
|
| 58 | - canPinMessages: $canPinMessages |
|
| 46 | + chatId : $this->chat->id, |
|
| 47 | + userId : $this->newChatMember->user->id, |
|
| 48 | + isAnonymous : $isAnonymous, |
|
| 49 | + canManageChat : $canManageChat, |
|
| 50 | + canPostMessages : $canPostMessages, |
|
| 51 | + canEditMessages : $canEditMessages, |
|
| 52 | + canDeleteMessages : $canDeleteMessages, |
|
| 53 | + canManageVoiceChats : $canManageVoiceChats, |
|
| 54 | + canRestrictMembers : $canRestrictMembers, |
|
| 55 | + canPromoteMembers : $canPromoteMembers, |
|
| 56 | + canChangeInfo : $canChangeInfo, |
|
| 57 | + canInviteUsers : $canInviteUsers, |
|
| 58 | + canPinMessages : $canPinMessages |
|
| 59 | 59 | ); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | ?int $untilDate = null |
| 70 | 70 | ): PromiseInterface { |
| 71 | 71 | return $this->api->restrictChatMember( |
| 72 | - chatId: $this->chat->id, |
|
| 73 | - userId: $this->newChatMember->user->id, |
|
| 74 | - permissions: $permissions, |
|
| 75 | - untilDate: $untilDate |
|
| 72 | + chatId : $this->chat->id, |
|
| 73 | + userId : $this->newChatMember->user->id, |
|
| 74 | + permissions : $permissions, |
|
| 75 | + untilDate : $untilDate |
|
| 76 | 76 | ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -67,25 +67,25 @@ |
||
| 67 | 67 | public function editMedia(InputMedia $media, ?InlineKeyboardMarkup $replyMarkup = null): PromiseInterface |
| 68 | 68 | { |
| 69 | 69 | return $this->api->editMessageMedia( |
| 70 | - media: $media, |
|
| 71 | - chatId: $this->chat->id, |
|
| 72 | - messageId: $this->messageId, |
|
| 73 | - replyMarkup: $replyMarkup |
|
| 70 | + media : $media, |
|
| 71 | + chatId : $this->chat->id, |
|
| 72 | + messageId : $this->messageId, |
|
| 73 | + replyMarkup : $replyMarkup |
|
| 74 | 74 | ); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function editReplyMarkup(?InlineKeyboardMarkup $replyMarkup = null): PromiseInterface |
| 78 | 78 | { |
| 79 | 79 | return $this->api->editMessageReplyMarkup( |
| 80 | - chatId: $this->chat->id, |
|
| 81 | - messageId: $this->messageId, |
|
| 82 | - replyMarkup: $replyMarkup |
|
| 80 | + chatId : $this->chat->id, |
|
| 81 | + messageId : $this->messageId, |
|
| 82 | + replyMarkup : $replyMarkup |
|
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function stopPoll(?InlineKeyboardMarkup $replyMarkup = null): PromiseInterface |
| 87 | 87 | { |
| 88 | - return $this->api->stopPoll(chatId: $this->chat->id, messageId: $this->messageId, replyMarkup: $replyMarkup); |
|
| 88 | + return $this->api->stopPoll(chatId : $this->chat->id, messageId : $this->messageId, replyMarkup : $replyMarkup); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | \ No newline at end of file |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | public function edit(int|string $chatId, ?int $expireDate = null, ?int $memberLimit = null): PromiseInterface |
| 16 | 16 | { |
| 17 | 17 | return $this->api->editChatInviteLink( |
| 18 | - chatId: $chatId, |
|
| 19 | - inviteLink: $this->inviteLink, |
|
| 20 | - expireDate: $expireDate, |
|
| 21 | - memberLimit: $memberLimit |
|
| 18 | + chatId : $chatId, |
|
| 19 | + inviteLink : $this->inviteLink, |
|
| 20 | + expireDate : $expireDate, |
|
| 21 | + memberLimit : $memberLimit |
|
| 22 | 22 | ); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | $client = $this->client; |
| 24 | 24 | $uri = sprintf('/file/bot%s/%s', $this->token, $remotePath); |
| 25 | 25 | return $client->getAsync($uri)->then( |
| 26 | - function (ResponseInterface $response) { |
|
| 26 | + function(ResponseInterface $response) { |
|
| 27 | 27 | return $response->getBody(); |
| 28 | 28 | }, |
| 29 | - function (RequestException $e) { |
|
| 29 | + function(RequestException $e) { |
|
| 30 | 30 | $message = sprintf( |
| 31 | 31 | 'An unknown error occurred when trying to fetch the file (%s): %s', |
| 32 | 32 | $e->getCode(), |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | if (!$e->hasResponse()) { |
| 36 | 36 | throw new TelegramAPIException($message); |
| 37 | 37 | } |
| 38 | - $data = json_decode($e->getResponse()?->getBody()); |
|
| 38 | + $data = json_decode($e->getResponse() ? ->getBody()); |
|
| 39 | 39 | if (empty($data)) { |
| 40 | 40 | throw new TelegramAPIException($message); |
| 41 | 41 | } |
| 42 | - match ($data->error_code) { |
|
| 42 | + match($data->error_code) { |
|
| 43 | 43 | 400 => throw new TelegramBadRequestException($data->description), |
| 44 | 44 | 401 => throw new TelegramUnauthorizedException('Token invalid or expired'), |
| 45 | 45 | 403 => throw new TelegramForbiddenException($data->description), |