Gets the input peer for the given "entity" (user, chat or channel).
A TypeError
is raised if the given entity isn't a supported type
or if check_hash is True
but the entity's accessHash is None
or* the entity contains min
information. In this case, the hash
cannot be used for general purposes, and thus is not returned to avoid
any issues which can derive from invalid access hashes.
Note that checkHash
is ignored if an input peer is already
passed since in that case we assume the user knows what they're doing.
This is key to getting entities by explicitly passing hash = 0
.
Similar to :meth:get_input_peer
, but for :tl:InputChannel
's alone.
.. important::
This method does not validate for invalid general-purpose access
hashes, unlike get_input_peer
. Consider using instead:
get_input_channel(get_input_peer(channel))
.
Similar to :meth:getInputPeer
, but for :tl:InputUser
's alone.
.. important::
This method does not validate for invalid general-purpose access
hashes, unlike get_input_peer
. Consider using instead:
get_input_channel(get_input_peer(channel))
.
Similar to :meth:get_input_peer
, but for input messages.
Similar to :meth:get_input_peer
, but for input messages.
Adds the JPG header and footer to a stripped image. Ported from https://github.com/telegramdesktop/tdesktop/blob/bec39d89e19670eb436dc794a8f20b657cb87c71/Telegram/SourceFiles/ui/image/image.cpp#L225
Similar to :meth:get_input_peer
, but for photos
Similar to :meth:get_input_peer
, but for documents
Returns True
if the file has an audio mime type.
Returns True
if the file has an image mime type.
Get a list of attributes for the given file and the mime type as a tuple ([attribute], mime_type).
Similar to :meth:get_input_peer
, but for geo points
Similar to :meth:get_input_peer
, but for media.
If the media is :tl:InputFile
and is_photo
is known to be True
,
it will be treated as an :tl:InputMediaUploadedPhoto
. Else, the rest
of parameters will indicate how to treat it.
Gets the appropriated part size when uploading or downloading files, given an initial file size.
Convert the given peer into its marked ID by default.
This "mark" comes from the "bot api" format, and with it the peer type can be identified back. User ID is left unmodified, chat ID is negated, and channel ID is prefixed with -100:
userId
-chatId
-100channel_id
The original ID and the peer type class can be returned with
a call to :meth:resolve_id(marked_id)
.
Given a marked ID, returns the original ID and its :tl:Peer
type.
Parses the given phone, or returns undefined
if it's invalid.
Parses a string ID into a big int
Parses the given username or channel access hash, given a string, username or URL. Returns a tuple consisting of both the stripped, lowercase username and whether it is a joinchat/ hash (in which case is not lowercase'd).
Returns (undefined, false)
if the username
or link is not valid.
Gets the display name for the given :tl:User
,
:tl:Chat
or :tl:Channel
. Returns an empty string otherwise
Generated using TypeDoc
Turns the given iterable into chunks of the specified size, which is 100 by default since that's what Telegram uses the most.