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