From 9bb3a5dccfb4511a700d670118cb3e9485e9f70e Mon Sep 17 00:00:00 2001 From: Andrew <11490628+andrew000@users.noreply.github.com> Date: Sun, 14 Mar 2021 18:14:40 +0200 Subject: [PATCH] ADD Exceptions: (#512) * CantRestrictChatOwner * UserIsAnAdministratorOfTheChat --- aiogram/utils/exceptions.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aiogram/utils/exceptions.py b/aiogram/utils/exceptions.py index d38ff009..9a1606a6 100644 --- a/aiogram/utils/exceptions.py +++ b/aiogram/utils/exceptions.py @@ -494,6 +494,20 @@ class MethodIsNotAvailable(BadRequest): match = "Method is available only for supergroups" +class CantRestrictChatOwner(BadRequest): + """ + Raises when bot restricts the chat owner + """ + match = 'Can\'t remove chat owner' + + +class UserIsAnAdministratorOfTheChat(BadRequest): + """ + Raises when bot restricts the chat admin + """ + match = 'User is an administrator of the chat' + + class NotFound(TelegramAPIError, _MatchErrorMixin): __group = True