mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
Fix remaining uses of old types namespace
This commit is contained in:
parent
dc29a95cef
commit
783c1771ab
|
@ -64,43 +64,43 @@ class AdminLogEvent:
|
|||
"""
|
||||
ori = self.original.action
|
||||
if isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionChangeAbout,
|
||||
types.ChannelAdminLogEventActionChangeTitle,
|
||||
types.ChannelAdminLogEventActionChangeUsername,
|
||||
types.ChannelAdminLogEventActionChangeLocation,
|
||||
types.ChannelAdminLogEventActionChangeHistoryTTL,
|
||||
_tl.ChannelAdminLogEventActionChangeAbout,
|
||||
_tl.ChannelAdminLogEventActionChangeTitle,
|
||||
_tl.ChannelAdminLogEventActionChangeUsername,
|
||||
_tl.ChannelAdminLogEventActionChangeLocation,
|
||||
_tl.ChannelAdminLogEventActionChangeHistoryTTL,
|
||||
)):
|
||||
return ori.prev_value
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionChangePhoto):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionChangePhoto):
|
||||
return ori.prev_photo
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionChangeStickerSet):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionChangeStickerSet):
|
||||
return ori.prev_stickerset
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionEditMessage):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionEditMessage):
|
||||
return ori.prev_message
|
||||
elif isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionParticipantToggleAdmin,
|
||||
types.ChannelAdminLogEventActionParticipantToggleBan
|
||||
_tl.ChannelAdminLogEventActionParticipantToggleAdmin,
|
||||
_tl.ChannelAdminLogEventActionParticipantToggleBan
|
||||
)):
|
||||
return ori.prev_participant
|
||||
elif isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionToggleInvites,
|
||||
types.ChannelAdminLogEventActionTogglePreHistoryHidden,
|
||||
types.ChannelAdminLogEventActionToggleSignatures
|
||||
_tl.ChannelAdminLogEventActionToggleInvites,
|
||||
_tl.ChannelAdminLogEventActionTogglePreHistoryHidden,
|
||||
_tl.ChannelAdminLogEventActionToggleSignatures
|
||||
)):
|
||||
return not ori.new_value
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionDeleteMessage):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionDeleteMessage):
|
||||
return ori.message
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionDefaultBannedRights):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionDefaultBannedRights):
|
||||
return ori.prev_banned_rights
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionDiscardGroupCall):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionDiscardGroupCall):
|
||||
return ori.call
|
||||
elif isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionExportedInviteDelete,
|
||||
types.ChannelAdminLogEventActionExportedInviteRevoke,
|
||||
types.ChannelAdminLogEventActionParticipantJoinByInvite,
|
||||
_tl.ChannelAdminLogEventActionExportedInviteDelete,
|
||||
_tl.ChannelAdminLogEventActionExportedInviteRevoke,
|
||||
_tl.ChannelAdminLogEventActionParticipantJoinByInvite,
|
||||
)):
|
||||
return ori.invite
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionExportedInviteEdit):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionExportedInviteEdit):
|
||||
return ori.prev_invite
|
||||
|
||||
@property
|
||||
|
@ -110,46 +110,46 @@ class AdminLogEvent:
|
|||
"""
|
||||
ori = self.original.action
|
||||
if isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionChangeAbout,
|
||||
types.ChannelAdminLogEventActionChangeTitle,
|
||||
types.ChannelAdminLogEventActionChangeUsername,
|
||||
types.ChannelAdminLogEventActionToggleInvites,
|
||||
types.ChannelAdminLogEventActionTogglePreHistoryHidden,
|
||||
types.ChannelAdminLogEventActionToggleSignatures,
|
||||
types.ChannelAdminLogEventActionChangeLocation,
|
||||
types.ChannelAdminLogEventActionChangeHistoryTTL,
|
||||
_tl.ChannelAdminLogEventActionChangeAbout,
|
||||
_tl.ChannelAdminLogEventActionChangeTitle,
|
||||
_tl.ChannelAdminLogEventActionChangeUsername,
|
||||
_tl.ChannelAdminLogEventActionToggleInvites,
|
||||
_tl.ChannelAdminLogEventActionTogglePreHistoryHidden,
|
||||
_tl.ChannelAdminLogEventActionToggleSignatures,
|
||||
_tl.ChannelAdminLogEventActionChangeLocation,
|
||||
_tl.ChannelAdminLogEventActionChangeHistoryTTL,
|
||||
)):
|
||||
return ori.new_value
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionChangePhoto):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionChangePhoto):
|
||||
return ori.new_photo
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionChangeStickerSet):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionChangeStickerSet):
|
||||
return ori.new_stickerset
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionEditMessage):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionEditMessage):
|
||||
return ori.new_message
|
||||
elif isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionParticipantToggleAdmin,
|
||||
types.ChannelAdminLogEventActionParticipantToggleBan
|
||||
_tl.ChannelAdminLogEventActionParticipantToggleAdmin,
|
||||
_tl.ChannelAdminLogEventActionParticipantToggleBan
|
||||
)):
|
||||
return ori.new_participant
|
||||
elif isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionParticipantInvite,
|
||||
types.ChannelAdminLogEventActionParticipantVolume,
|
||||
_tl.ChannelAdminLogEventActionParticipantInvite,
|
||||
_tl.ChannelAdminLogEventActionParticipantVolume,
|
||||
)):
|
||||
return ori.participant
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionDefaultBannedRights):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionDefaultBannedRights):
|
||||
return ori.new_banned_rights
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionStopPoll):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionStopPoll):
|
||||
return ori.message
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionStartGroupCall):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionStartGroupCall):
|
||||
return ori.call
|
||||
elif isinstance(ori, (
|
||||
types.ChannelAdminLogEventActionParticipantMute,
|
||||
types.ChannelAdminLogEventActionParticipantUnmute,
|
||||
_tl.ChannelAdminLogEventActionParticipantMute,
|
||||
_tl.ChannelAdminLogEventActionParticipantUnmute,
|
||||
)):
|
||||
return ori.participant
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionToggleGroupCallSetting):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionToggleGroupCallSetting):
|
||||
return ori.join_muted
|
||||
elif isinstance(ori, types.ChannelAdminLogEventActionExportedInviteEdit):
|
||||
elif isinstance(ori, _tl.ChannelAdminLogEventActionExportedInviteEdit):
|
||||
return ori.new_invite
|
||||
|
||||
@property
|
||||
|
@ -160,7 +160,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as `str`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangeAbout)
|
||||
_tl.ChannelAdminLogEventActionChangeAbout)
|
||||
|
||||
@property
|
||||
def changed_title(self):
|
||||
|
@ -170,7 +170,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as `str`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangeTitle)
|
||||
_tl.ChannelAdminLogEventActionChangeTitle)
|
||||
|
||||
@property
|
||||
def changed_username(self):
|
||||
|
@ -180,7 +180,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as `str`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangeUsername)
|
||||
_tl.ChannelAdminLogEventActionChangeUsername)
|
||||
|
||||
@property
|
||||
def changed_photo(self):
|
||||
|
@ -190,7 +190,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as :tl:`Photo`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangePhoto)
|
||||
_tl.ChannelAdminLogEventActionChangePhoto)
|
||||
|
||||
@property
|
||||
def changed_sticker_set(self):
|
||||
|
@ -200,7 +200,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as :tl:`InputStickerSet`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangeStickerSet)
|
||||
_tl.ChannelAdminLogEventActionChangeStickerSet)
|
||||
|
||||
@property
|
||||
def changed_message(self):
|
||||
|
@ -211,7 +211,7 @@ class AdminLogEvent:
|
|||
`Message <telethon.tl.custom.message.Message>`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionEditMessage)
|
||||
_tl.ChannelAdminLogEventActionEditMessage)
|
||||
|
||||
@property
|
||||
def deleted_message(self):
|
||||
|
@ -222,7 +222,7 @@ class AdminLogEvent:
|
|||
`Message <telethon.tl.custom.message.Message>`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionDeleteMessage)
|
||||
_tl.ChannelAdminLogEventActionDeleteMessage)
|
||||
|
||||
@property
|
||||
def changed_admin(self):
|
||||
|
@ -235,7 +235,7 @@ class AdminLogEvent:
|
|||
"""
|
||||
return isinstance(
|
||||
self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantToggleAdmin)
|
||||
_tl.ChannelAdminLogEventActionParticipantToggleAdmin)
|
||||
|
||||
@property
|
||||
def changed_restrictions(self):
|
||||
|
@ -247,7 +247,7 @@ class AdminLogEvent:
|
|||
"""
|
||||
return isinstance(
|
||||
self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantToggleBan)
|
||||
_tl.ChannelAdminLogEventActionParticipantToggleBan)
|
||||
|
||||
@property
|
||||
def changed_invites(self):
|
||||
|
@ -257,7 +257,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as `bool`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionToggleInvites)
|
||||
_tl.ChannelAdminLogEventActionToggleInvites)
|
||||
|
||||
@property
|
||||
def changed_location(self):
|
||||
|
@ -267,7 +267,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as :tl:`ChannelLocation`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangeLocation)
|
||||
_tl.ChannelAdminLogEventActionChangeLocation)
|
||||
|
||||
@property
|
||||
def joined(self):
|
||||
|
@ -276,7 +276,7 @@ class AdminLogEvent:
|
|||
public username or not.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantJoin)
|
||||
_tl.ChannelAdminLogEventActionParticipantJoin)
|
||||
|
||||
@property
|
||||
def joined_invite(self):
|
||||
|
@ -288,7 +288,7 @@ class AdminLogEvent:
|
|||
:tl:`ChannelParticipant`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantInvite)
|
||||
_tl.ChannelAdminLogEventActionParticipantInvite)
|
||||
|
||||
@property
|
||||
def left(self):
|
||||
|
@ -296,7 +296,7 @@ class AdminLogEvent:
|
|||
Whether `user` left the channel or not.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantLeave)
|
||||
_tl.ChannelAdminLogEventActionParticipantLeave)
|
||||
|
||||
@property
|
||||
def changed_hide_history(self):
|
||||
|
@ -307,7 +307,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as `bool`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionTogglePreHistoryHidden)
|
||||
_tl.ChannelAdminLogEventActionTogglePreHistoryHidden)
|
||||
|
||||
@property
|
||||
def changed_signatures(self):
|
||||
|
@ -318,7 +318,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` and `new` will be present as `bool`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionToggleSignatures)
|
||||
_tl.ChannelAdminLogEventActionToggleSignatures)
|
||||
|
||||
@property
|
||||
def changed_pin(self):
|
||||
|
@ -329,7 +329,7 @@ class AdminLogEvent:
|
|||
`Message <telethon.tl.custom.message.Message>`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionUpdatePinned)
|
||||
_tl.ChannelAdminLogEventActionUpdatePinned)
|
||||
|
||||
@property
|
||||
def changed_default_banned_rights(self):
|
||||
|
@ -340,7 +340,7 @@ class AdminLogEvent:
|
|||
be present as :tl:`ChatBannedRights`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionDefaultBannedRights)
|
||||
_tl.ChannelAdminLogEventActionDefaultBannedRights)
|
||||
|
||||
@property
|
||||
def stopped_poll(self):
|
||||
|
@ -351,7 +351,7 @@ class AdminLogEvent:
|
|||
`Message <telethon.tl.custom.message.Message>`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionStopPoll)
|
||||
_tl.ChannelAdminLogEventActionStopPoll)
|
||||
|
||||
@property
|
||||
def started_group_call(self):
|
||||
|
@ -361,7 +361,7 @@ class AdminLogEvent:
|
|||
If `True`, `new` will be present as :tl:`InputGroupCall`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionStartGroupCall)
|
||||
_tl.ChannelAdminLogEventActionStartGroupCall)
|
||||
|
||||
@property
|
||||
def discarded_group_call(self):
|
||||
|
@ -371,7 +371,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` will be present as :tl:`InputGroupCall`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionDiscardGroupCall)
|
||||
_tl.ChannelAdminLogEventActionDiscardGroupCall)
|
||||
|
||||
@property
|
||||
def user_muted(self):
|
||||
|
@ -381,7 +381,7 @@ class AdminLogEvent:
|
|||
If `True`, `new` will be present as :tl:`GroupCallParticipant`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantMute)
|
||||
_tl.ChannelAdminLogEventActionParticipantMute)
|
||||
|
||||
@property
|
||||
def user_unmutted(self):
|
||||
|
@ -391,7 +391,7 @@ class AdminLogEvent:
|
|||
If `True`, `new` will be present as :tl:`GroupCallParticipant`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantUnmute)
|
||||
_tl.ChannelAdminLogEventActionParticipantUnmute)
|
||||
|
||||
@property
|
||||
def changed_call_settings(self):
|
||||
|
@ -401,7 +401,7 @@ class AdminLogEvent:
|
|||
If `True`, `new` will be `True` if new users are muted on join.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionToggleGroupCallSetting)
|
||||
_tl.ChannelAdminLogEventActionToggleGroupCallSetting)
|
||||
|
||||
@property
|
||||
def changed_history_ttl(self):
|
||||
|
@ -414,7 +414,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` will be the old TTL, and `new` the new TTL, in seconds.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionChangeHistoryTTL)
|
||||
_tl.ChannelAdminLogEventActionChangeHistoryTTL)
|
||||
|
||||
@property
|
||||
def deleted_exported_invite(self):
|
||||
|
@ -424,7 +424,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` will be the deleted :tl:`ExportedChatInvite`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionExportedInviteDelete)
|
||||
_tl.ChannelAdminLogEventActionExportedInviteDelete)
|
||||
|
||||
@property
|
||||
def edited_exported_invite(self):
|
||||
|
@ -435,7 +435,7 @@ class AdminLogEvent:
|
|||
:tl:`ExportedChatInvite`, respectively.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionExportedInviteEdit)
|
||||
_tl.ChannelAdminLogEventActionExportedInviteEdit)
|
||||
|
||||
@property
|
||||
def revoked_exported_invite(self):
|
||||
|
@ -445,7 +445,7 @@ class AdminLogEvent:
|
|||
If `True`, `old` will be the revoked :tl:`ExportedChatInvite`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionExportedInviteRevoke)
|
||||
_tl.ChannelAdminLogEventActionExportedInviteRevoke)
|
||||
|
||||
@property
|
||||
def joined_by_invite(self):
|
||||
|
@ -456,7 +456,7 @@ class AdminLogEvent:
|
|||
used to join.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantJoinByInvite)
|
||||
_tl.ChannelAdminLogEventActionParticipantJoinByInvite)
|
||||
|
||||
@property
|
||||
def changed_user_volume(self):
|
||||
|
@ -466,7 +466,7 @@ class AdminLogEvent:
|
|||
If `True`, `new` will be the updated :tl:`GroupCallParticipant`.
|
||||
"""
|
||||
return isinstance(self.original.action,
|
||||
types.ChannelAdminLogEventActionParticipantVolume)
|
||||
_tl.ChannelAdminLogEventActionParticipantVolume)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.original)
|
||||
|
|
|
@ -49,12 +49,12 @@ class Button:
|
|||
Returns `True` if the button belongs to an inline keyboard.
|
||||
"""
|
||||
return isinstance(button, (
|
||||
types.KeyboardButtonBuy,
|
||||
types.KeyboardButtonCallback,
|
||||
types.KeyboardButtonGame,
|
||||
types.KeyboardButtonSwitchInline,
|
||||
types.KeyboardButtonUrl,
|
||||
types.InputKeyboardButtonUrlAuth
|
||||
_tl.KeyboardButtonBuy,
|
||||
_tl.KeyboardButtonCallback,
|
||||
_tl.KeyboardButtonGame,
|
||||
_tl.KeyboardButtonSwitchInline,
|
||||
_tl.KeyboardButtonUrl,
|
||||
_tl.InputKeyboardButtonUrlAuth
|
||||
))
|
||||
|
||||
@staticmethod
|
||||
|
@ -83,7 +83,7 @@ class Button:
|
|||
if len(data) > 64:
|
||||
raise ValueError('Too many bytes for the data')
|
||||
|
||||
return types.KeyboardButtonCallback(text, data)
|
||||
return _tl.KeyboardButtonCallback(text, data)
|
||||
|
||||
@staticmethod
|
||||
def switch_inline(text, query='', same_peer=False):
|
||||
|
@ -101,7 +101,7 @@ class Button:
|
|||
input field will be filled with the username of your bot followed
|
||||
by the query text, ready to make inline queries.
|
||||
"""
|
||||
return types.KeyboardButtonSwitchInline(text, query, same_peer)
|
||||
return _tl.KeyboardButtonSwitchInline(text, query, same_peer)
|
||||
|
||||
@staticmethod
|
||||
def url(text, url=None):
|
||||
|
@ -117,7 +117,7 @@ class Button:
|
|||
the domain is trusted, and once confirmed the URL will open in their
|
||||
device.
|
||||
"""
|
||||
return types.KeyboardButtonUrl(text, url or text)
|
||||
return _tl.KeyboardButtonUrl(text, url or text)
|
||||
|
||||
@staticmethod
|
||||
def auth(text, url=None, *, bot=None, write_access=False, fwd_text=None):
|
||||
|
@ -157,10 +157,10 @@ class Button:
|
|||
When the user clicks this button, a confirmation box will be shown
|
||||
to the user asking whether they want to login to the specified domain.
|
||||
"""
|
||||
return types.InputKeyboardButtonUrlAuth(
|
||||
return _tl.InputKeyboardButtonUrlAuth(
|
||||
text=text,
|
||||
url=url or text,
|
||||
bot=utils.get_input_user(bot or types.InputUserSelf()),
|
||||
bot=utils.get_input_user(bot or _tl.InputUserSelf()),
|
||||
request_write_access=write_access,
|
||||
fwd_text=fwd_text
|
||||
)
|
||||
|
@ -191,7 +191,7 @@ class Button:
|
|||
between a button press and the user typing and sending exactly the
|
||||
same text on their own.
|
||||
"""
|
||||
return cls(types.KeyboardButton(text),
|
||||
return cls(_tl.KeyboardButton(text),
|
||||
resize=resize, single_use=single_use, selective=selective)
|
||||
|
||||
@classmethod
|
||||
|
@ -206,7 +206,7 @@ class Button:
|
|||
to the user asking whether they want to share their location with the
|
||||
bot, and if confirmed a message with geo media will be sent.
|
||||
"""
|
||||
return cls(types.KeyboardButtonRequestGeoLocation(text),
|
||||
return cls(_tl.KeyboardButtonRequestGeoLocation(text),
|
||||
resize=resize, single_use=single_use, selective=selective)
|
||||
|
||||
@classmethod
|
||||
|
@ -221,7 +221,7 @@ class Button:
|
|||
to the user asking whether they want to share their phone with the
|
||||
bot, and if confirmed a message with contact media will be sent.
|
||||
"""
|
||||
return cls(types.KeyboardButtonRequestPhone(text),
|
||||
return cls(_tl.KeyboardButtonRequestPhone(text),
|
||||
resize=resize, single_use=single_use, selective=selective)
|
||||
|
||||
@classmethod
|
||||
|
@ -243,7 +243,7 @@ class Button:
|
|||
When the user clicks this button, a screen letting the user create a
|
||||
poll will be shown, and if they do create one, the poll will be sent.
|
||||
"""
|
||||
return cls(types.KeyboardButtonRequestPoll(text, quiz=force_quiz),
|
||||
return cls(_tl.KeyboardButtonRequestPoll(text, quiz=force_quiz),
|
||||
resize=resize, single_use=single_use, selective=selective)
|
||||
|
||||
@staticmethod
|
||||
|
@ -255,7 +255,7 @@ class Button:
|
|||
``selective`` is as documented in `text`.
|
||||
|
||||
"""
|
||||
return types.ReplyKeyboardHide(selective=selective)
|
||||
return _tl.ReplyKeyboardHide(selective=selective)
|
||||
|
||||
@staticmethod
|
||||
def force_reply(single_use=None, selective=None, placeholder=None):
|
||||
|
@ -273,7 +273,7 @@ class Button:
|
|||
crop the text (for example, to 64 characters and adding an
|
||||
ellipsis (…) character as the 65th).
|
||||
"""
|
||||
return types.ReplyKeyboardForceReply(
|
||||
return _tl.ReplyKeyboardForceReply(
|
||||
single_use=single_use,
|
||||
selective=selective,
|
||||
placeholder=placeholder)
|
||||
|
@ -291,7 +291,7 @@ class Button:
|
|||
`Payments API <https://core.telegram.org/api/payments>`__
|
||||
documentation for more information.
|
||||
"""
|
||||
return types.KeyboardButtonBuy(text)
|
||||
return _tl.KeyboardButtonBuy(text)
|
||||
|
||||
@staticmethod
|
||||
def game(text):
|
||||
|
@ -305,4 +305,4 @@ class Button:
|
|||
`Games <https://core.telegram.org/api/bots/games>`__
|
||||
documentation for more information on using games.
|
||||
"""
|
||||
return types.KeyboardButtonGame(text)
|
||||
return _tl.KeyboardButtonGame(text)
|
||||
|
|
|
@ -77,7 +77,7 @@ class InlineResult:
|
|||
this URL to open it in your browser, you should use Python's
|
||||
`webbrowser.open(url)` for such task.
|
||||
"""
|
||||
if isinstance(self.result, types.BotInlineResult):
|
||||
if isinstance(self.result, _tl.BotInlineResult):
|
||||
return self.result.url
|
||||
|
||||
@property
|
||||
|
@ -86,9 +86,9 @@ class InlineResult:
|
|||
Returns either the :tl:`WebDocument` thumbnail for
|
||||
normal results or the :tl:`Photo` for media results.
|
||||
"""
|
||||
if isinstance(self.result, types.BotInlineResult):
|
||||
if isinstance(self.result, _tl.BotInlineResult):
|
||||
return self.result.thumb
|
||||
elif isinstance(self.result, types.BotInlineMediaResult):
|
||||
elif isinstance(self.result, _tl.BotInlineMediaResult):
|
||||
return self.result.photo
|
||||
|
||||
@property
|
||||
|
@ -97,9 +97,9 @@ class InlineResult:
|
|||
Returns either the :tl:`WebDocument` content for
|
||||
normal results or the :tl:`Document` for media results.
|
||||
"""
|
||||
if isinstance(self.result, types.BotInlineResult):
|
||||
if isinstance(self.result, _tl.BotInlineResult):
|
||||
return self.result.content
|
||||
elif isinstance(self.result, types.BotInlineMediaResult):
|
||||
elif isinstance(self.result, _tl.BotInlineMediaResult):
|
||||
return self.result.document
|
||||
|
||||
async def click(self, entity=None, reply_to=None, comment_to=None,
|
||||
|
|
|
@ -46,8 +46,8 @@ class ParticipantPermissions:
|
|||
also counts as begin an administrator, since they have all permissions.
|
||||
"""
|
||||
return self.is_creator or isinstance(self.participant, (
|
||||
types.ChannelParticipantAdmin,
|
||||
types.ChatParticipantAdmin
|
||||
_tl.ChannelParticipantAdmin,
|
||||
_tl.ChatParticipantAdmin
|
||||
))
|
||||
|
||||
@property
|
||||
|
@ -56,8 +56,8 @@ class ParticipantPermissions:
|
|||
Whether the user is the creator of the chat or not.
|
||||
"""
|
||||
return isinstance(self.participant, (
|
||||
types.ChannelParticipantCreator,
|
||||
types.ChatParticipantCreator
|
||||
_tl.ChannelParticipantCreator,
|
||||
_tl.ChatParticipantCreator
|
||||
))
|
||||
|
||||
@property
|
||||
|
@ -67,9 +67,9 @@ class ParticipantPermissions:
|
|||
not banned either, and has no restrictions applied).
|
||||
"""
|
||||
return isinstance(self.participant, (
|
||||
types.ChannelParticipant,
|
||||
types.ChatParticipant,
|
||||
types.ChannelParticipantSelf
|
||||
_tl.ChannelParticipant,
|
||||
_tl.ChatParticipant,
|
||||
_tl.ChannelParticipantSelf
|
||||
))
|
||||
|
||||
@property
|
||||
|
@ -77,14 +77,14 @@ class ParticipantPermissions:
|
|||
"""
|
||||
Whether the user is banned in the chat.
|
||||
"""
|
||||
return isinstance(self.participant, types.ChannelParticipantBanned)
|
||||
return isinstance(self.participant, _tl.ChannelParticipantBanned)
|
||||
|
||||
@property
|
||||
def has_left(self):
|
||||
"""
|
||||
Whether the user left the chat.
|
||||
"""
|
||||
return isinstance(self.participant, types.ChannelParticipantLeft)
|
||||
return isinstance(self.participant, _tl.ChannelParticipantLeft)
|
||||
|
||||
@property
|
||||
def add_admins(self):
|
||||
|
|
|
@ -94,7 +94,7 @@ class QRLogin:
|
|||
async def handler(_update):
|
||||
event.set()
|
||||
|
||||
self._client.add_event_handler(handler, events.Raw(types.UpdateLoginToken))
|
||||
self._client.add_event_handler(handler, events.Raw(_tl.UpdateLoginToken))
|
||||
|
||||
try:
|
||||
# Will raise timeout error if it doesn't complete quick enough,
|
||||
|
@ -105,12 +105,12 @@ class QRLogin:
|
|||
|
||||
# We got here without it raising timeout error, so we can proceed
|
||||
resp = await self._client(self._request)
|
||||
if isinstance(resp, types.auth.LoginTokenMigrateTo):
|
||||
if isinstance(resp, _tl.auth.LoginTokenMigrateTo):
|
||||
await self._client._switch_dc(resp.dc_id)
|
||||
resp = await self._client(_tl.fn.auth.ImportLoginToken(resp.token))
|
||||
# resp should now be auth.loginTokenSuccess
|
||||
|
||||
if isinstance(resp, types.auth.LoginTokenSuccess):
|
||||
if isinstance(resp, _tl.auth.LoginTokenSuccess):
|
||||
user = resp.authorization.user
|
||||
self._client._on_login(user)
|
||||
return user
|
||||
|
|
Loading…
Reference in New Issue
Block a user