diff --git a/docs/14.models/2.telegraph-chat.md b/docs/14.models/2.telegraph-chat.md index 9f99acdb..6b18ad5c 100644 --- a/docs/14.models/2.telegraph-chat.md +++ b/docs/14.models/2.telegraph-chat.md @@ -489,7 +489,7 @@ use DefStudio\Telegraph\Models\TelegraphChat; /** @var TelegraphChat $telegraphChat */ -$telegraphChat->unbanMember($userId)->send(); +$telegraphChat->unbanMember($userId, true)->send(); ``` ## `restrictMember()` diff --git a/src/Concerns/HasBotsAndChats.php b/src/Concerns/HasBotsAndChats.php index 734a56bb..1731a0d4 100644 --- a/src/Concerns/HasBotsAndChats.php +++ b/src/Concerns/HasBotsAndChats.php @@ -569,14 +569,14 @@ public function andRevokeMessages(): Telegraph return $telegraph; } - public function unbanChatMember(string $userId): Telegraph + public function unbanChatMember(string $userId, bool $onlyIfBanned = true): Telegraph { $telegraph = clone $this; $telegraph->endpoint = self::ENDPOINT_UNBAN_CHAT_MEMBER; $telegraph->data['chat_id'] = $telegraph->getChatId(); $telegraph->data['user_id'] = $userId; - $telegraph->data['only_if_banned'] = true; + $telegraph->data['only_if_banned'] = $onlyIfBanned; return $telegraph; } diff --git a/src/Models/TelegraphChat.php b/src/Models/TelegraphChat.php index b8895587..0ce8fb83 100644 --- a/src/Models/TelegraphChat.php +++ b/src/Models/TelegraphChat.php @@ -352,9 +352,9 @@ public function banMember(string $userId): Telegraph return TelegraphFacade::chat($this)->banChatMember($userId); } - public function unbanMember(string $userId): Telegraph + public function unbanMember(string $userId, bool $onlyIfBanned = true): Telegraph { - return TelegraphFacade::chat($this)->unbanChatMember($userId); + return TelegraphFacade::chat($this)->unbanChatMember($userId, $onlyIfBanned); } /**