Skip to content

Commit 39b00fa

Browse files
committed
Minor fixes in BotCommandScopeX
1 parent d709b39 commit 39b00fa

1 file changed

Lines changed: 27 additions & 19 deletions

File tree

‎telebot/types.py‎

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,7 +3123,6 @@ def __init__(self, request_id: int, chat_is_channel: bool,
31233123
self.request_photo: Optional[bool] = request_photo
31243124
self.request_username: Optional[bool] = request_username
31253125

3126-
31273126
def to_dict(self) -> dict:
31283127
data = {
31293128
'request_id': self.request_id,
@@ -3217,7 +3216,6 @@ def __init__(self, text: str, request_contact: Optional[bool] = None,
32173216
# noinspection PyTypeChecker
32183217
self.request_users = request_user
32193218

3220-
32213219
def to_json(self):
32223220
return json.dumps(self.to_dict())
32233221

@@ -4251,7 +4249,6 @@ def __init__(self,
42514249
self.can_send_video_notes: Optional[bool] = can_send_media_messages
42524250
self.can_send_voice_notes: Optional[bool] = can_send_media_messages
42534251

4254-
42554252
def to_json(self):
42564253
return json.dumps(self.to_dict())
42574254

@@ -4414,10 +4411,6 @@ class BotCommandScopeDefault(BotCommandScope):
44144411
:rtype: :class:`telebot.types.BotCommandScopeDefault`
44154412
"""
44164413
def __init__(self):
4417-
"""
4418-
Represents the default scope of bot commands.
4419-
Default commands are used if no commands with a narrower scope are specified for the user.
4420-
"""
44214414
super(BotCommandScopeDefault, self).__init__(type='default')
44224415

44234416

@@ -4455,9 +4448,6 @@ class BotCommandScopeAllGroupChats(BotCommandScope):
44554448
:rtype: :class:`telebot.types.BotCommandScopeAllGroupChats`
44564449
"""
44574450
def __init__(self):
4458-
"""
4459-
Represents the scope of bot commands, covering all group and supergroup chats.
4460-
"""
44614451
super(BotCommandScopeAllGroupChats, self).__init__(type='all_group_chats')
44624452

44634453

@@ -4475,9 +4465,6 @@ class BotCommandScopeAllChatAdministrators(BotCommandScope):
44754465
:rtype: :class:`telebot.types.BotCommandScopeAllChatAdministrators`
44764466
"""
44774467
def __init__(self):
4478-
"""
4479-
Represents the scope of bot commands, covering all group and supergroup chat administrators.
4480-
"""
44814468
super(BotCommandScopeAllChatAdministrators, self).__init__(type='all_chat_administrators')
44824469

44834470

@@ -4497,8 +4484,15 @@ class BotCommandScopeChat(BotCommandScope):
44974484
:return: Instance of the class
44984485
:rtype: :class:`telebot.types.BotCommandScopeChat`
44994486
"""
4500-
def __init__(self, chat_id: Optional[Union[str, int]]=None):
4487+
def __init__(self, chat_id: Union[int, str]=None):
45014488
super(BotCommandScopeChat, self).__init__(type='chat')
4489+
self.chat_id = chat_id
4490+
4491+
def to_dict(self) -> dict:
4492+
data = super().to_dict()
4493+
if self.chat_id is not None:
4494+
data['chat_id'] = self.chat_id
4495+
return data
45024496

45034497

45044498
# noinspection PyUnresolvedReferences
@@ -4517,8 +4511,15 @@ class BotCommandScopeChatAdministrators(BotCommandScope):
45174511
:return: Instance of the class
45184512
:rtype: :class:`telebot.types.BotCommandScopeChatAdministrators`
45194513
"""
4520-
def __init__(self, chat_id: Optional[Union[str, int]]=None):
4514+
def __init__(self, chat_id: Union[int, str]=None):
45214515
super(BotCommandScopeChatAdministrators, self).__init__(type='chat_administrators')
4516+
self.chat_id = chat_id
4517+
4518+
def to_dict(self) -> dict:
4519+
data = super().to_dict()
4520+
if self.chat_id is not None:
4521+
data['chat_id'] = self.chat_id
4522+
return data
45224523

45234524

45244525
# noinspection PyUnresolvedReferences
@@ -4540,8 +4541,18 @@ class BotCommandScopeChatMember(BotCommandScope):
45404541
:return: Instance of the class
45414542
:rtype: :class:`telebot.types.BotCommandScopeChatMember`
45424543
"""
4543-
def __init__(self, chat_id: Optional[Union[str, int]]=None, user_id: Optional[Union[str, int]]=None):
4544+
def __init__(self, chat_id: Union[int, str]=None, user_id: int=None):
45444545
super(BotCommandScopeChatMember, self).__init__(type='chat_member')
4546+
self.chat_id = chat_id
4547+
self.user_id = user_id
4548+
4549+
def to_dict(self) -> dict:
4550+
data = super().to_dict()
4551+
if self.chat_id is not None:
4552+
data['chat_id'] = self.chat_id
4553+
if self.user_id is not None:
4554+
data['user_id'] = self.user_id
4555+
return data
45454556

45464557

45474558
# noinspection PyShadowingBuiltins
@@ -8239,7 +8250,6 @@ def __init__(self, poll_id: str, option_ids: List[int], option_persistent_ids: L
82398250
self.option_persistent_ids: List[str] = option_persistent_ids
82408251
self.voter_chat: Optional[Chat] = voter_chat
82418252

8242-
82438253
def to_json(self):
82448254
return json.dumps(self.to_dict())
82458255

@@ -9278,7 +9288,6 @@ def __init__(self, query: Optional[str] = None, allow_user_chats: Optional[bool]
92789288
self.allow_group_chats: Optional[bool] = allow_group_chats
92799289
self.allow_channel_chats: Optional[bool] = allow_channel_chats
92809290

9281-
92829291
def to_dict(self) -> dict:
92839292
data = {}
92849293

@@ -13648,7 +13657,6 @@ def last_resale_star_count(self) -> Optional[int]:
1364813657
return self.last_resale_amount
1364913658
return None
1365013659

13651-
1365213660
@classmethod
1365313661
def de_json(cls, json_string):
1365413662
if json_string is None: return None

0 commit comments

Comments
 (0)