partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _get_class_name | Gets the corresponding class name for the given error code,
this either being an integer (thus base error name) or str. | telethon_generator/parsers/errors.py | def _get_class_name(error_code):
"""
Gets the corresponding class name for the given error code,
this either being an integer (thus base error name) or str.
"""
if isinstance(error_code, int):
return KNOWN_BASE_CLASSES.get(
error_code, 'RPCError' + str(error_code).replace('-', 'N... | def _get_class_name(error_code):
"""
Gets the corresponding class name for the given error code,
this either being an integer (thus base error name) or str.
"""
if isinstance(error_code, int):
return KNOWN_BASE_CLASSES.get(
error_code, 'RPCError' + str(error_code).replace('-', 'N... | [
"Gets",
"the",
"corresponding",
"class",
"name",
"for",
"the",
"given",
"error",
"code",
"this",
"either",
"being",
"an",
"integer",
"(",
"thus",
"base",
"error",
"name",
")",
"or",
"str",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_generator/parsers/errors.py#L19-L30 | [
"def",
"_get_class_name",
"(",
"error_code",
")",
":",
"if",
"isinstance",
"(",
"error_code",
",",
"int",
")",
":",
"return",
"KNOWN_BASE_CLASSES",
".",
"get",
"(",
"error_code",
",",
"'RPCError'",
"+",
"str",
"(",
"error_code",
")",
".",
"replace",
"(",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | parse_errors | Parses the input CSV file with columns (name, error codes, description)
and yields `Error` instances as a result. | telethon_generator/parsers/errors.py | def parse_errors(csv_file):
"""
Parses the input CSV file with columns (name, error codes, description)
and yields `Error` instances as a result.
"""
with csv_file.open(newline='') as f:
f = csv.reader(f)
next(f, None) # header
for line, tup in enumerate(f, start=2):
... | def parse_errors(csv_file):
"""
Parses the input CSV file with columns (name, error codes, description)
and yields `Error` instances as a result.
"""
with csv_file.open(newline='') as f:
f = csv.reader(f)
next(f, None) # header
for line, tup in enumerate(f, start=2):
... | [
"Parses",
"the",
"input",
"CSV",
"file",
"with",
"columns",
"(",
"name",
"error",
"codes",
"description",
")",
"and",
"yields",
"Error",
"instances",
"as",
"a",
"result",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_generator/parsers/errors.py#L55-L76 | [
"def",
"parse_errors",
"(",
"csv_file",
")",
":",
"with",
"csv_file",
".",
"open",
"(",
"newline",
"=",
"''",
")",
"as",
"f",
":",
"f",
"=",
"csv",
".",
"reader",
"(",
"f",
")",
"next",
"(",
"f",
",",
"None",
")",
"# header",
"for",
"line",
",",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | do_authentication | Executes the authentication process with the Telegram servers.
:param sender: a connected `MTProtoPlainSender`.
:return: returns a (authorization key, time offset) tuple. | telethon/network/authenticator.py | async def do_authentication(sender):
"""
Executes the authentication process with the Telegram servers.
:param sender: a connected `MTProtoPlainSender`.
:return: returns a (authorization key, time offset) tuple.
"""
# Step 1 sending: PQ Request, endianness doesn't matter since it's random
n... | async def do_authentication(sender):
"""
Executes the authentication process with the Telegram servers.
:param sender: a connected `MTProtoPlainSender`.
:return: returns a (authorization key, time offset) tuple.
"""
# Step 1 sending: PQ Request, endianness doesn't matter since it's random
n... | [
"Executes",
"the",
"authentication",
"process",
"with",
"the",
"Telegram",
"servers",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/authenticator.py#L22-L169 | [
"async",
"def",
"do_authentication",
"(",
"sender",
")",
":",
"# Step 1 sending: PQ Request, endianness doesn't matter since it's random",
"nonce",
"=",
"int",
".",
"from_bytes",
"(",
"os",
".",
"urandom",
"(",
"16",
")",
",",
"'big'",
",",
"signed",
"=",
"True",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | get_int | Gets the specified integer from its byte array.
This should be used by this module alone, as it works with big endian.
:param byte_array: the byte array representing th integer.
:param signed: whether the number is signed or not.
:return: the integer representing the given byte array. | telethon/network/authenticator.py | def get_int(byte_array, signed=True):
"""
Gets the specified integer from its byte array.
This should be used by this module alone, as it works with big endian.
:param byte_array: the byte array representing th integer.
:param signed: whether the number is signed or not.
:return: the integer re... | def get_int(byte_array, signed=True):
"""
Gets the specified integer from its byte array.
This should be used by this module alone, as it works with big endian.
:param byte_array: the byte array representing th integer.
:param signed: whether the number is signed or not.
:return: the integer re... | [
"Gets",
"the",
"specified",
"integer",
"from",
"its",
"byte",
"array",
".",
"This",
"should",
"be",
"used",
"by",
"this",
"module",
"alone",
"as",
"it",
"works",
"with",
"big",
"endian",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/authenticator.py#L172-L181 | [
"def",
"get_int",
"(",
"byte_array",
",",
"signed",
"=",
"True",
")",
":",
"return",
"int",
".",
"from_bytes",
"(",
"byte_array",
",",
"byteorder",
"=",
"'big'",
",",
"signed",
"=",
"signed",
")"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | callback | This decorator turns `func` into a callback for Tkinter
to be able to use, even if `func` is an awaitable coroutine. | telethon_examples/gui.py | def callback(func):
"""
This decorator turns `func` into a callback for Tkinter
to be able to use, even if `func` is an awaitable coroutine.
"""
@functools.wraps(func)
def wrapped(*args, **kwargs):
result = func(*args, **kwargs)
if inspect.iscoroutine(result):
aio_loo... | def callback(func):
"""
This decorator turns `func` into a callback for Tkinter
to be able to use, even if `func` is an awaitable coroutine.
"""
@functools.wraps(func)
def wrapped(*args, **kwargs):
result = func(*args, **kwargs)
if inspect.iscoroutine(result):
aio_loo... | [
"This",
"decorator",
"turns",
"func",
"into",
"a",
"callback",
"for",
"Tkinter",
"to",
"be",
"able",
"to",
"use",
"even",
"if",
"func",
"is",
"an",
"awaitable",
"coroutine",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L47-L58 | [
"def",
"callback",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"ins... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | App.post_init | Completes the initialization of our application.
Since `__init__` cannot be `async` we use this. | telethon_examples/gui.py | async def post_init(self):
"""
Completes the initialization of our application.
Since `__init__` cannot be `async` we use this.
"""
if await self.cl.is_user_authorized():
self.set_signed_in(await self.cl.get_me())
else:
# User is not logged in, con... | async def post_init(self):
"""
Completes the initialization of our application.
Since `__init__` cannot be `async` we use this.
"""
if await self.cl.is_user_authorized():
self.set_signed_in(await self.cl.get_me())
else:
# User is not logged in, con... | [
"Completes",
"the",
"initialization",
"of",
"our",
"application",
".",
"Since",
"__init__",
"cannot",
"be",
"async",
"we",
"use",
"this",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L137-L148 | [
"async",
"def",
"post_init",
"(",
"self",
")",
":",
"if",
"await",
"self",
".",
"cl",
".",
"is_user_authorized",
"(",
")",
":",
"self",
".",
"set_signed_in",
"(",
"await",
"self",
".",
"cl",
".",
"get_me",
"(",
")",
")",
"else",
":",
"# User is not log... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | App.on_message | Event handler that will add new messages to the message log. | telethon_examples/gui.py | async def on_message(self, event):
"""
Event handler that will add new messages to the message log.
"""
# We want to show only messages sent to this chat
if event.chat_id != self.chat_id:
return
# Save the message ID so we know which to reply to
self.... | async def on_message(self, event):
"""
Event handler that will add new messages to the message log.
"""
# We want to show only messages sent to this chat
if event.chat_id != self.chat_id:
return
# Save the message ID so we know which to reply to
self.... | [
"Event",
"handler",
"that",
"will",
"add",
"new",
"messages",
"to",
"the",
"message",
"log",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L150-L178 | [
"async",
"def",
"on_message",
"(",
"self",
",",
"event",
")",
":",
"# We want to show only messages sent to this chat",
"if",
"event",
".",
"chat_id",
"!=",
"self",
".",
"chat_id",
":",
"return",
"# Save the message ID so we know which to reply to",
"self",
".",
"messag... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | App.sign_in | Note the `event` argument. This is required since this callback
may be called from a ``widget.bind`` (such as ``'<Return>'``),
which sends information about the event we don't care about.
This callback logs out if authorized, signs in if a code was
sent or a bot token is input, or sends... | telethon_examples/gui.py | async def sign_in(self, event=None):
"""
Note the `event` argument. This is required since this callback
may be called from a ``widget.bind`` (such as ``'<Return>'``),
which sends information about the event we don't care about.
This callback logs out if authorized, signs in if ... | async def sign_in(self, event=None):
"""
Note the `event` argument. This is required since this callback
may be called from a ``widget.bind`` (such as ``'<Return>'``),
which sends information about the event we don't care about.
This callback logs out if authorized, signs in if ... | [
"Note",
"the",
"event",
"argument",
".",
"This",
"is",
"required",
"since",
"this",
"callback",
"may",
"be",
"called",
"from",
"a",
"widget",
".",
"bind",
"(",
"such",
"as",
"<Return",
">",
")",
"which",
"sends",
"information",
"about",
"the",
"event",
"... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L182-L209 | [
"async",
"def",
"sign_in",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"self",
".",
"sign_in_label",
".",
"configure",
"(",
"text",
"=",
"'Working...'",
")",
"self",
".",
"sign_in_entry",
".",
"configure",
"(",
"state",
"=",
"tkinter",
".",
"DISABL... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | App.set_signed_in | Configures the application as "signed in" (displays user's
name and disables the entry to input phone/bot token/code). | telethon_examples/gui.py | def set_signed_in(self, me):
"""
Configures the application as "signed in" (displays user's
name and disables the entry to input phone/bot token/code).
"""
self.me = me
self.sign_in_label.configure(text='Signed in')
self.sign_in_entry.configure(state=tkinter.NORMA... | def set_signed_in(self, me):
"""
Configures the application as "signed in" (displays user's
name and disables the entry to input phone/bot token/code).
"""
self.me = me
self.sign_in_label.configure(text='Signed in')
self.sign_in_entry.configure(state=tkinter.NORMA... | [
"Configures",
"the",
"application",
"as",
"signed",
"in",
"(",
"displays",
"user",
"s",
"name",
"and",
"disables",
"the",
"entry",
"to",
"input",
"phone",
"/",
"bot",
"token",
"/",
"code",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L211-L223 | [
"def",
"set_signed_in",
"(",
"self",
",",
"me",
")",
":",
"self",
".",
"me",
"=",
"me",
"self",
".",
"sign_in_label",
".",
"configure",
"(",
"text",
"=",
"'Signed in'",
")",
"self",
".",
"sign_in_entry",
".",
"configure",
"(",
"state",
"=",
"tkinter",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | App.send_message | Sends a message. Does nothing if the client is not connected. | telethon_examples/gui.py | async def send_message(self, event=None):
"""
Sends a message. Does nothing if the client is not connected.
"""
if not self.cl.is_connected():
return
# The user needs to configure a chat where the message should be sent.
#
# If the chat ID does not ex... | async def send_message(self, event=None):
"""
Sends a message. Does nothing if the client is not connected.
"""
if not self.cl.is_connected():
return
# The user needs to configure a chat where the message should be sent.
#
# If the chat ID does not ex... | [
"Sends",
"a",
"message",
".",
"Does",
"nothing",
"if",
"the",
"client",
"is",
"not",
"connected",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L227-L305 | [
"async",
"def",
"send_message",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"cl",
".",
"is_connected",
"(",
")",
":",
"return",
"# The user needs to configure a chat where the message should be sent.",
"#",
"# If the chat ID does not ex... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | App.check_chat | Checks the input chat where to send and listen messages from. | telethon_examples/gui.py | async def check_chat(self, event=None):
"""
Checks the input chat where to send and listen messages from.
"""
if self.me is None:
return # Not logged in yet
chat = self.chat.get().strip()
try:
chat = int(chat)
except ValueError:
... | async def check_chat(self, event=None):
"""
Checks the input chat where to send and listen messages from.
"""
if self.me is None:
return # Not logged in yet
chat = self.chat.get().strip()
try:
chat = int(chat)
except ValueError:
... | [
"Checks",
"the",
"input",
"chat",
"where",
"to",
"send",
"and",
"listen",
"messages",
"from",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_examples/gui.py#L309-L341 | [
"async",
"def",
"check_chat",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"self",
".",
"me",
"is",
"None",
":",
"return",
"# Not logged in yet",
"chat",
"=",
"self",
".",
"chat",
".",
"get",
"(",
")",
".",
"strip",
"(",
")",
"try",
":",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AdminLogEvent.old | The old value from the event. | telethon/tl/custom/adminlogevent.py | def old(self):
"""
The old value from the event.
"""
ori = self.original.action
if isinstance(ori, (
types.ChannelAdminLogEventActionChangeAbout,
types.ChannelAdminLogEventActionChangeTitle,
types.ChannelAdminLogEventActionChangeUse... | def old(self):
"""
The old value from the event.
"""
ori = self.original.action
if isinstance(ori, (
types.ChannelAdminLogEventActionChangeAbout,
types.ChannelAdminLogEventActionChangeTitle,
types.ChannelAdminLogEventActionChangeUse... | [
"The",
"old",
"value",
"from",
"the",
"event",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/adminlogevent.py#L61-L92 | [
"def",
"old",
"(",
"self",
")",
":",
"ori",
"=",
"self",
".",
"original",
".",
"action",
"if",
"isinstance",
"(",
"ori",
",",
"(",
"types",
".",
"ChannelAdminLogEventActionChangeAbout",
",",
"types",
".",
"ChannelAdminLogEventActionChangeTitle",
",",
"types",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AdminLogEvent.new | The new value present in the event. | telethon/tl/custom/adminlogevent.py | def new(self):
"""
The new value present in the event.
"""
ori = self.original.action
if isinstance(ori, (
types.ChannelAdminLogEventActionChangeAbout,
types.ChannelAdminLogEventActionChangeTitle,
types.ChannelAdminLogEventActionCha... | def new(self):
"""
The new value present in the event.
"""
ori = self.original.action
if isinstance(ori, (
types.ChannelAdminLogEventActionChangeAbout,
types.ChannelAdminLogEventActionChangeTitle,
types.ChannelAdminLogEventActionCha... | [
"The",
"new",
"value",
"present",
"in",
"the",
"event",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/adminlogevent.py#L95-L125 | [
"def",
"new",
"(",
"self",
")",
":",
"ori",
"=",
"self",
".",
"original",
".",
"action",
"if",
"isinstance",
"(",
"ori",
",",
"(",
"types",
".",
"ChannelAdminLogEventActionChangeAbout",
",",
"types",
".",
"ChannelAdminLogEventActionChangeTitle",
",",
"types",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AES.decrypt_ige | Decrypts the given text in 16-bytes blocks by using the
given key and 32-bytes initialization vector. | telethon/crypto/aes.py | def decrypt_ige(cipher_text, key, iv):
"""
Decrypts the given text in 16-bytes blocks by using the
given key and 32-bytes initialization vector.
"""
if cryptg:
return cryptg.decrypt_ige(cipher_text, key, iv)
if libssl.decrypt_ige:
return libssl.dec... | def decrypt_ige(cipher_text, key, iv):
"""
Decrypts the given text in 16-bytes blocks by using the
given key and 32-bytes initialization vector.
"""
if cryptg:
return cryptg.decrypt_ige(cipher_text, key, iv)
if libssl.decrypt_ige:
return libssl.dec... | [
"Decrypts",
"the",
"given",
"text",
"in",
"16",
"-",
"bytes",
"blocks",
"by",
"using",
"the",
"given",
"key",
"and",
"32",
"-",
"bytes",
"initialization",
"vector",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/aes.py#L35-L69 | [
"def",
"decrypt_ige",
"(",
"cipher_text",
",",
"key",
",",
"iv",
")",
":",
"if",
"cryptg",
":",
"return",
"cryptg",
".",
"decrypt_ige",
"(",
"cipher_text",
",",
"key",
",",
"iv",
")",
"if",
"libssl",
".",
"decrypt_ige",
":",
"return",
"libssl",
".",
"d... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | AES.encrypt_ige | Encrypts the given text in 16-bytes blocks by using the
given key and 32-bytes initialization vector. | telethon/crypto/aes.py | def encrypt_ige(plain_text, key, iv):
"""
Encrypts the given text in 16-bytes blocks by using the
given key and 32-bytes initialization vector.
"""
padding = len(plain_text) % 16
if padding:
plain_text += os.urandom(16 - padding)
if cryptg:
... | def encrypt_ige(plain_text, key, iv):
"""
Encrypts the given text in 16-bytes blocks by using the
given key and 32-bytes initialization vector.
"""
padding = len(plain_text) % 16
if padding:
plain_text += os.urandom(16 - padding)
if cryptg:
... | [
"Encrypts",
"the",
"given",
"text",
"in",
"16",
"-",
"bytes",
"blocks",
"by",
"using",
"the",
"given",
"key",
"and",
"32",
"-",
"bytes",
"initialization",
"vector",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/crypto/aes.py#L72-L111 | [
"def",
"encrypt_ige",
"(",
"plain_text",
",",
"key",
",",
"iv",
")",
":",
"padding",
"=",
"len",
"(",
"plain_text",
")",
"%",
"16",
"if",
"padding",
":",
"plain_text",
"+=",
"os",
".",
"urandom",
"(",
"16",
"-",
"padding",
")",
"if",
"cryptg",
":",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message._finish_init | Finishes the initialization of this message by setting
the client that sent the message and making use of the
known entities. | telethon/tl/custom/message.py | def _finish_init(self, client, entities, input_chat):
"""
Finishes the initialization of this message by setting
the client that sent the message and making use of the
known entities.
"""
self._client = client
self._sender = entities.get(self._sender_id)
i... | def _finish_init(self, client, entities, input_chat):
"""
Finishes the initialization of this message by setting
the client that sent the message and making use of the
known entities.
"""
self._client = client
self._sender = entities.get(self._sender_id)
i... | [
"Finishes",
"the",
"initialization",
"of",
"this",
"message",
"by",
"setting",
"the",
"client",
"that",
"sent",
"the",
"message",
"and",
"making",
"use",
"of",
"the",
"known",
"entities",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L206-L253 | [
"def",
"_finish_init",
"(",
"self",
",",
"client",
",",
"entities",
",",
"input_chat",
")",
":",
"self",
".",
"_client",
"=",
"client",
"self",
".",
"_sender",
"=",
"entities",
".",
"get",
"(",
"self",
".",
"_sender_id",
")",
"if",
"self",
".",
"_sende... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.text | The message text, formatted using the client's default
parse mode. Will be ``None`` for :tl:`MessageService`. | telethon/tl/custom/message.py | def text(self):
"""
The message text, formatted using the client's default
parse mode. Will be ``None`` for :tl:`MessageService`.
"""
if self._text is None and self._client:
self._text = self._client.parse_mode.unparse(
self.message, self.entities)
... | def text(self):
"""
The message text, formatted using the client's default
parse mode. Will be ``None`` for :tl:`MessageService`.
"""
if self._text is None and self._client:
self._text = self._client.parse_mode.unparse(
self.message, self.entities)
... | [
"The",
"message",
"text",
"formatted",
"using",
"the",
"client",
"s",
"default",
"parse",
"mode",
".",
"Will",
"be",
"None",
"for",
":",
"tl",
":",
"MessageService",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L271-L280 | [
"def",
"text",
"(",
"self",
")",
":",
"if",
"self",
".",
"_text",
"is",
"None",
"and",
"self",
".",
"_client",
":",
"self",
".",
"_text",
"=",
"self",
".",
"_client",
".",
"parse_mode",
".",
"unparse",
"(",
"self",
".",
"message",
",",
"self",
".",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.buttons | Returns a matrix (list of lists) containing all buttons of the message
as `MessageButton <telethon.tl.custom.messagebutton.MessageButton>`
instances. | telethon/tl/custom/message.py | def buttons(self):
"""
Returns a matrix (list of lists) containing all buttons of the message
as `MessageButton <telethon.tl.custom.messagebutton.MessageButton>`
instances.
"""
if self._buttons is None and self.reply_markup:
if not self.input_chat:
... | def buttons(self):
"""
Returns a matrix (list of lists) containing all buttons of the message
as `MessageButton <telethon.tl.custom.messagebutton.MessageButton>`
instances.
"""
if self._buttons is None and self.reply_markup:
if not self.input_chat:
... | [
"Returns",
"a",
"matrix",
"(",
"list",
"of",
"lists",
")",
"containing",
"all",
"buttons",
"of",
"the",
"message",
"as",
"MessageButton",
"<telethon",
".",
"tl",
".",
"custom",
".",
"messagebutton",
".",
"MessageButton",
">",
"instances",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L327-L343 | [
"def",
"buttons",
"(",
"self",
")",
":",
"if",
"self",
".",
"_buttons",
"is",
"None",
"and",
"self",
".",
"reply_markup",
":",
"if",
"not",
"self",
".",
"input_chat",
":",
"return",
"try",
":",
"bot",
"=",
"self",
".",
"_needed_markup_bot",
"(",
")",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.get_buttons | Returns `buttons`, but will make an API call to find the
input chat (needed for the buttons) unless it's already cached. | telethon/tl/custom/message.py | async def get_buttons(self):
"""
Returns `buttons`, but will make an API call to find the
input chat (needed for the buttons) unless it's already cached.
"""
if not self.buttons and self.reply_markup:
chat = await self.get_input_chat()
if not chat:
... | async def get_buttons(self):
"""
Returns `buttons`, but will make an API call to find the
input chat (needed for the buttons) unless it's already cached.
"""
if not self.buttons and self.reply_markup:
chat = await self.get_input_chat()
if not chat:
... | [
"Returns",
"buttons",
"but",
"will",
"make",
"an",
"API",
"call",
"to",
"find",
"the",
"input",
"chat",
"(",
"needed",
"for",
"the",
"buttons",
")",
"unless",
"it",
"s",
"already",
"cached",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L345-L362 | [
"async",
"def",
"get_buttons",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"buttons",
"and",
"self",
".",
"reply_markup",
":",
"chat",
"=",
"await",
"self",
".",
"get_input_chat",
"(",
")",
"if",
"not",
"chat",
":",
"return",
"try",
":",
"bot",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.button_count | Returns the total button count. | telethon/tl/custom/message.py | def button_count(self):
"""
Returns the total button count.
"""
if self._buttons_count is None:
if isinstance(self.reply_markup, (
types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)):
self._buttons_count = sum(
len(row.... | def button_count(self):
"""
Returns the total button count.
"""
if self._buttons_count is None:
if isinstance(self.reply_markup, (
types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)):
self._buttons_count = sum(
len(row.... | [
"Returns",
"the",
"total",
"button",
"count",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L365-L377 | [
"def",
"button_count",
"(",
"self",
")",
":",
"if",
"self",
".",
"_buttons_count",
"is",
"None",
":",
"if",
"isinstance",
"(",
"self",
".",
"reply_markup",
",",
"(",
"types",
".",
"ReplyInlineMarkup",
",",
"types",
".",
"ReplyKeyboardMarkup",
")",
")",
":"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.photo | If the message media is a photo, this returns the :tl:`Photo` object.
This will also return the photo for :tl:`MessageService` if their
action is :tl:`MessageActionChatEditPhoto`. | telethon/tl/custom/message.py | def photo(self):
"""
If the message media is a photo, this returns the :tl:`Photo` object.
This will also return the photo for :tl:`MessageService` if their
action is :tl:`MessageActionChatEditPhoto`.
"""
if isinstance(self.media, types.MessageMediaPhoto):
if ... | def photo(self):
"""
If the message media is a photo, this returns the :tl:`Photo` object.
This will also return the photo for :tl:`MessageService` if their
action is :tl:`MessageActionChatEditPhoto`.
"""
if isinstance(self.media, types.MessageMediaPhoto):
if ... | [
"If",
"the",
"message",
"media",
"is",
"a",
"photo",
"this",
"returns",
"the",
":",
"tl",
":",
"Photo",
"object",
".",
"This",
"will",
"also",
"return",
"the",
"photo",
"for",
":",
"tl",
":",
"MessageService",
"if",
"their",
"action",
"is",
":",
"tl",
... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L380-L394 | [
"def",
"photo",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
",",
"types",
".",
"MessageMediaPhoto",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
".",
"photo",
",",
"types",
".",
"Photo",
")",
":",
"return",
"self... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.document | If the message media is a document,
this returns the :tl:`Document` object. | telethon/tl/custom/message.py | def document(self):
"""
If the message media is a document,
this returns the :tl:`Document` object.
"""
if isinstance(self.media, types.MessageMediaDocument):
if isinstance(self.media.document, types.Document):
return self.media.document
else:
... | def document(self):
"""
If the message media is a document,
this returns the :tl:`Document` object.
"""
if isinstance(self.media, types.MessageMediaDocument):
if isinstance(self.media.document, types.Document):
return self.media.document
else:
... | [
"If",
"the",
"message",
"media",
"is",
"a",
"document",
"this",
"returns",
"the",
":",
"tl",
":",
"Document",
"object",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L397-L408 | [
"def",
"document",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
",",
"types",
".",
"MessageMediaDocument",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
".",
"document",
",",
"types",
".",
"Document",
")",
":",
"retu... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.web_preview | If the message has a loaded web preview,
this returns the :tl:`WebPage` object. | telethon/tl/custom/message.py | def web_preview(self):
"""
If the message has a loaded web preview,
this returns the :tl:`WebPage` object.
"""
if isinstance(self.media, types.MessageMediaWebPage):
if isinstance(self.media.webpage, types.WebPage):
return self.media.webpage | def web_preview(self):
"""
If the message has a loaded web preview,
this returns the :tl:`WebPage` object.
"""
if isinstance(self.media, types.MessageMediaWebPage):
if isinstance(self.media.webpage, types.WebPage):
return self.media.webpage | [
"If",
"the",
"message",
"has",
"a",
"loaded",
"web",
"preview",
"this",
"returns",
"the",
":",
"tl",
":",
"WebPage",
"object",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L411-L418 | [
"def",
"web_preview",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
",",
"types",
".",
"MessageMediaWebPage",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
".",
"webpage",
",",
"types",
".",
"WebPage",
")",
":",
"retu... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.game | If the message media is a game, this returns the :tl:`Game`. | telethon/tl/custom/message.py | def game(self):
"""
If the message media is a game, this returns the :tl:`Game`.
"""
if isinstance(self.media, types.MessageMediaGame):
return self.media.game | def game(self):
"""
If the message media is a game, this returns the :tl:`Game`.
"""
if isinstance(self.media, types.MessageMediaGame):
return self.media.game | [
"If",
"the",
"message",
"media",
"is",
"a",
"game",
"this",
"returns",
"the",
":",
"tl",
":",
"Game",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L481-L486 | [
"def",
"game",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
",",
"types",
".",
"MessageMediaGame",
")",
":",
"return",
"self",
".",
"media",
".",
"game"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.geo | If the message media is geo, geo live or a venue,
this returns the :tl:`GeoPoint`. | telethon/tl/custom/message.py | def geo(self):
"""
If the message media is geo, geo live or a venue,
this returns the :tl:`GeoPoint`.
"""
if isinstance(self.media, (types.MessageMediaGeo,
types.MessageMediaGeoLive,
types.MessageMediaVenue)):
... | def geo(self):
"""
If the message media is geo, geo live or a venue,
this returns the :tl:`GeoPoint`.
"""
if isinstance(self.media, (types.MessageMediaGeo,
types.MessageMediaGeoLive,
types.MessageMediaVenue)):
... | [
"If",
"the",
"message",
"media",
"is",
"geo",
"geo",
"live",
"or",
"a",
"venue",
"this",
"returns",
"the",
":",
"tl",
":",
"GeoPoint",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L489-L497 | [
"def",
"geo",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"media",
",",
"(",
"types",
".",
"MessageMediaGeo",
",",
"types",
".",
"MessageMediaGeoLive",
",",
"types",
".",
"MessageMediaVenue",
")",
")",
":",
"return",
"self",
".",
"media"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.get_entities_text | Returns a list of tuples [(:tl:`MessageEntity`, `str`)], the string
being the inner text of the message entity (like bold, italics, etc).
Args:
cls (`type`):
Returns entities matching this type only. For example,
the following will print the text for all ``co... | telethon/tl/custom/message.py | def get_entities_text(self, cls=None):
"""
Returns a list of tuples [(:tl:`MessageEntity`, `str`)], the string
being the inner text of the message entity (like bold, italics, etc).
Args:
cls (`type`):
Returns entities matching this type only. For example,
... | def get_entities_text(self, cls=None):
"""
Returns a list of tuples [(:tl:`MessageEntity`, `str`)], the string
being the inner text of the message entity (like bold, italics, etc).
Args:
cls (`type`):
Returns entities matching this type only. For example,
... | [
"Returns",
"a",
"list",
"of",
"tuples",
"[",
"(",
":",
"tl",
":",
"MessageEntity",
"str",
")",
"]",
"the",
"string",
"being",
"the",
"inner",
"text",
"of",
"the",
"message",
"entity",
"(",
"like",
"bold",
"italics",
"etc",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L564-L588 | [
"def",
"get_entities_text",
"(",
"self",
",",
"cls",
"=",
"None",
")",
":",
"ent",
"=",
"self",
".",
"entities",
"if",
"not",
"ent",
":",
"return",
"[",
"]",
"if",
"cls",
":",
"ent",
"=",
"[",
"c",
"for",
"c",
"in",
"ent",
"if",
"isinstance",
"("... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.get_reply_message | The `Message` that this message is replying to, or ``None``.
The result will be cached after its first use. | telethon/tl/custom/message.py | async def get_reply_message(self):
"""
The `Message` that this message is replying to, or ``None``.
The result will be cached after its first use.
"""
if self._reply_message is None:
if not self.reply_to_msg_id:
return None
# Bots cannot ... | async def get_reply_message(self):
"""
The `Message` that this message is replying to, or ``None``.
The result will be cached after its first use.
"""
if self._reply_message is None:
if not self.reply_to_msg_id:
return None
# Bots cannot ... | [
"The",
"Message",
"that",
"this",
"message",
"is",
"replying",
"to",
"or",
"None",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L590-L616 | [
"async",
"def",
"get_reply_message",
"(",
"self",
")",
":",
"if",
"self",
".",
"_reply_message",
"is",
"None",
":",
"if",
"not",
"self",
".",
"reply_to_msg_id",
":",
"return",
"None",
"# Bots cannot access other bots' messages by their ID.",
"# However they can access t... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.respond | Responds to the message (not as a reply). Shorthand for
`telethon.client.messages.MessageMethods.send_message`
with ``entity`` already set. | telethon/tl/custom/message.py | async def respond(self, *args, **kwargs):
"""
Responds to the message (not as a reply). Shorthand for
`telethon.client.messages.MessageMethods.send_message`
with ``entity`` already set.
"""
return await self._client.send_message(
await self.get_input_chat(), *... | async def respond(self, *args, **kwargs):
"""
Responds to the message (not as a reply). Shorthand for
`telethon.client.messages.MessageMethods.send_message`
with ``entity`` already set.
"""
return await self._client.send_message(
await self.get_input_chat(), *... | [
"Responds",
"to",
"the",
"message",
"(",
"not",
"as",
"a",
"reply",
")",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"messages",
".",
"MessageMethods",
".",
"send_message",
"with",
"entity",
"already",
"set",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L618-L625 | [
"async",
"def",
"respond",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"await",
"self",
".",
"_client",
".",
"send_message",
"(",
"await",
"self",
".",
"get_input_chat",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kw... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.reply | Replies to the message (as a reply). Shorthand for
`telethon.client.messages.MessageMethods.send_message`
with both ``entity`` and ``reply_to`` already set. | telethon/tl/custom/message.py | async def reply(self, *args, **kwargs):
"""
Replies to the message (as a reply). Shorthand for
`telethon.client.messages.MessageMethods.send_message`
with both ``entity`` and ``reply_to`` already set.
"""
kwargs['reply_to'] = self.id
return await self._client.send... | async def reply(self, *args, **kwargs):
"""
Replies to the message (as a reply). Shorthand for
`telethon.client.messages.MessageMethods.send_message`
with both ``entity`` and ``reply_to`` already set.
"""
kwargs['reply_to'] = self.id
return await self._client.send... | [
"Replies",
"to",
"the",
"message",
"(",
"as",
"a",
"reply",
")",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"messages",
".",
"MessageMethods",
".",
"send_message",
"with",
"both",
"entity",
"and",
"reply_to",
"already",
"set",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L627-L635 | [
"async",
"def",
"reply",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'reply_to'",
"]",
"=",
"self",
".",
"id",
"return",
"await",
"self",
".",
"_client",
".",
"send_message",
"(",
"await",
"self",
".",
"get_input... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.forward_to | Forwards the message. Shorthand for
`telethon.client.messages.MessageMethods.forward_messages`
with both ``messages`` and ``from_peer`` already set.
If you need to forward more than one message at once, don't use
this `forward_to` method. Use a
`telethon.client.telegramclient.Te... | telethon/tl/custom/message.py | async def forward_to(self, *args, **kwargs):
"""
Forwards the message. Shorthand for
`telethon.client.messages.MessageMethods.forward_messages`
with both ``messages`` and ``from_peer`` already set.
If you need to forward more than one message at once, don't use
this `for... | async def forward_to(self, *args, **kwargs):
"""
Forwards the message. Shorthand for
`telethon.client.messages.MessageMethods.forward_messages`
with both ``messages`` and ``from_peer`` already set.
If you need to forward more than one message at once, don't use
this `for... | [
"Forwards",
"the",
"message",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"messages",
".",
"MessageMethods",
".",
"forward_messages",
"with",
"both",
"messages",
"and",
"from_peer",
"already",
"set",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L637-L649 | [
"async",
"def",
"forward_to",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'messages'",
"]",
"=",
"self",
".",
"id",
"kwargs",
"[",
"'from_peer'",
"]",
"=",
"await",
"self",
".",
"get_input_chat",
"(",
")",
"retur... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.edit | Edits the message iff it's outgoing. Shorthand for
`telethon.client.messages.MessageMethods.edit_message`
with both ``entity`` and ``message`` already set.
Returns ``None`` if the message was incoming,
or the edited `Message` otherwise.
.. note::
This is different ... | telethon/tl/custom/message.py | async def edit(self, *args, **kwargs):
"""
Edits the message iff it's outgoing. Shorthand for
`telethon.client.messages.MessageMethods.edit_message`
with both ``entity`` and ``message`` already set.
Returns ``None`` if the message was incoming,
or the edited `Message` ot... | async def edit(self, *args, **kwargs):
"""
Edits the message iff it's outgoing. Shorthand for
`telethon.client.messages.MessageMethods.edit_message`
with both ``entity`` and ``message`` already set.
Returns ``None`` if the message was incoming,
or the edited `Message` ot... | [
"Edits",
"the",
"message",
"iff",
"it",
"s",
"outgoing",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"messages",
".",
"MessageMethods",
".",
"edit_message",
"with",
"both",
"entity",
"and",
"message",
"already",
"set",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L651-L684 | [
"async",
"def",
"edit",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"fwd_from",
"or",
"not",
"self",
".",
"out",
":",
"return",
"None",
"# We assume self.out was patched for our chat",
"if",
"'link_preview'",
"not",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.delete | Deletes the message. You're responsible for checking whether you
have the permission to do so, or to except the error otherwise.
Shorthand for
`telethon.client.messages.MessageMethods.delete_messages` with
``entity`` and ``message_ids`` already set.
If you need to delete more th... | telethon/tl/custom/message.py | async def delete(self, *args, **kwargs):
"""
Deletes the message. You're responsible for checking whether you
have the permission to do so, or to except the error otherwise.
Shorthand for
`telethon.client.messages.MessageMethods.delete_messages` with
``entity`` and ``mess... | async def delete(self, *args, **kwargs):
"""
Deletes the message. You're responsible for checking whether you
have the permission to do so, or to except the error otherwise.
Shorthand for
`telethon.client.messages.MessageMethods.delete_messages` with
``entity`` and ``mess... | [
"Deletes",
"the",
"message",
".",
"You",
"re",
"responsible",
"for",
"checking",
"whether",
"you",
"have",
"the",
"permission",
"to",
"do",
"so",
"or",
"to",
"except",
"the",
"error",
"otherwise",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"m... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L686-L701 | [
"async",
"def",
"delete",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"await",
"self",
".",
"_client",
".",
"delete_messages",
"(",
"await",
"self",
".",
"get_input_chat",
"(",
")",
",",
"[",
"self",
".",
"id",
"]",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.download_media | Downloads the media contained in the message, if any. Shorthand
for `telethon.client.downloads.DownloadMethods.download_media`
with the ``message`` already set. | telethon/tl/custom/message.py | async def download_media(self, *args, **kwargs):
"""
Downloads the media contained in the message, if any. Shorthand
for `telethon.client.downloads.DownloadMethods.download_media`
with the ``message`` already set.
"""
return await self._client.download_media(self, *args, ... | async def download_media(self, *args, **kwargs):
"""
Downloads the media contained in the message, if any. Shorthand
for `telethon.client.downloads.DownloadMethods.download_media`
with the ``message`` already set.
"""
return await self._client.download_media(self, *args, ... | [
"Downloads",
"the",
"media",
"contained",
"in",
"the",
"message",
"if",
"any",
".",
"Shorthand",
"for",
"telethon",
".",
"client",
".",
"downloads",
".",
"DownloadMethods",
".",
"download_media",
"with",
"the",
"message",
"already",
"set",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L703-L709 | [
"async",
"def",
"download_media",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"await",
"self",
".",
"_client",
".",
"download_media",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message.click | Calls `telethon.tl.custom.messagebutton.MessageButton.click`
for the specified button.
Does nothing if the message has no buttons.
Args:
i (`int`):
Clicks the i'th button (starting from the index 0).
Will ``raise IndexError`` if out of bounds. Exampl... | telethon/tl/custom/message.py | async def click(self, i=None, j=None,
*, text=None, filter=None, data=None):
"""
Calls `telethon.tl.custom.messagebutton.MessageButton.click`
for the specified button.
Does nothing if the message has no buttons.
Args:
i (`int`):
C... | async def click(self, i=None, j=None,
*, text=None, filter=None, data=None):
"""
Calls `telethon.tl.custom.messagebutton.MessageButton.click`
for the specified button.
Does nothing if the message has no buttons.
Args:
i (`int`):
C... | [
"Calls",
"telethon",
".",
"tl",
".",
"custom",
".",
"messagebutton",
".",
"MessageButton",
".",
"click",
"for",
"the",
"specified",
"button",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L711-L803 | [
"async",
"def",
"click",
"(",
"self",
",",
"i",
"=",
"None",
",",
"j",
"=",
"None",
",",
"*",
",",
"text",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
":",
"if",
"not",
"await",
"self",
".",
"get... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message._reload_message | Re-fetches this message to reload the sender and chat entities,
along with their input versions. | telethon/tl/custom/message.py | async def _reload_message(self):
"""
Re-fetches this message to reload the sender and chat entities,
along with their input versions.
"""
try:
chat = await self.get_input_chat() if self.is_channel else None
msg = await self._client.get_messages(chat, ids=s... | async def _reload_message(self):
"""
Re-fetches this message to reload the sender and chat entities,
along with their input versions.
"""
try:
chat = await self.get_input_chat() if self.is_channel else None
msg = await self._client.get_messages(chat, ids=s... | [
"Re",
"-",
"fetches",
"this",
"message",
"to",
"reload",
"the",
"sender",
"and",
"chat",
"entities",
"along",
"with",
"their",
"input",
"versions",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L809-L829 | [
"async",
"def",
"_reload_message",
"(",
"self",
")",
":",
"try",
":",
"chat",
"=",
"await",
"self",
".",
"get_input_chat",
"(",
")",
"if",
"self",
".",
"is_channel",
"else",
"None",
"msg",
"=",
"await",
"self",
".",
"_client",
".",
"get_messages",
"(",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message._set_buttons | Helper methods to set the buttons given the input sender and chat. | telethon/tl/custom/message.py | def _set_buttons(self, chat, bot):
"""
Helper methods to set the buttons given the input sender and chat.
"""
if isinstance(self.reply_markup, (
types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)):
self._buttons = [[
MessageButton(self._client... | def _set_buttons(self, chat, bot):
"""
Helper methods to set the buttons given the input sender and chat.
"""
if isinstance(self.reply_markup, (
types.ReplyInlineMarkup, types.ReplyKeyboardMarkup)):
self._buttons = [[
MessageButton(self._client... | [
"Helper",
"methods",
"to",
"set",
"the",
"buttons",
"given",
"the",
"input",
"sender",
"and",
"chat",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L834-L844 | [
"def",
"_set_buttons",
"(",
"self",
",",
"chat",
",",
"bot",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"reply_markup",
",",
"(",
"types",
".",
"ReplyInlineMarkup",
",",
"types",
".",
"ReplyKeyboardMarkup",
")",
")",
":",
"self",
".",
"_buttons",
"=... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message._needed_markup_bot | Returns the input peer of the bot that's needed for the reply markup.
This is necessary for :tl:`KeyboardButtonSwitchInline` since we need
to know what bot we want to start. Raises ``ValueError`` if the bot
cannot be found but is needed. Returns ``None`` if it's not needed. | telethon/tl/custom/message.py | def _needed_markup_bot(self):
"""
Returns the input peer of the bot that's needed for the reply markup.
This is necessary for :tl:`KeyboardButtonSwitchInline` since we need
to know what bot we want to start. Raises ``ValueError`` if the bot
cannot be found but is needed. Returns... | def _needed_markup_bot(self):
"""
Returns the input peer of the bot that's needed for the reply markup.
This is necessary for :tl:`KeyboardButtonSwitchInline` since we need
to know what bot we want to start. Raises ``ValueError`` if the bot
cannot be found but is needed. Returns... | [
"Returns",
"the",
"input",
"peer",
"of",
"the",
"bot",
"that",
"s",
"needed",
"for",
"the",
"reply",
"markup",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L846-L869 | [
"def",
"_needed_markup_bot",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"reply_markup",
",",
"(",
"types",
".",
"ReplyInlineMarkup",
",",
"types",
".",
"ReplyKeyboardMarkup",
")",
")",
":",
"return",
"None",
"for",
"row",
"in",
"se... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Message._document_by_attribute | Helper method to return the document only if it has an attribute
that's an instance of the given kind, and passes the condition. | telethon/tl/custom/message.py | def _document_by_attribute(self, kind, condition=None):
"""
Helper method to return the document only if it has an attribute
that's an instance of the given kind, and passes the condition.
"""
doc = self.document
if doc:
for attr in doc.attributes:
... | def _document_by_attribute(self, kind, condition=None):
"""
Helper method to return the document only if it has an attribute
that's an instance of the given kind, and passes the condition.
"""
doc = self.document
if doc:
for attr in doc.attributes:
... | [
"Helper",
"method",
"to",
"return",
"the",
"document",
"only",
"if",
"it",
"has",
"an",
"attribute",
"that",
"s",
"an",
"instance",
"of",
"the",
"given",
"kind",
"and",
"passes",
"the",
"condition",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/message.py#L871-L882 | [
"def",
"_document_by_attribute",
"(",
"self",
",",
"kind",
",",
"condition",
"=",
"None",
")",
":",
"doc",
"=",
"self",
".",
"document",
"if",
"doc",
":",
"for",
"attr",
"in",
"doc",
".",
"attributes",
":",
"if",
"isinstance",
"(",
"attr",
",",
"kind",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | make_link_node | Create a link to the TL reference.
:param rawtext: Text being replaced with link node.
:param app: Sphinx application context
:param name: Name of the object to link to
:param options: Options dictionary passed to role func. | readthedocs/custom_roles.py | def make_link_node(rawtext, app, name, options):
"""
Create a link to the TL reference.
:param rawtext: Text being replaced with link node.
:param app: Sphinx application context
:param name: Name of the object to link to
:param options: Options dictionary passed to role func.
"""
try:
... | def make_link_node(rawtext, app, name, options):
"""
Create a link to the TL reference.
:param rawtext: Text being replaced with link node.
:param app: Sphinx application context
:param name: Name of the object to link to
:param options: Options dictionary passed to role func.
"""
try:
... | [
"Create",
"a",
"link",
"to",
"the",
"TL",
"reference",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/readthedocs/custom_roles.py#L5-L28 | [
"def",
"make_link_node",
"(",
"rawtext",
",",
"app",
",",
"name",
",",
"options",
")",
":",
"try",
":",
"base",
"=",
"app",
".",
"config",
".",
"tl_ref_url",
"if",
"not",
"base",
":",
"raise",
"AttributeError",
"except",
"AttributeError",
"as",
"e",
":",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | tl_role | Link to the TL reference.
Returns 2 part tuple containing list of nodes to insert into the
document and a list of system messages. Both are allowed to be empty.
:param name: The role name used in the document.
:param rawtext: The entire markup snippet, with role.
:param text: The text marked with ... | readthedocs/custom_roles.py | def tl_role(name, rawtext, text, lineno, inliner, options=None, content=None):
"""
Link to the TL reference.
Returns 2 part tuple containing list of nodes to insert into the
document and a list of system messages. Both are allowed to be empty.
:param name: The role name used in the document.
:... | def tl_role(name, rawtext, text, lineno, inliner, options=None, content=None):
"""
Link to the TL reference.
Returns 2 part tuple containing list of nodes to insert into the
document and a list of system messages. Both are allowed to be empty.
:param name: The role name used in the document.
:... | [
"Link",
"to",
"the",
"TL",
"reference",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/readthedocs/custom_roles.py#L31-L57 | [
"def",
"tl_role",
"(",
"name",
",",
"rawtext",
",",
"text",
",",
"lineno",
",",
"inliner",
",",
"options",
"=",
"None",
",",
"content",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"if",
"content",
"is",
"Non... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | BotMethods.inline_query | Makes the given inline query to the specified bot
i.e. ``@vote My New Poll`` would be as follows:
>>> client = ...
>>> client.inline_query('vote', 'My New Poll')
Args:
bot (`entity`):
The bot entity to which the inline query should be made.
quer... | telethon/client/bots.py | async def inline_query(self, bot, query, *, offset=None, geo_point=None):
"""
Makes the given inline query to the specified bot
i.e. ``@vote My New Poll`` would be as follows:
>>> client = ...
>>> client.inline_query('vote', 'My New Poll')
Args:
bot (`entity... | async def inline_query(self, bot, query, *, offset=None, geo_point=None):
"""
Makes the given inline query to the specified bot
i.e. ``@vote My New Poll`` would be as follows:
>>> client = ...
>>> client.inline_query('vote', 'My New Poll')
Args:
bot (`entity... | [
"Makes",
"the",
"given",
"inline",
"query",
"to",
"the",
"specified",
"bot",
"i",
".",
"e",
".",
"@vote",
"My",
"New",
"Poll",
"would",
"be",
"as",
"follows",
":"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/bots.py#L6-L41 | [
"async",
"def",
"inline_query",
"(",
"self",
",",
"bot",
",",
"query",
",",
"*",
",",
"offset",
"=",
"None",
",",
"geo_point",
"=",
"None",
")",
":",
"bot",
"=",
"await",
"self",
".",
"get_input_entity",
"(",
"bot",
")",
"result",
"=",
"await",
"self... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods.get_me | Gets "me" (the self user) which is currently authenticated,
or None if the request fails (hence, not authenticated).
Args:
input_peer (`bool`, optional):
Whether to return the :tl:`InputPeerUser` version or the normal
:tl:`User`. This can be useful if you jus... | telethon/client/users.py | async def get_me(self, input_peer=False):
"""
Gets "me" (the self user) which is currently authenticated,
or None if the request fails (hence, not authenticated).
Args:
input_peer (`bool`, optional):
Whether to return the :tl:`InputPeerUser` version or the no... | async def get_me(self, input_peer=False):
"""
Gets "me" (the self user) which is currently authenticated,
or None if the request fails (hence, not authenticated).
Args:
input_peer (`bool`, optional):
Whether to return the :tl:`InputPeerUser` version or the no... | [
"Gets",
"me",
"(",
"the",
"self",
"user",
")",
"which",
"is",
"currently",
"authenticated",
"or",
"None",
"if",
"the",
"request",
"fails",
"(",
"hence",
"not",
"authenticated",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L100-L129 | [
"async",
"def",
"get_me",
"(",
"self",
",",
"input_peer",
"=",
"False",
")",
":",
"if",
"input_peer",
"and",
"self",
".",
"_self_input_peer",
":",
"return",
"self",
".",
"_self_input_peer",
"try",
":",
"me",
"=",
"(",
"await",
"self",
"(",
"functions",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods.is_bot | Return ``True`` if the signed-in user is a bot, ``False`` otherwise. | telethon/client/users.py | async def is_bot(self):
"""
Return ``True`` if the signed-in user is a bot, ``False`` otherwise.
"""
if self._bot is None:
self._bot = (await self.get_me()).bot
return self._bot | async def is_bot(self):
"""
Return ``True`` if the signed-in user is a bot, ``False`` otherwise.
"""
if self._bot is None:
self._bot = (await self.get_me()).bot
return self._bot | [
"Return",
"True",
"if",
"the",
"signed",
"-",
"in",
"user",
"is",
"a",
"bot",
"False",
"otherwise",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L131-L138 | [
"async",
"def",
"is_bot",
"(",
"self",
")",
":",
"if",
"self",
".",
"_bot",
"is",
"None",
":",
"self",
".",
"_bot",
"=",
"(",
"await",
"self",
".",
"get_me",
"(",
")",
")",
".",
"bot",
"return",
"self",
".",
"_bot"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods.is_user_authorized | Returns ``True`` if the user is authorized. | telethon/client/users.py | async def is_user_authorized(self):
"""
Returns ``True`` if the user is authorized.
"""
if self._authorized is None:
try:
# Any request that requires authorization will work
await self(functions.updates.GetStateRequest())
self._... | async def is_user_authorized(self):
"""
Returns ``True`` if the user is authorized.
"""
if self._authorized is None:
try:
# Any request that requires authorization will work
await self(functions.updates.GetStateRequest())
self._... | [
"Returns",
"True",
"if",
"the",
"user",
"is",
"authorized",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L140-L152 | [
"async",
"def",
"is_user_authorized",
"(",
"self",
")",
":",
"if",
"self",
".",
"_authorized",
"is",
"None",
":",
"try",
":",
"# Any request that requires authorization will work",
"await",
"self",
"(",
"functions",
".",
"updates",
".",
"GetStateRequest",
"(",
")"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods.get_entity | Turns the given entity into a valid Telegram :tl:`User`, :tl:`Chat`
or :tl:`Channel`. You can also pass a list or iterable of entities,
and they will be efficiently fetched from the network.
entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`):
If a username is given, **the usernam... | telethon/client/users.py | async def get_entity(self, entity):
"""
Turns the given entity into a valid Telegram :tl:`User`, :tl:`Chat`
or :tl:`Channel`. You can also pass a list or iterable of entities,
and they will be efficiently fetched from the network.
entity (`str` | `int` | :tl:`Peer` | :tl:`InputP... | async def get_entity(self, entity):
"""
Turns the given entity into a valid Telegram :tl:`User`, :tl:`Chat`
or :tl:`Channel`. You can also pass a list or iterable of entities,
and they will be efficiently fetched from the network.
entity (`str` | `int` | :tl:`Peer` | :tl:`InputP... | [
"Turns",
"the",
"given",
"entity",
"into",
"a",
"valid",
"Telegram",
":",
"tl",
":",
"User",
":",
"tl",
":",
"Chat",
"or",
":",
"tl",
":",
"Channel",
".",
"You",
"can",
"also",
"pass",
"a",
"list",
"or",
"iterable",
"of",
"entities",
"and",
"they",
... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L154-L244 | [
"async",
"def",
"get_entity",
"(",
"self",
",",
"entity",
")",
":",
"single",
"=",
"not",
"utils",
".",
"is_list_like",
"(",
"entity",
")",
"if",
"single",
":",
"entity",
"=",
"(",
"entity",
",",
")",
"# Group input entities by string (resolve username),",
"# ... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods.get_input_entity | Turns the given peer into its input entity version. Most requests
use this kind of :tl:`InputPeer`, so this is the most suitable call
to make for those cases. **Generally you should let the library do
its job** and don't worry about getting the input entity first, but
if you're going to ... | telethon/client/users.py | async def get_input_entity(self, peer):
"""
Turns the given peer into its input entity version. Most requests
use this kind of :tl:`InputPeer`, so this is the most suitable call
to make for those cases. **Generally you should let the library do
its job** and don't worry about get... | async def get_input_entity(self, peer):
"""
Turns the given peer into its input entity version. Most requests
use this kind of :tl:`InputPeer`, so this is the most suitable call
to make for those cases. **Generally you should let the library do
its job** and don't worry about get... | [
"Turns",
"the",
"given",
"peer",
"into",
"its",
"input",
"entity",
"version",
".",
"Most",
"requests",
"use",
"this",
"kind",
"of",
":",
"tl",
":",
"InputPeer",
"so",
"this",
"is",
"the",
"most",
"suitable",
"call",
"to",
"make",
"for",
"those",
"cases",... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L246-L367 | [
"async",
"def",
"get_input_entity",
"(",
"self",
",",
"peer",
")",
":",
"# Short-circuit if the input parameter directly maps to an InputPeer",
"try",
":",
"return",
"utils",
".",
"get_input_peer",
"(",
"peer",
")",
"except",
"TypeError",
":",
"pass",
"# Next in priorit... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods.get_peer_id | Gets the ID for the given peer, which may be anything entity-like.
This method needs to be ``async`` because `peer` supports usernames,
invite-links, phone numbers (from people in your contact list), etc.
If ``add_mark is False``, then a positive ID will be returned
instead. By default... | telethon/client/users.py | async def get_peer_id(self, peer, add_mark=True):
"""
Gets the ID for the given peer, which may be anything entity-like.
This method needs to be ``async`` because `peer` supports usernames,
invite-links, phone numbers (from people in your contact list), etc.
If ``add_mark is Fa... | async def get_peer_id(self, peer, add_mark=True):
"""
Gets the ID for the given peer, which may be anything entity-like.
This method needs to be ``async`` because `peer` supports usernames,
invite-links, phone numbers (from people in your contact list), etc.
If ``add_mark is Fa... | [
"Gets",
"the",
"ID",
"for",
"the",
"given",
"peer",
"which",
"may",
"be",
"anything",
"entity",
"-",
"like",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L369-L392 | [
"async",
"def",
"get_peer_id",
"(",
"self",
",",
"peer",
",",
"add_mark",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"peer",
",",
"int",
")",
":",
"return",
"utils",
".",
"get_peer_id",
"(",
"peer",
",",
"add_mark",
"=",
"add_mark",
")",
"try",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods._get_entity_from_string | Gets a full entity from the given string, which may be a phone or
a username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
This method has the side effect of adding the found users to the
session database, so it ... | telethon/client/users.py | async def _get_entity_from_string(self, string):
"""
Gets a full entity from the given string, which may be a phone or
a username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
This method has the side eff... | async def _get_entity_from_string(self, string):
"""
Gets a full entity from the given string, which may be a phone or
a username, and processes all the found entities on the session.
The string may also be a user link, or a channel/chat invite link.
This method has the side eff... | [
"Gets",
"a",
"full",
"entity",
"from",
"the",
"given",
"string",
"which",
"may",
"be",
"a",
"phone",
"or",
"a",
"username",
"and",
"processes",
"all",
"the",
"found",
"entities",
"on",
"the",
"session",
".",
"The",
"string",
"may",
"also",
"be",
"a",
"... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L398-L460 | [
"async",
"def",
"_get_entity_from_string",
"(",
"self",
",",
"string",
")",
":",
"phone",
"=",
"utils",
".",
"parse_phone",
"(",
"string",
")",
"if",
"phone",
":",
"try",
":",
"for",
"user",
"in",
"(",
"await",
"self",
"(",
"functions",
".",
"contacts",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods._get_input_dialog | Returns a :tl:`InputDialogPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity. | telethon/client/users.py | async def _get_input_dialog(self, dialog):
"""
Returns a :tl:`InputDialogPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if dialog.SUBCLASS_OF_ID == 0xa21c9795: # crc32(b'Input... | async def _get_input_dialog(self, dialog):
"""
Returns a :tl:`InputDialogPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if dialog.SUBCLASS_OF_ID == 0xa21c9795: # crc32(b'Input... | [
"Returns",
"a",
":",
"tl",
":",
"InputDialogPeer",
".",
"This",
"is",
"a",
"bit",
"tricky",
"because",
"it",
"may",
"or",
"not",
"need",
"access",
"to",
"the",
"client",
"to",
"convert",
"what",
"s",
"given",
"into",
"an",
"input",
"entity",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L462-L477 | [
"async",
"def",
"_get_input_dialog",
"(",
"self",
",",
"dialog",
")",
":",
"try",
":",
"if",
"dialog",
".",
"SUBCLASS_OF_ID",
"==",
"0xa21c9795",
":",
"# crc32(b'InputDialogPeer')",
"dialog",
".",
"peer",
"=",
"await",
"self",
".",
"get_input_entity",
"(",
"di... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UserMethods._get_input_notify | Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity. | telethon/client/users.py | async def _get_input_notify(self, notify):
"""
Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if notify.SUBCLASS_OF_ID == 0x58981615:
... | async def _get_input_notify(self, notify):
"""
Returns a :tl:`InputNotifyPeer`. This is a bit tricky because
it may or not need access to the client to convert what's given
into an input entity.
"""
try:
if notify.SUBCLASS_OF_ID == 0x58981615:
... | [
"Returns",
"a",
":",
"tl",
":",
"InputNotifyPeer",
".",
"This",
"is",
"a",
"bit",
"tricky",
"because",
"it",
"may",
"or",
"not",
"need",
"access",
"to",
"the",
"client",
"to",
"convert",
"what",
"s",
"given",
"into",
"an",
"input",
"entity",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/users.py#L479-L491 | [
"async",
"def",
"_get_input_notify",
"(",
"self",
",",
"notify",
")",
":",
"try",
":",
"if",
"notify",
".",
"SUBCLASS_OF_ID",
"==",
"0x58981615",
":",
"if",
"isinstance",
"(",
"notify",
",",
"types",
".",
"InputNotifyPeer",
")",
":",
"notify",
".",
"peer",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Draft.input_entity | Input version of the entity. | telethon/tl/custom/draft.py | def input_entity(self):
"""
Input version of the entity.
"""
if not self._input_entity:
try:
self._input_entity = self._client._entity_cache[self._peer]
except KeyError:
pass
return self._input_entity | def input_entity(self):
"""
Input version of the entity.
"""
if not self._input_entity:
try:
self._input_entity = self._client._entity_cache[self._peer]
except KeyError:
pass
return self._input_entity | [
"Input",
"version",
"of",
"the",
"entity",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L61-L71 | [
"def",
"input_entity",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_input_entity",
":",
"try",
":",
"self",
".",
"_input_entity",
"=",
"self",
".",
"_client",
".",
"_entity_cache",
"[",
"self",
".",
"_peer",
"]",
"except",
"KeyError",
":",
"pass",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Draft.get_entity | Returns `entity` but will make an API call if necessary. | telethon/tl/custom/draft.py | async def get_entity(self):
"""
Returns `entity` but will make an API call if necessary.
"""
if not self.entity and await self.get_input_entity():
try:
self._entity =\
await self._client.get_entity(self._input_entity)
except Val... | async def get_entity(self):
"""
Returns `entity` but will make an API call if necessary.
"""
if not self.entity and await self.get_input_entity():
try:
self._entity =\
await self._client.get_entity(self._input_entity)
except Val... | [
"Returns",
"entity",
"but",
"will",
"make",
"an",
"API",
"call",
"if",
"necessary",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L73-L84 | [
"async",
"def",
"get_entity",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"entity",
"and",
"await",
"self",
".",
"get_input_entity",
"(",
")",
":",
"try",
":",
"self",
".",
"_entity",
"=",
"await",
"self",
".",
"_client",
".",
"get_entity",
"(",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Draft.set_message | Changes the draft message on the Telegram servers. The changes are
reflected in this object.
:param str text: New text of the draft.
Preserved if left as None.
:param int reply_to: Message ID to reply to.
Preserved if left as 0, erased if s... | telethon/tl/custom/draft.py | async def set_message(
self, text=None, reply_to=0, parse_mode=(),
link_preview=None):
"""
Changes the draft message on the Telegram servers. The changes are
reflected in this object.
:param str text: New text of the draft.
Preserved if l... | async def set_message(
self, text=None, reply_to=0, parse_mode=(),
link_preview=None):
"""
Changes the draft message on the Telegram servers. The changes are
reflected in this object.
:param str text: New text of the draft.
Preserved if l... | [
"Changes",
"the",
"draft",
"message",
"on",
"the",
"Telegram",
"servers",
".",
"The",
"changes",
"are",
"reflected",
"in",
"this",
"object",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L117-L163 | [
"async",
"def",
"set_message",
"(",
"self",
",",
"text",
"=",
"None",
",",
"reply_to",
"=",
"0",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"None",
")",
":",
"if",
"text",
"is",
"None",
":",
"text",
"=",
"self",
".",
"_text",
"if",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | Draft.send | Sends the contents of this draft to the dialog. This is just a
wrapper around ``send_message(dialog.input_entity, *args, **kwargs)``. | telethon/tl/custom/draft.py | async def send(self, clear=True, parse_mode=()):
"""
Sends the contents of this draft to the dialog. This is just a
wrapper around ``send_message(dialog.input_entity, *args, **kwargs)``.
"""
await self._client.send_message(
self._peer, self.text, reply_to=self.reply_t... | async def send(self, clear=True, parse_mode=()):
"""
Sends the contents of this draft to the dialog. This is just a
wrapper around ``send_message(dialog.input_entity, *args, **kwargs)``.
"""
await self._client.send_message(
self._peer, self.text, reply_to=self.reply_t... | [
"Sends",
"the",
"contents",
"of",
"this",
"draft",
"to",
"the",
"dialog",
".",
"This",
"is",
"just",
"a",
"wrapper",
"around",
"send_message",
"(",
"dialog",
".",
"input_entity",
"*",
"args",
"**",
"kwargs",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/draft.py#L165-L174 | [
"async",
"def",
"send",
"(",
"self",
",",
"clear",
"=",
"True",
",",
"parse_mode",
"=",
"(",
")",
")",
":",
"await",
"self",
".",
"_client",
".",
"send_message",
"(",
"self",
".",
"_peer",
",",
"self",
".",
"text",
",",
"reply_to",
"=",
"self",
"."... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods.download_profile_photo | Downloads the profile photo of the given entity (user/chat/channel).
Args:
entity (`entity`):
From who the photo will be downloaded.
.. note::
This method expects the full entity (which has the data
to download the photo), no... | telethon/client/downloads.py | async def download_profile_photo(
self, entity, file=None, *, download_big=True):
"""
Downloads the profile photo of the given entity (user/chat/channel).
Args:
entity (`entity`):
From who the photo will be downloaded.
.. note::
... | async def download_profile_photo(
self, entity, file=None, *, download_big=True):
"""
Downloads the profile photo of the given entity (user/chat/channel).
Args:
entity (`entity`):
From who the photo will be downloaded.
.. note::
... | [
"Downloads",
"the",
"profile",
"photo",
"of",
"the",
"given",
"entity",
"(",
"user",
"/",
"chat",
"/",
"channel",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L20-L115 | [
"async",
"def",
"download_profile_photo",
"(",
"self",
",",
"entity",
",",
"file",
"=",
"None",
",",
"*",
",",
"download_big",
"=",
"True",
")",
":",
"# hex(crc32(x.encode('ascii'))) for x in",
"# ('User', 'Chat', 'UserFull', 'ChatFull')",
"ENTITIES",
"=",
"(",
"0x2da... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods.download_media | Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip install cryptg``) so that decrypting the
received data is done in C instead of Python (much faster).
message (`Message <tele... | telethon/client/downloads.py | async def download_media(self, message, file=None,
*, thumb=None, progress_callback=None):
"""
Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip i... | async def download_media(self, message, file=None,
*, thumb=None, progress_callback=None):
"""
Downloads the given media, or the media from a specified Message.
Note that if the download is too slow, you should consider installing
``cryptg`` (through ``pip i... | [
"Downloads",
"the",
"given",
"media",
"or",
"the",
"media",
"from",
"a",
"specified",
"Message",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L117-L190 | [
"async",
"def",
"download_media",
"(",
"self",
",",
"message",
",",
"file",
"=",
"None",
",",
"*",
",",
"thumb",
"=",
"None",
",",
"progress_callback",
"=",
"None",
")",
":",
"# TODO This won't work for messageService",
"if",
"isinstance",
"(",
"message",
",",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods.download_file | Downloads the given input location to a file.
Args:
input_location (:tl:`InputFileLocation`):
The file location from which the file will be downloaded.
See `telethon.utils.get_input_location` source for a complete
list of supported types.
... | telethon/client/downloads.py | async def download_file(
self, input_location, file=None, *, part_size_kb=None,
file_size=None, progress_callback=None, dc_id=None):
"""
Downloads the given input location to a file.
Args:
input_location (:tl:`InputFileLocation`):
The file loc... | async def download_file(
self, input_location, file=None, *, part_size_kb=None,
file_size=None, progress_callback=None, dc_id=None):
"""
Downloads the given input location to a file.
Args:
input_location (:tl:`InputFileLocation`):
The file loc... | [
"Downloads",
"the",
"given",
"input",
"location",
"to",
"a",
"file",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L192-L318 | [
"async",
"def",
"download_file",
"(",
"self",
",",
"input_location",
",",
"file",
"=",
"None",
",",
"*",
",",
"part_size_kb",
"=",
"None",
",",
"file_size",
"=",
"None",
",",
"progress_callback",
"=",
"None",
",",
"dc_id",
"=",
"None",
")",
":",
"if",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods._download_photo | Specialized version of .download_media() for photos | telethon/client/downloads.py | async def _download_photo(self, photo, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for photos"""
# Determine the photo and its largest size
if isinstance(photo, types.MessageMediaPhoto):
photo = photo.photo
if not isinstance(photo, types... | async def _download_photo(self, photo, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for photos"""
# Determine the photo and its largest size
if isinstance(photo, types.MessageMediaPhoto):
photo = photo.photo
if not isinstance(photo, types... | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"photos"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L355-L382 | [
"async",
"def",
"_download_photo",
"(",
"self",
",",
"photo",
",",
"file",
",",
"date",
",",
"thumb",
",",
"progress_callback",
")",
":",
"# Determine the photo and its largest size",
"if",
"isinstance",
"(",
"photo",
",",
"types",
".",
"MessageMediaPhoto",
")",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods._get_kind_and_names | Gets kind and possible names for :tl:`DocumentAttribute`. | telethon/client/downloads.py | def _get_kind_and_names(attributes):
"""Gets kind and possible names for :tl:`DocumentAttribute`."""
kind = 'document'
possible_names = []
for attr in attributes:
if isinstance(attr, types.DocumentAttributeFilename):
possible_names.insert(0, attr.file_name)
... | def _get_kind_and_names(attributes):
"""Gets kind and possible names for :tl:`DocumentAttribute`."""
kind = 'document'
possible_names = []
for attr in attributes:
if isinstance(attr, types.DocumentAttributeFilename):
possible_names.insert(0, attr.file_name)
... | [
"Gets",
"kind",
"and",
"possible",
"names",
"for",
":",
"tl",
":",
"DocumentAttribute",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L385-L406 | [
"def",
"_get_kind_and_names",
"(",
"attributes",
")",
":",
"kind",
"=",
"'document'",
"possible_names",
"=",
"[",
"]",
"for",
"attr",
"in",
"attributes",
":",
"if",
"isinstance",
"(",
"attr",
",",
"types",
".",
"DocumentAttributeFilename",
")",
":",
"possible_... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods._download_document | Specialized version of .download_media() for documents. | telethon/client/downloads.py | async def _download_document(
self, document, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for documents."""
if isinstance(document, types.MessageMediaDocument):
document = document.document
if not isinstance(document, types.Document)... | async def _download_document(
self, document, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for documents."""
if isinstance(document, types.MessageMediaDocument):
document = document.document
if not isinstance(document, types.Document)... | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"documents",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L408-L441 | [
"async",
"def",
"_download_document",
"(",
"self",
",",
"document",
",",
"file",
",",
"date",
",",
"thumb",
",",
"progress_callback",
")",
":",
"if",
"isinstance",
"(",
"document",
",",
"types",
".",
"MessageMediaDocument",
")",
":",
"document",
"=",
"docume... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods._download_contact | Specialized version of .download_media() for contacts.
Will make use of the vCard 4.0 format. | telethon/client/downloads.py | def _download_contact(cls, mm_contact, file):
"""
Specialized version of .download_media() for contacts.
Will make use of the vCard 4.0 format.
"""
first_name = mm_contact.first_name
last_name = mm_contact.last_name
phone_number = mm_contact.phone_number
... | def _download_contact(cls, mm_contact, file):
"""
Specialized version of .download_media() for contacts.
Will make use of the vCard 4.0 format.
"""
first_name = mm_contact.first_name
last_name = mm_contact.last_name
phone_number = mm_contact.phone_number
... | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"contacts",
".",
"Will",
"make",
"use",
"of",
"the",
"vCard",
"4",
".",
"0",
"format",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L444-L483 | [
"def",
"_download_contact",
"(",
"cls",
",",
"mm_contact",
",",
"file",
")",
":",
"first_name",
"=",
"mm_contact",
".",
"first_name",
"last_name",
"=",
"mm_contact",
".",
"last_name",
"phone_number",
"=",
"mm_contact",
".",
"phone_number",
"# Remove these pesky char... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods._download_web_document | Specialized version of .download_media() for web documents. | telethon/client/downloads.py | async def _download_web_document(cls, web, file, progress_callback):
"""
Specialized version of .download_media() for web documents.
"""
if not aiohttp:
raise ValueError(
'Cannot download web documents without the aiohttp '
'dependency install ... | async def _download_web_document(cls, web, file, progress_callback):
"""
Specialized version of .download_media() for web documents.
"""
if not aiohttp:
raise ValueError(
'Cannot download web documents without the aiohttp '
'dependency install ... | [
"Specialized",
"version",
"of",
".",
"download_media",
"()",
"for",
"web",
"documents",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L486-L524 | [
"async",
"def",
"_download_web_document",
"(",
"cls",
",",
"web",
",",
"file",
",",
"progress_callback",
")",
":",
"if",
"not",
"aiohttp",
":",
"raise",
"ValueError",
"(",
"'Cannot download web documents without the aiohttp '",
"'dependency install it (pip install aiohttp)'... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DownloadMethods._get_proper_filename | Gets a proper filename for 'file', if this is a path.
'kind' should be the kind of the output file (photo, document...)
'extension' should be the extension to be added to the file if
the filename doesn't have any yet
'date' should be when this file was originally... | telethon/client/downloads.py | def _get_proper_filename(file, kind, extension,
date=None, possible_names=None):
"""Gets a proper filename for 'file', if this is a path.
'kind' should be the kind of the output file (photo, document...)
'extension' should be the extension to be added to the f... | def _get_proper_filename(file, kind, extension,
date=None, possible_names=None):
"""Gets a proper filename for 'file', if this is a path.
'kind' should be the kind of the output file (photo, document...)
'extension' should be the extension to be added to the f... | [
"Gets",
"a",
"proper",
"filename",
"for",
"file",
"if",
"this",
"is",
"a",
"path",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/downloads.py#L527-L587 | [
"def",
"_get_proper_filename",
"(",
"file",
",",
"kind",
",",
"extension",
",",
"date",
"=",
"None",
",",
"possible_names",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"file",
",",
"pathlib",
".",
"Path",
")",
":",
"file",
"=",
"str",
"(",
"file",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | _MessagesIter._message_in_range | Determine whether the given message is in the range or
it should be ignored (and avoid loading more chunks). | telethon/client/messages.py | def _message_in_range(self, message):
"""
Determine whether the given message is in the range or
it should be ignored (and avoid loading more chunks).
"""
# No entity means message IDs between chats may vary
if self.entity:
if self.reverse:
if ... | def _message_in_range(self, message):
"""
Determine whether the given message is in the range or
it should be ignored (and avoid loading more chunks).
"""
# No entity means message IDs between chats may vary
if self.entity:
if self.reverse:
if ... | [
"Determine",
"whether",
"the",
"given",
"message",
"is",
"in",
"the",
"range",
"or",
"it",
"should",
"be",
"ignored",
"(",
"and",
"avoid",
"loading",
"more",
"chunks",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L193-L207 | [
"def",
"_message_in_range",
"(",
"self",
",",
"message",
")",
":",
"# No entity means message IDs between chats may vary",
"if",
"self",
".",
"entity",
":",
"if",
"self",
".",
"reverse",
":",
"if",
"message",
".",
"id",
"<=",
"self",
".",
"last_id",
"or",
"mes... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | _MessagesIter._update_offset | After making the request, update its offset with the last message. | telethon/client/messages.py | def _update_offset(self, last_message):
"""
After making the request, update its offset with the last message.
"""
self.request.offset_id = last_message.id
if self.reverse:
# We want to skip the one we already have
self.request.offset_id += 1
if i... | def _update_offset(self, last_message):
"""
After making the request, update its offset with the last message.
"""
self.request.offset_id = last_message.id
if self.reverse:
# We want to skip the one we already have
self.request.offset_id += 1
if i... | [
"After",
"making",
"the",
"request",
"update",
"its",
"offset",
"with",
"the",
"last",
"message",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L209-L229 | [
"def",
"_update_offset",
"(",
"self",
",",
"last_message",
")",
":",
"self",
".",
"request",
".",
"offset_id",
"=",
"last_message",
".",
"id",
"if",
"self",
".",
"reverse",
":",
"# We want to skip the one we already have",
"self",
".",
"request",
".",
"offset_id... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.iter_messages | Iterator over the message history for the specified entity.
If either `search`, `filter` or `from_user` are provided,
:tl:`messages.Search` will be used instead of :tl:`messages.getHistory`.
Args:
entity (`entity`):
The entity from whom to retrieve the message histor... | telethon/client/messages.py | def iter_messages(
self, entity, limit=None, *, offset_date=None, offset_id=0,
max_id=0, min_id=0, add_offset=0, search=None, filter=None,
from_user=None, wait_time=None, ids=None, reverse=False
):
"""
Iterator over the message history for the specified entity.
... | def iter_messages(
self, entity, limit=None, *, offset_date=None, offset_id=0,
max_id=0, min_id=0, add_offset=0, search=None, filter=None,
from_user=None, wait_time=None, ids=None, reverse=False
):
"""
Iterator over the message history for the specified entity.
... | [
"Iterator",
"over",
"the",
"message",
"history",
"for",
"the",
"specified",
"entity",
".",
"If",
"either",
"search",
"filter",
"or",
"from_user",
"are",
"provided",
":",
"tl",
":",
"messages",
".",
"Search",
"will",
"be",
"used",
"instead",
"of",
":",
"tl"... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L295-L418 | [
"def",
"iter_messages",
"(",
"self",
",",
"entity",
",",
"limit",
"=",
"None",
",",
"*",
",",
"offset_date",
"=",
"None",
",",
"offset_id",
"=",
"0",
",",
"max_id",
"=",
"0",
",",
"min_id",
"=",
"0",
",",
"add_offset",
"=",
"0",
",",
"search",
"=",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.get_messages | Same as `iter_messages`, but returns a
`TotalList <telethon.helpers.TotalList>` instead.
If the `limit` is not set, it will be 1 by default unless both
`min_id` **and** `max_id` are set (as *named* arguments), in
which case the entire range will be returned.
This is so because ... | telethon/client/messages.py | async def get_messages(self, *args, **kwargs):
"""
Same as `iter_messages`, but returns a
`TotalList <telethon.helpers.TotalList>` instead.
If the `limit` is not set, it will be 1 by default unless both
`min_id` **and** `max_id` are set (as *named* arguments), in
which c... | async def get_messages(self, *args, **kwargs):
"""
Same as `iter_messages`, but returns a
`TotalList <telethon.helpers.TotalList>` instead.
If the `limit` is not set, it will be 1 by default unless both
`min_id` **and** `max_id` are set (as *named* arguments), in
which c... | [
"Same",
"as",
"iter_messages",
"but",
"returns",
"a",
"TotalList",
"<telethon",
".",
"helpers",
".",
"TotalList",
">",
"instead",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L420-L453 | [
"async",
"def",
"get_messages",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"'limit'",
"not",
"in",
"kwargs",
":",
"if",
"'min_id'",
"in",
"kwargs",
"and",
"'max_id'",
"in",
"kw... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.send_message | Sends the given message to the specified entity (user/chat/channel).
The default parse mode is the same as the official applications
(a custom flavour of markdown). ``**bold**, `code` or __italic__``
are available. In addition you can send ``[links](https://example.com)``
and ``[mention... | telethon/client/messages.py | async def send_message(
self, entity, message='', *, reply_to=None,
parse_mode=(), link_preview=True, file=None,
force_document=False, clear_draft=False, buttons=None,
silent=None):
"""
Sends the given message to the specified entity (user/chat/channel).
... | async def send_message(
self, entity, message='', *, reply_to=None,
parse_mode=(), link_preview=True, file=None,
force_document=False, clear_draft=False, buttons=None,
silent=None):
"""
Sends the given message to the specified entity (user/chat/channel).
... | [
"Sends",
"the",
"given",
"message",
"to",
"the",
"specified",
"entity",
"(",
"user",
"/",
"chat",
"/",
"channel",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L459-L610 | [
"async",
"def",
"send_message",
"(",
"self",
",",
"entity",
",",
"message",
"=",
"''",
",",
"*",
",",
"reply_to",
"=",
"None",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"True",
",",
"file",
"=",
"None",
",",
"force_document",
"=",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.forward_messages | Forwards the given message(s) to the specified entity.
Args:
entity (`entity`):
To which entity the message(s) will be forwarded.
messages (`list` | `int` | `Message <telethon.tl.custom.message.Message>`):
The message(s) to forward, or their integer IDs.... | telethon/client/messages.py | async def forward_messages(self, entity, messages, from_peer=None,
*, silent=None, as_album=None):
"""
Forwards the given message(s) to the specified entity.
Args:
entity (`entity`):
To which entity the message(s) will be forwarded.
... | async def forward_messages(self, entity, messages, from_peer=None,
*, silent=None, as_album=None):
"""
Forwards the given message(s) to the specified entity.
Args:
entity (`entity`):
To which entity the message(s) will be forwarded.
... | [
"Forwards",
"the",
"given",
"message",
"(",
"s",
")",
"to",
"the",
"specified",
"entity",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L612-L719 | [
"async",
"def",
"forward_messages",
"(",
"self",
",",
"entity",
",",
"messages",
",",
"from_peer",
"=",
"None",
",",
"*",
",",
"silent",
"=",
"None",
",",
"as_album",
"=",
"None",
")",
":",
"single",
"=",
"not",
"utils",
".",
"is_list_like",
"(",
"mess... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.edit_message | Edits the given message ID (to change its contents or disable preview).
Args:
entity (`entity` | `Message <telethon.tl.custom.message.Message>`):
From which chat to edit the message. This can also be
the message to be edited, and the entity will be inferred
... | telethon/client/messages.py | async def edit_message(
self, entity, message=None, text=None,
*, parse_mode=(), link_preview=True, file=None,
buttons=None):
"""
Edits the given message ID (to change its contents or disable preview).
Args:
entity (`entity` | `Message <telethon.t... | async def edit_message(
self, entity, message=None, text=None,
*, parse_mode=(), link_preview=True, file=None,
buttons=None):
"""
Edits the given message ID (to change its contents or disable preview).
Args:
entity (`entity` | `Message <telethon.t... | [
"Edits",
"the",
"given",
"message",
"ID",
"(",
"to",
"change",
"its",
"contents",
"or",
"disable",
"preview",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L721-L825 | [
"async",
"def",
"edit_message",
"(",
"self",
",",
"entity",
",",
"message",
"=",
"None",
",",
"text",
"=",
"None",
",",
"*",
",",
"parse_mode",
"=",
"(",
")",
",",
"link_preview",
"=",
"True",
",",
"file",
"=",
"None",
",",
"buttons",
"=",
"None",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.delete_messages | Deletes a message from a chat, optionally "for everyone".
Args:
entity (`entity`):
From who the message will be deleted. This can actually
be ``None`` for normal chats, but **must** be present
for channels and megagroups.
message_ids (`li... | telethon/client/messages.py | async def delete_messages(self, entity, message_ids, *, revoke=True):
"""
Deletes a message from a chat, optionally "for everyone".
Args:
entity (`entity`):
From who the message will be deleted. This can actually
be ``None`` for normal chats, but **mu... | async def delete_messages(self, entity, message_ids, *, revoke=True):
"""
Deletes a message from a chat, optionally "for everyone".
Args:
entity (`entity`):
From who the message will be deleted. This can actually
be ``None`` for normal chats, but **mu... | [
"Deletes",
"a",
"message",
"from",
"a",
"chat",
"optionally",
"for",
"everyone",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L827-L873 | [
"async",
"def",
"delete_messages",
"(",
"self",
",",
"entity",
",",
"message_ids",
",",
"*",
",",
"revoke",
"=",
"True",
")",
":",
"if",
"not",
"utils",
".",
"is_list_like",
"(",
"message_ids",
")",
":",
"message_ids",
"=",
"(",
"message_ids",
",",
")",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MessageMethods.send_read_acknowledge | Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or more than one) in the
given conversation.
If neither message nor maximum ID are provided, all messages will be
... | telethon/client/messages.py | async def send_read_acknowledge(
self, entity, message=None, *, max_id=None, clear_mentions=False):
"""
Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or ... | async def send_read_acknowledge(
self, entity, message=None, *, max_id=None, clear_mentions=False):
"""
Sends a "read acknowledge" (i.e., notifying the given peer that we've
read their messages, also known as the "double check").
This effectively marks a message as read (or ... | [
"Sends",
"a",
"read",
"acknowledge",
"(",
"i",
".",
"e",
".",
"notifying",
"the",
"given",
"peer",
"that",
"we",
"ve",
"read",
"their",
"messages",
"also",
"known",
"as",
"the",
"double",
"check",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/messages.py#L879-L932 | [
"async",
"def",
"send_read_acknowledge",
"(",
"self",
",",
"entity",
",",
"message",
"=",
"None",
",",
"*",
",",
"max_id",
"=",
"None",
",",
"clear_mentions",
"=",
"False",
")",
":",
"if",
"max_id",
"is",
"None",
":",
"if",
"not",
"message",
":",
"max_... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UploadMethods.send_file | Sends a file to the specified entity.
Args:
entity (`entity`):
Who will receive the file.
file (`str` | `bytes` | `file` | `media`):
The file to send, which can be one of:
* A local file path to an in-disk file. The file name
... | telethon/client/uploads.py | async def send_file(
self, entity, file, *, caption=None, force_document=False,
progress_callback=None, reply_to=None, attributes=None,
thumb=None, allow_cache=True, parse_mode=(),
voice_note=False, video_note=False, buttons=None, silent=None,
supports_streami... | async def send_file(
self, entity, file, *, caption=None, force_document=False,
progress_callback=None, reply_to=None, attributes=None,
thumb=None, allow_cache=True, parse_mode=(),
voice_note=False, video_note=False, buttons=None, silent=None,
supports_streami... | [
"Sends",
"a",
"file",
"to",
"the",
"specified",
"entity",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/uploads.py#L85-L293 | [
"async",
"def",
"send_file",
"(",
"self",
",",
"entity",
",",
"file",
",",
"*",
",",
"caption",
"=",
"None",
",",
"force_document",
"=",
"False",
",",
"progress_callback",
"=",
"None",
",",
"reply_to",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UploadMethods._send_album | Specialized version of .send_file for albums | telethon/client/uploads.py | async def _send_album(self, entity, files, caption='',
progress_callback=None, reply_to=None,
parse_mode=(), silent=None):
"""Specialized version of .send_file for albums"""
# We don't care if the user wants to avoid cache, we will use it
# any... | async def _send_album(self, entity, files, caption='',
progress_callback=None, reply_to=None,
parse_mode=(), silent=None):
"""Specialized version of .send_file for albums"""
# We don't care if the user wants to avoid cache, we will use it
# any... | [
"Specialized",
"version",
"of",
".",
"send_file",
"for",
"albums"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/uploads.py#L295-L360 | [
"async",
"def",
"_send_album",
"(",
"self",
",",
"entity",
",",
"files",
",",
"caption",
"=",
"''",
",",
"progress_callback",
"=",
"None",
",",
"reply_to",
"=",
"None",
",",
"parse_mode",
"=",
"(",
")",
",",
"silent",
"=",
"None",
")",
":",
"# We don't... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UploadMethods.upload_file | Uploads the specified file and returns a handle (an instance of
:tl:`InputFile` or :tl:`InputFileBig`, as required) which can be
later used before it expires (they are usable during less than a day).
Uploading a file will simply return a "handle" to the file stored
remotely in the Teleg... | telethon/client/uploads.py | async def upload_file(
self, file, *, part_size_kb=None, file_name=None, use_cache=None,
progress_callback=None):
"""
Uploads the specified file and returns a handle (an instance of
:tl:`InputFile` or :tl:`InputFileBig`, as required) which can be
later used before... | async def upload_file(
self, file, *, part_size_kb=None, file_name=None, use_cache=None,
progress_callback=None):
"""
Uploads the specified file and returns a handle (an instance of
:tl:`InputFile` or :tl:`InputFileBig`, as required) which can be
later used before... | [
"Uploads",
"the",
"specified",
"file",
"and",
"returns",
"a",
"handle",
"(",
"an",
"instance",
"of",
":",
"tl",
":",
"InputFile",
"or",
":",
"tl",
":",
"InputFileBig",
"as",
"required",
")",
"which",
"can",
"be",
"later",
"used",
"before",
"it",
"expires... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/uploads.py#L362-L510 | [
"async",
"def",
"upload_file",
"(",
"self",
",",
"file",
",",
"*",
",",
"part_size_kb",
"=",
"None",
",",
"file_name",
"=",
"None",
",",
"use_cache",
"=",
"None",
",",
"progress_callback",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"file",
",",
"(... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | EntityCache.add | Adds the given entities to the cache, if they weren't saved before. | telethon/entitycache.py | def add(self, entities):
"""
Adds the given entities to the cache, if they weren't saved before.
"""
if not utils.is_list_like(entities):
# Invariant: all "chats" and "users" are always iterables,
# and "user" never is (so we wrap it inside a list).
en... | def add(self, entities):
"""
Adds the given entities to the cache, if they weren't saved before.
"""
if not utils.is_list_like(entities):
# Invariant: all "chats" and "users" are always iterables,
# and "user" never is (so we wrap it inside a list).
en... | [
"Adds",
"the",
"given",
"entities",
"to",
"the",
"cache",
"if",
"they",
"weren",
"t",
"saved",
"before",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/entitycache.py#L10-L30 | [
"def",
"add",
"(",
"self",
",",
"entities",
")",
":",
"if",
"not",
"utils",
".",
"is_list_like",
"(",
"entities",
")",
":",
"# Invariant: all \"chats\" and \"users\" are always iterables,",
"# and \"user\" never is (so we wrap it inside a list).",
"entities",
"=",
"itertool... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UpdateMethods.run_until_disconnected | Runs the event loop until `disconnect` is called or if an error
while connecting/sending/receiving occurs in the background. In
the latter case, said error will ``raise`` so you have a chance
to ``except`` it on your own code.
If the loop is already running, this method returns a corout... | telethon/client/updates.py | def run_until_disconnected(self):
"""
Runs the event loop until `disconnect` is called or if an error
while connecting/sending/receiving occurs in the background. In
the latter case, said error will ``raise`` so you have a chance
to ``except`` it on your own code.
If the... | def run_until_disconnected(self):
"""
Runs the event loop until `disconnect` is called or if an error
while connecting/sending/receiving occurs in the background. In
the latter case, said error will ``raise`` so you have a chance
to ``except`` it on your own code.
If the... | [
"Runs",
"the",
"event",
"loop",
"until",
"disconnect",
"is",
"called",
"or",
"if",
"an",
"error",
"while",
"connecting",
"/",
"sending",
"/",
"receiving",
"occurs",
"in",
"the",
"background",
".",
"In",
"the",
"latter",
"case",
"said",
"error",
"will",
"ra... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L26-L44 | [
"def",
"run_until_disconnected",
"(",
"self",
")",
":",
"if",
"self",
".",
"loop",
".",
"is_running",
"(",
")",
":",
"return",
"self",
".",
"_run_until_disconnected",
"(",
")",
"try",
":",
"return",
"self",
".",
"loop",
".",
"run_until_complete",
"(",
"sel... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UpdateMethods.on | Decorator helper method around `add_event_handler`. Example:
>>> from telethon import TelegramClient, events
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... async def handler(event):
... ...
...
>>>
Args:
... | telethon/client/updates.py | def on(self, event):
"""
Decorator helper method around `add_event_handler`. Example:
>>> from telethon import TelegramClient, events
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... async def handler(event):
... ...
... | def on(self, event):
"""
Decorator helper method around `add_event_handler`. Example:
>>> from telethon import TelegramClient, events
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... async def handler(event):
... ...
... | [
"Decorator",
"helper",
"method",
"around",
"add_event_handler",
".",
"Example",
":"
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L46-L68 | [
"def",
"on",
"(",
"self",
",",
"event",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"self",
".",
"add_event_handler",
"(",
"f",
",",
"event",
")",
"return",
"f",
"return",
"decorator"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UpdateMethods.add_event_handler | Registers the given callback to be called on the specified event.
Args:
callback (`callable`):
The callable function accepting one parameter to be used.
Note that if you have used `telethon.events.register` in
the callback, ``event`` will be ignored,... | telethon/client/updates.py | def add_event_handler(self, callback, event=None):
"""
Registers the given callback to be called on the specified event.
Args:
callback (`callable`):
The callable function accepting one parameter to be used.
Note that if you have used `telethon.event... | def add_event_handler(self, callback, event=None):
"""
Registers the given callback to be called on the specified event.
Args:
callback (`callable`):
The callable function accepting one parameter to be used.
Note that if you have used `telethon.event... | [
"Registers",
"the",
"given",
"callback",
"to",
"be",
"called",
"on",
"the",
"specified",
"event",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L70-L101 | [
"def",
"add_event_handler",
"(",
"self",
",",
"callback",
",",
"event",
"=",
"None",
")",
":",
"builders",
"=",
"events",
".",
"_get_handlers",
"(",
"callback",
")",
"if",
"builders",
"is",
"not",
"None",
":",
"for",
"event",
"in",
"builders",
":",
"self... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UpdateMethods.remove_event_handler | Inverse operation of :meth:`add_event_handler`.
If no event is given, all events for this callback are removed.
Returns how many callbacks were removed. | telethon/client/updates.py | def remove_event_handler(self, callback, event=None):
"""
Inverse operation of :meth:`add_event_handler`.
If no event is given, all events for this callback are removed.
Returns how many callbacks were removed.
"""
found = 0
if event and not isinstance(event, typ... | def remove_event_handler(self, callback, event=None):
"""
Inverse operation of :meth:`add_event_handler`.
If no event is given, all events for this callback are removed.
Returns how many callbacks were removed.
"""
found = 0
if event and not isinstance(event, typ... | [
"Inverse",
"operation",
"of",
":",
"meth",
":",
"add_event_handler",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L103-L122 | [
"def",
"remove_event_handler",
"(",
"self",
",",
"callback",
",",
"event",
"=",
"None",
")",
":",
"found",
"=",
"0",
"if",
"event",
"and",
"not",
"isinstance",
"(",
"event",
",",
"type",
")",
":",
"event",
"=",
"type",
"(",
"event",
")",
"i",
"=",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | UpdateMethods.catch_up | "Catches up" on the missed updates while the client was offline.
You should call this method after registering the event handlers
so that the updates it loads can by processed by your script.
This can also be used to forcibly fetch new updates if there are any. | telethon/client/updates.py | async def catch_up(self):
"""
"Catches up" on the missed updates while the client was offline.
You should call this method after registering the event handlers
so that the updates it loads can by processed by your script.
This can also be used to forcibly fetch new updates if th... | async def catch_up(self):
"""
"Catches up" on the missed updates while the client was offline.
You should call this method after registering the event handlers
so that the updates it loads can by processed by your script.
This can also be used to forcibly fetch new updates if th... | [
"Catches",
"up",
"on",
"the",
"missed",
"updates",
"while",
"the",
"client",
"was",
"offline",
".",
"You",
"should",
"call",
"this",
"method",
"after",
"registering",
"the",
"event",
"handlers",
"so",
"that",
"the",
"updates",
"it",
"loads",
"can",
"by",
"... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/updates.py#L131-L190 | [
"async",
"def",
"catch_up",
"(",
"self",
")",
":",
"pts",
",",
"date",
"=",
"self",
".",
"_state_cache",
"[",
"None",
"]",
"self",
".",
"session",
".",
"catching_up",
"=",
"True",
"try",
":",
"while",
"True",
":",
"d",
"=",
"await",
"self",
"(",
"f... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState.reset | Resets the state. | telethon/network/mtprotostate.py | def reset(self):
"""
Resets the state.
"""
# Session IDs can be random on every connection
self.id = struct.unpack('q', os.urandom(8))[0]
self._sequence = 0
self._last_msg_id = 0 | def reset(self):
"""
Resets the state.
"""
# Session IDs can be random on every connection
self.id = struct.unpack('q', os.urandom(8))[0]
self._sequence = 0
self._last_msg_id = 0 | [
"Resets",
"the",
"state",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L44-L51 | [
"def",
"reset",
"(",
"self",
")",
":",
"# Session IDs can be random on every connection",
"self",
".",
"id",
"=",
"struct",
".",
"unpack",
"(",
"'q'",
",",
"os",
".",
"urandom",
"(",
"8",
")",
")",
"[",
"0",
"]",
"self",
".",
"_sequence",
"=",
"0",
"se... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState._calc_key | Calculate the key based on Telegram guidelines for MTProto 2,
specifying whether it's the client or not. See
https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector | telethon/network/mtprotostate.py | def _calc_key(auth_key, msg_key, client):
"""
Calculate the key based on Telegram guidelines for MTProto 2,
specifying whether it's the client or not. See
https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector
"""
x = 0 if client else 8
... | def _calc_key(auth_key, msg_key, client):
"""
Calculate the key based on Telegram guidelines for MTProto 2,
specifying whether it's the client or not. See
https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector
"""
x = 0 if client else 8
... | [
"Calculate",
"the",
"key",
"based",
"on",
"Telegram",
"guidelines",
"for",
"MTProto",
"2",
"specifying",
"whether",
"it",
"s",
"the",
"client",
"or",
"not",
".",
"See",
"https",
":",
"//",
"core",
".",
"telegram",
".",
"org",
"/",
"mtproto",
"/",
"descri... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L61-L74 | [
"def",
"_calc_key",
"(",
"auth_key",
",",
"msg_key",
",",
"client",
")",
":",
"x",
"=",
"0",
"if",
"client",
"else",
"8",
"sha256a",
"=",
"sha256",
"(",
"msg_key",
"+",
"auth_key",
"[",
"x",
":",
"x",
"+",
"36",
"]",
")",
".",
"digest",
"(",
")",... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState.write_data_as_message | Writes a message containing the given data into buffer.
Returns the message id. | telethon/network/mtprotostate.py | def write_data_as_message(self, buffer, data, content_related,
*, after_id=None):
"""
Writes a message containing the given data into buffer.
Returns the message id.
"""
msg_id = self._get_new_msg_id()
seq_no = self._get_seq_no(content_relat... | def write_data_as_message(self, buffer, data, content_related,
*, after_id=None):
"""
Writes a message containing the given data into buffer.
Returns the message id.
"""
msg_id = self._get_new_msg_id()
seq_no = self._get_seq_no(content_relat... | [
"Writes",
"a",
"message",
"containing",
"the",
"given",
"data",
"into",
"buffer",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L76-L93 | [
"def",
"write_data_as_message",
"(",
"self",
",",
"buffer",
",",
"data",
",",
"content_related",
",",
"*",
",",
"after_id",
"=",
"None",
")",
":",
"msg_id",
"=",
"self",
".",
"_get_new_msg_id",
"(",
")",
"seq_no",
"=",
"self",
".",
"_get_seq_no",
"(",
"c... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState.encrypt_message_data | Encrypts the given message data using the current authorization key
following MTProto 2.0 guidelines core.telegram.org/mtproto/description. | telethon/network/mtprotostate.py | def encrypt_message_data(self, data):
"""
Encrypts the given message data using the current authorization key
following MTProto 2.0 guidelines core.telegram.org/mtproto/description.
"""
data = struct.pack('<qq', self.salt, self.id) + data
padding = os.urandom(-(len(data) ... | def encrypt_message_data(self, data):
"""
Encrypts the given message data using the current authorization key
following MTProto 2.0 guidelines core.telegram.org/mtproto/description.
"""
data = struct.pack('<qq', self.salt, self.id) + data
padding = os.urandom(-(len(data) ... | [
"Encrypts",
"the",
"given",
"message",
"data",
"using",
"the",
"current",
"authorization",
"key",
"following",
"MTProto",
"2",
".",
"0",
"guidelines",
"core",
".",
"telegram",
".",
"org",
"/",
"mtproto",
"/",
"description",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L95-L114 | [
"def",
"encrypt_message_data",
"(",
"self",
",",
"data",
")",
":",
"data",
"=",
"struct",
".",
"pack",
"(",
"'<qq'",
",",
"self",
".",
"salt",
",",
"self",
".",
"id",
")",
"+",
"data",
"padding",
"=",
"os",
".",
"urandom",
"(",
"-",
"(",
"len",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState.decrypt_message_data | Inverse of `encrypt_message_data` for incoming server messages. | telethon/network/mtprotostate.py | def decrypt_message_data(self, body):
"""
Inverse of `encrypt_message_data` for incoming server messages.
"""
if len(body) < 8:
raise InvalidBufferError(body)
# TODO Check salt, session_id and sequence_number
key_id = struct.unpack('<Q', body[:8])[0]
... | def decrypt_message_data(self, body):
"""
Inverse of `encrypt_message_data` for incoming server messages.
"""
if len(body) < 8:
raise InvalidBufferError(body)
# TODO Check salt, session_id and sequence_number
key_id = struct.unpack('<Q', body[:8])[0]
... | [
"Inverse",
"of",
"encrypt_message_data",
"for",
"incoming",
"server",
"messages",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L116-L153 | [
"def",
"decrypt_message_data",
"(",
"self",
",",
"body",
")",
":",
"if",
"len",
"(",
"body",
")",
"<",
"8",
":",
"raise",
"InvalidBufferError",
"(",
"body",
")",
"# TODO Check salt, session_id and sequence_number",
"key_id",
"=",
"struct",
".",
"unpack",
"(",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState._get_new_msg_id | Generates a new unique message ID based on the current
time (in ms) since epoch, applying a known time offset. | telethon/network/mtprotostate.py | def _get_new_msg_id(self):
"""
Generates a new unique message ID based on the current
time (in ms) since epoch, applying a known time offset.
"""
now = time.time() + self.time_offset
nanoseconds = int((now - int(now)) * 1e+9)
new_msg_id = (int(now) << 32) | (nanos... | def _get_new_msg_id(self):
"""
Generates a new unique message ID based on the current
time (in ms) since epoch, applying a known time offset.
"""
now = time.time() + self.time_offset
nanoseconds = int((now - int(now)) * 1e+9)
new_msg_id = (int(now) << 32) | (nanos... | [
"Generates",
"a",
"new",
"unique",
"message",
"ID",
"based",
"on",
"the",
"current",
"time",
"(",
"in",
"ms",
")",
"since",
"epoch",
"applying",
"a",
"known",
"time",
"offset",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L155-L168 | [
"def",
"_get_new_msg_id",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"time_offset",
"nanoseconds",
"=",
"int",
"(",
"(",
"now",
"-",
"int",
"(",
"now",
")",
")",
"*",
"1e+9",
")",
"new_msg_id",
"=",
"(",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState.update_time_offset | Updates the time offset to the correct
one given a known valid message ID. | telethon/network/mtprotostate.py | def update_time_offset(self, correct_msg_id):
"""
Updates the time offset to the correct
one given a known valid message ID.
"""
bad = self._get_new_msg_id()
old = self.time_offset
now = int(time.time())
correct = correct_msg_id >> 32
self.time_of... | def update_time_offset(self, correct_msg_id):
"""
Updates the time offset to the correct
one given a known valid message ID.
"""
bad = self._get_new_msg_id()
old = self.time_offset
now = int(time.time())
correct = correct_msg_id >> 32
self.time_of... | [
"Updates",
"the",
"time",
"offset",
"to",
"the",
"correct",
"one",
"given",
"a",
"known",
"valid",
"message",
"ID",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L170-L189 | [
"def",
"update_time_offset",
"(",
"self",
",",
"correct_msg_id",
")",
":",
"bad",
"=",
"self",
".",
"_get_new_msg_id",
"(",
")",
"old",
"=",
"self",
".",
"time_offset",
"now",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"correct",
"=",
"correc... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoState._get_seq_no | Generates the next sequence number depending on whether
it should be for a content-related query or not. | telethon/network/mtprotostate.py | def _get_seq_no(self, content_related):
"""
Generates the next sequence number depending on whether
it should be for a content-related query or not.
"""
if content_related:
result = self._sequence * 2 + 1
self._sequence += 1
return result
... | def _get_seq_no(self, content_related):
"""
Generates the next sequence number depending on whether
it should be for a content-related query or not.
"""
if content_related:
result = self._sequence * 2 + 1
self._sequence += 1
return result
... | [
"Generates",
"the",
"next",
"sequence",
"number",
"depending",
"on",
"whether",
"it",
"should",
"be",
"for",
"a",
"content",
"-",
"related",
"query",
"or",
"not",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotostate.py#L191-L201 | [
"def",
"_get_seq_no",
"(",
"self",
",",
"content_related",
")",
":",
"if",
"content_related",
":",
"result",
"=",
"self",
".",
"_sequence",
"*",
"2",
"+",
"1",
"self",
".",
"_sequence",
"+=",
"1",
"return",
"result",
"else",
":",
"return",
"self",
".",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | parse_tl | This method yields TLObjects from a given .tl file.
Note that the file is parsed completely before the function yields
because references to other objects may appear later in the file. | telethon_generator/parsers/tlobject/parser.py | def parse_tl(file_path, layer, methods=None, ignored_ids=CORE_TYPES):
"""
This method yields TLObjects from a given .tl file.
Note that the file is parsed completely before the function yields
because references to other objects may appear later in the file.
"""
method_info = {m.name: m for m i... | def parse_tl(file_path, layer, methods=None, ignored_ids=CORE_TYPES):
"""
This method yields TLObjects from a given .tl file.
Note that the file is parsed completely before the function yields
because references to other objects may appear later in the file.
"""
method_info = {m.name: m for m i... | [
"This",
"method",
"yields",
"TLObjects",
"from",
"a",
"given",
".",
"tl",
"file",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_generator/parsers/tlobject/parser.py#L78-L134 | [
"def",
"parse_tl",
"(",
"file_path",
",",
"layer",
",",
"methods",
"=",
"None",
",",
"ignored_ids",
"=",
"CORE_TYPES",
")",
":",
"method_info",
"=",
"{",
"m",
".",
"name",
":",
"m",
"for",
"m",
"in",
"(",
"methods",
"or",
"[",
"]",
")",
"}",
"obj_a... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | find_layer | Finds the layer used on the specified scheme.tl file. | telethon_generator/parsers/tlobject/parser.py | def find_layer(file_path):
"""Finds the layer used on the specified scheme.tl file."""
layer_regex = re.compile(r'^//\s*LAYER\s*(\d+)$')
with file_path.open('r') as file:
for line in file:
match = layer_regex.match(line)
if match:
return int(match.group(1)) | def find_layer(file_path):
"""Finds the layer used on the specified scheme.tl file."""
layer_regex = re.compile(r'^//\s*LAYER\s*(\d+)$')
with file_path.open('r') as file:
for line in file:
match = layer_regex.match(line)
if match:
return int(match.group(1)) | [
"Finds",
"the",
"layer",
"used",
"on",
"the",
"specified",
"scheme",
".",
"tl",
"file",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon_generator/parsers/tlobject/parser.py#L137-L144 | [
"def",
"find_layer",
"(",
"file_path",
")",
":",
"layer_regex",
"=",
"re",
".",
"compile",
"(",
"r'^//\\s*LAYER\\s*(\\d+)$'",
")",
"with",
"file_path",
".",
"open",
"(",
"'r'",
")",
"as",
"file",
":",
"for",
"line",
"in",
"file",
":",
"match",
"=",
"laye... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | InlineResult.url | The URL present in this inline results. If you want to "click"
this URL to open it in your browser, you should use Python's
`webbrowser.open(url)` for such task. | telethon/tl/custom/inlineresult.py | def url(self):
"""
The URL present in this inline results. If you want to "click"
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):
return self.result.url | def url(self):
"""
The URL present in this inline results. If you want to "click"
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):
return self.result.url | [
"The",
"URL",
"present",
"in",
"this",
"inline",
"results",
".",
"If",
"you",
"want",
"to",
"click",
"this",
"URL",
"to",
"open",
"it",
"in",
"your",
"browser",
"you",
"should",
"use",
"Python",
"s",
"webbrowser",
".",
"open",
"(",
"url",
")",
"for",
... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L69-L76 | [
"def",
"url",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
"BotInlineResult",
")",
":",
"return",
"self",
".",
"result",
".",
"url"
] | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | InlineResult.photo | Returns either the :tl:`WebDocument` thumbnail for
normal results or the :tl:`Photo` for media results. | telethon/tl/custom/inlineresult.py | def photo(self):
"""
Returns either the :tl:`WebDocument` thumbnail for
normal results or the :tl:`Photo` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.thumb
elif isinstance(self.result, types.BotInlineMediaResult... | def photo(self):
"""
Returns either the :tl:`WebDocument` thumbnail for
normal results or the :tl:`Photo` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.thumb
elif isinstance(self.result, types.BotInlineMediaResult... | [
"Returns",
"either",
"the",
":",
"tl",
":",
"WebDocument",
"thumbnail",
"for",
"normal",
"results",
"or",
"the",
":",
"tl",
":",
"Photo",
"for",
"media",
"results",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L79-L87 | [
"def",
"photo",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
"BotInlineResult",
")",
":",
"return",
"self",
".",
"result",
".",
"thumb",
"elif",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | InlineResult.document | Returns either the :tl:`WebDocument` content for
normal results or the :tl:`Document` for media results. | telethon/tl/custom/inlineresult.py | def document(self):
"""
Returns either the :tl:`WebDocument` content for
normal results or the :tl:`Document` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.content
elif isinstance(self.result, types.BotInlineMedia... | def document(self):
"""
Returns either the :tl:`WebDocument` content for
normal results or the :tl:`Document` for media results.
"""
if isinstance(self.result, types.BotInlineResult):
return self.result.content
elif isinstance(self.result, types.BotInlineMedia... | [
"Returns",
"either",
"the",
":",
"tl",
":",
"WebDocument",
"content",
"for",
"normal",
"results",
"or",
"the",
":",
"tl",
":",
"Document",
"for",
"media",
"results",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L90-L98 | [
"def",
"document",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
".",
"BotInlineResult",
")",
":",
"return",
"self",
".",
"result",
".",
"content",
"elif",
"isinstance",
"(",
"self",
".",
"result",
",",
"types",
"... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | InlineResult.click | Clicks this result and sends the associated `message`.
Args:
entity (`entity`):
The entity to which the message of this result should be sent.
reply_to (`int` | `Message <telethon.tl.custom.message.Message>`, optional):
If present, the sent message will ... | telethon/tl/custom/inlineresult.py | async def click(self, entity, reply_to=None,
silent=False, clear_draft=False, hide_via=False):
"""
Clicks this result and sends the associated `message`.
Args:
entity (`entity`):
The entity to which the message of this result should be sent.
... | async def click(self, entity, reply_to=None,
silent=False, clear_draft=False, hide_via=False):
"""
Clicks this result and sends the associated `message`.
Args:
entity (`entity`):
The entity to which the message of this result should be sent.
... | [
"Clicks",
"this",
"result",
"and",
"sends",
"the",
"associated",
"message",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L100-L135 | [
"async",
"def",
"click",
"(",
"self",
",",
"entity",
",",
"reply_to",
"=",
"None",
",",
"silent",
"=",
"False",
",",
"clear_draft",
"=",
"False",
",",
"hide_via",
"=",
"False",
")",
":",
"entity",
"=",
"await",
"self",
".",
"_client",
".",
"get_input_e... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | InlineResult.download_media | Downloads the media in this result (if there is a document, the
document will be downloaded; otherwise, the photo will if present).
This is a wrapper around `client.download_media
<telethon.client.downloads.DownloadMethods.download_media>`. | telethon/tl/custom/inlineresult.py | async def download_media(self, *args, **kwargs):
"""
Downloads the media in this result (if there is a document, the
document will be downloaded; otherwise, the photo will if present).
This is a wrapper around `client.download_media
<telethon.client.downloads.DownloadMethods.dow... | async def download_media(self, *args, **kwargs):
"""
Downloads the media in this result (if there is a document, the
document will be downloaded; otherwise, the photo will if present).
This is a wrapper around `client.download_media
<telethon.client.downloads.DownloadMethods.dow... | [
"Downloads",
"the",
"media",
"in",
"this",
"result",
"(",
"if",
"there",
"is",
"a",
"document",
"the",
"document",
"will",
"be",
"downloaded",
";",
"otherwise",
"the",
"photo",
"will",
"if",
"present",
")",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/inlineresult.py#L137-L147 | [
"async",
"def",
"download_media",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"document",
"or",
"self",
".",
"photo",
":",
"return",
"await",
"self",
".",
"_client",
".",
"download_media",
"(",
"self",
".",
"d... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | StateCache.update | Update the state with the given update. | telethon/statecache.py | def update(
self,
update,
*,
channel_id=None,
has_pts=(
types.UpdateNewMessage,
types.UpdateDeleteMessages,
types.UpdateReadHistoryInbox,
types.UpdateReadHistoryOutbox,
types.Updat... | def update(
self,
update,
*,
channel_id=None,
has_pts=(
types.UpdateNewMessage,
types.UpdateDeleteMessages,
types.UpdateReadHistoryInbox,
types.UpdateReadHistoryOutbox,
types.Updat... | [
"Update",
"the",
"state",
"with",
"the",
"given",
"update",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/statecache.py#L25-L89 | [
"def",
"update",
"(",
"self",
",",
"update",
",",
"*",
",",
"channel_id",
"=",
"None",
",",
"has_pts",
"=",
"(",
"types",
".",
"UpdateNewMessage",
",",
"types",
".",
"UpdateDeleteMessages",
",",
"types",
".",
"UpdateReadHistoryInbox",
",",
"types",
".",
"U... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DialogMethods.iter_dialogs | Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people,
groups you have joined, or channels you are subscribed to.
Args:
limit (`int` | `None`):
How many dialogs to be retrieved as maximum. Can ... | telethon/client/dialogs.py | def iter_dialogs(
self, limit=None, *, offset_date=None, offset_id=0,
offset_peer=types.InputPeerEmpty(), ignore_migrated=False
):
"""
Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people,
... | def iter_dialogs(
self, limit=None, *, offset_date=None, offset_id=0,
offset_peer=types.InputPeerEmpty(), ignore_migrated=False
):
"""
Returns an iterator over the dialogs, yielding 'limit' at most.
Dialogs are the open "chats" or conversations with other people,
... | [
"Returns",
"an",
"iterator",
"over",
"the",
"dialogs",
"yielding",
"limit",
"at",
"most",
".",
"Dialogs",
"are",
"the",
"open",
"chats",
"or",
"conversations",
"with",
"other",
"people",
"groups",
"you",
"have",
"joined",
"or",
"channels",
"you",
"are",
"sub... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/dialogs.py#L100-L142 | [
"def",
"iter_dialogs",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"*",
",",
"offset_date",
"=",
"None",
",",
"offset_id",
"=",
"0",
",",
"offset_peer",
"=",
"types",
".",
"InputPeerEmpty",
"(",
")",
",",
"ignore_migrated",
"=",
"False",
")",
":",
"re... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | DialogMethods.conversation | Creates a `Conversation <telethon.tl.custom.conversation.Conversation>`
with the given entity so you can easily send messages and await for
responses or other reactions. Refer to its documentation for more.
Args:
entity (`entity`):
The entity with which a new convers... | telethon/client/dialogs.py | def conversation(
self, entity,
*, timeout=60, total_timeout=None, max_messages=100,
exclusive=True, replies_are_responses=True):
"""
Creates a `Conversation <telethon.tl.custom.conversation.Conversation>`
with the given entity so you can easily send messages ... | def conversation(
self, entity,
*, timeout=60, total_timeout=None, max_messages=100,
exclusive=True, replies_are_responses=True):
"""
Creates a `Conversation <telethon.tl.custom.conversation.Conversation>`
with the given entity so you can easily send messages ... | [
"Creates",
"a",
"Conversation",
"<telethon",
".",
"tl",
".",
"custom",
".",
"conversation",
".",
"Conversation",
">",
"with",
"the",
"given",
"entity",
"so",
"you",
"can",
"easily",
"send",
"messages",
"and",
"await",
"for",
"responses",
"or",
"other",
"reac... | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/client/dialogs.py#L169-L255 | [
"def",
"conversation",
"(",
"self",
",",
"entity",
",",
"*",
",",
"timeout",
"=",
"60",
",",
"total_timeout",
"=",
"None",
",",
"max_messages",
"=",
"100",
",",
"exclusive",
"=",
"True",
",",
"replies_are_responses",
"=",
"True",
")",
":",
"return",
"cus... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
train | MTProtoSender.connect | Connects to the specified given connection using the given auth key. | telethon/network/mtprotosender.py | async def connect(self, connection):
"""
Connects to the specified given connection using the given auth key.
"""
if self._user_connected:
self._log.info('User is already connected!')
return
self._connection = connection
await self._connect()
... | async def connect(self, connection):
"""
Connects to the specified given connection using the given auth key.
"""
if self._user_connected:
self._log.info('User is already connected!')
return
self._connection = connection
await self._connect()
... | [
"Connects",
"to",
"the",
"specified",
"given",
"connection",
"using",
"the",
"given",
"auth",
"key",
"."
] | LonamiWebs/Telethon | python | https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/network/mtprotosender.py#L113-L123 | [
"async",
"def",
"connect",
"(",
"self",
",",
"connection",
")",
":",
"if",
"self",
".",
"_user_connected",
":",
"self",
".",
"_log",
".",
"info",
"(",
"'User is already connected!'",
")",
"return",
"self",
".",
"_connection",
"=",
"connection",
"await",
"sel... | 1ead9757d366b58c1e0567cddb0196e20f1a445f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.