mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add is_chat_creator method to ChatMemberStatus (#394)
* new: add is_chat_creator method to ChatMemberStatus * enh: use tuples instead of lists for some checks
This commit is contained in:
parent
f926d80ba2
commit
7f053412bf
4 changed files with 13 additions and 6 deletions
|
|
@ -80,7 +80,7 @@ def check_result(method_name: str, content_type: str, status_code: int, body: st
|
|||
exceptions.NotFound.detect(description)
|
||||
elif status_code == HTTPStatus.CONFLICT:
|
||||
exceptions.ConflictError.detect(description)
|
||||
elif status_code in [HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN]:
|
||||
elif status_code in (HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN):
|
||||
exceptions.Unauthorized.detect(description)
|
||||
elif status_code == HTTPStatus.REQUEST_ENTITY_TOO_LARGE:
|
||||
raise exceptions.NetworkError('File too large for uploading. '
|
||||
|
|
|
|||
|
|
@ -1135,10 +1135,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
|||
permissions = prepare_arg(permissions)
|
||||
payload = generate_payload(**locals())
|
||||
|
||||
for permission in ['can_send_messages',
|
||||
for permission in ('can_send_messages',
|
||||
'can_send_media_messages',
|
||||
'can_send_other_messages',
|
||||
'can_add_web_page_previews']:
|
||||
'can_add_web_page_previews'):
|
||||
if permission in payload:
|
||||
warnings.warn(f"The method `restrict_chat_member` now takes the new user permissions "
|
||||
f"in a single argument of the type ChatPermissions instead of "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue