mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added SUPERGROUP chat type (#438)
* Added SUPERGROUP chat type, because SUPER_GROUP is incorrect and confusing. * Added deprecation warning to SUPER_GROUP value
This commit is contained in:
parent
fc177b567f
commit
8c43c209e0
1 changed files with 10 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ from .chat_member import ChatMember
|
|||
from .chat_permissions import ChatPermissions
|
||||
from .chat_photo import ChatPhoto
|
||||
from .input_file import InputFile
|
||||
from ..utils.deprecated import deprecated
|
||||
from ..utils.deprecated import deprecated, DeprecatedReadOnlyClassVar
|
||||
|
||||
|
||||
class Chat(base.TelegramObject):
|
||||
|
|
@ -494,6 +494,7 @@ class ChatType(helper.Helper):
|
|||
:key: PRIVATE
|
||||
:key: GROUP
|
||||
:key: SUPER_GROUP
|
||||
:key: SUPERGROUP
|
||||
:key: CHANNEL
|
||||
"""
|
||||
|
||||
|
|
@ -501,9 +502,14 @@ class ChatType(helper.Helper):
|
|||
|
||||
PRIVATE = helper.Item() # private
|
||||
GROUP = helper.Item() # group
|
||||
SUPER_GROUP = helper.Item() # supergroup
|
||||
SUPERGROUP = helper.Item() # supergroup
|
||||
CHANNEL = helper.Item() # channel
|
||||
|
||||
SUPER_GROUP: DeprecatedReadOnlyClassVar[ChatType, helper.Item] \
|
||||
= DeprecatedReadOnlyClassVar(
|
||||
"SUPER_GROUP chat type is deprecated, use SUPERGROUP instead.",
|
||||
new_value_getter=lambda cls: cls.SUPERGROUP)
|
||||
|
||||
@staticmethod
|
||||
def _check(obj, chat_types) -> bool:
|
||||
if hasattr(obj, 'chat'):
|
||||
|
|
@ -543,7 +549,7 @@ class ChatType(helper.Helper):
|
|||
:param obj:
|
||||
:return:
|
||||
"""
|
||||
return cls._check(obj, [cls.SUPER_GROUP])
|
||||
return cls._check(obj, [cls.SUPER_GROUP, cls.SUPERGROUP])
|
||||
|
||||
@classmethod
|
||||
@deprecated("This filter was moved to ChatTypeFilter, and will be removed in aiogram v3.0")
|
||||
|
|
@ -554,7 +560,7 @@ class ChatType(helper.Helper):
|
|||
:param obj:
|
||||
:return:
|
||||
"""
|
||||
return cls._check(obj, [cls.GROUP, cls.SUPER_GROUP])
|
||||
return cls._check(obj, [cls.GROUP, cls.SUPER_GROUP, cls.SUPERGROUP])
|
||||
|
||||
@classmethod
|
||||
@deprecated("This filter was moved to ChatTypeFilter, and will be removed in aiogram v3.0")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue