mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
new: add is_chat_creator method to ChatMemberStatus
This commit is contained in:
parent
d1452b1620
commit
49f50c4d02
1 changed files with 7 additions and 0 deletions
|
|
@ -34,6 +34,9 @@ class ChatMember(base.TelegramObject):
|
|||
can_send_other_messages: base.Boolean = fields.Field()
|
||||
can_add_web_page_previews: base.Boolean = fields.Field()
|
||||
|
||||
def is_chat_creator(self) -> bool:
|
||||
return ChatMemberStatus.is_chat_creator(self.status)
|
||||
|
||||
def is_chat_admin(self) -> bool:
|
||||
return ChatMemberStatus.is_chat_admin(self.status)
|
||||
|
||||
|
|
@ -57,6 +60,10 @@ class ChatMemberStatus(helper.Helper):
|
|||
LEFT = helper.Item() # left
|
||||
KICKED = helper.Item() # kicked
|
||||
|
||||
@classmethod
|
||||
def is_chat_creator(cls, role: str) -> bool:
|
||||
return role == cls.CREATOR
|
||||
|
||||
@classmethod
|
||||
def is_chat_admin(cls, role: str) -> bool:
|
||||
return role in [cls.ADMINISTRATOR, cls.CREATOR]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue