mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 20:50:22 +03:00
Merge ed222a2ff3
into 7bc021bba4
This commit is contained in:
commit
6ff59072cf
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -2,10 +2,10 @@
|
|||
_build/
|
||||
|
||||
# Generated code
|
||||
telethon/tl/functions/
|
||||
telethon/tl/types/
|
||||
telethon/tl/all_tlobjects.py
|
||||
telethon/errors/rpc_error_list.py
|
||||
garry/tl/functions/
|
||||
garry/tl/types/
|
||||
garry/tl/all_tlobjects.py
|
||||
garry/errors/rpc_error_list.py
|
||||
|
||||
# User session
|
||||
*.session
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
include LICENSE
|
||||
include README.rst
|
||||
|
||||
recursive-include telethon *
|
||||
recursive-include garry *
|
||||
|
|
14
README.rst
14
README.rst
|
@ -1,10 +1,10 @@
|
|||
Telethon
|
||||
Garry
|
||||
========
|
||||
.. epigraph::
|
||||
|
||||
⭐️ Thanks **everyone** who has starred the project, it means a lot!
|
||||
|
||||
**Telethon** is Telegram client implementation in **Python 3** which uses
|
||||
**Garry** is Telegram client implementation in **Python 3** which uses
|
||||
the latest available API of Telegram.
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ Installing
|
|||
|
||||
.. code:: sh
|
||||
|
||||
pip3 install telethon
|
||||
pip3 install garry
|
||||
|
||||
|
||||
Creating a client
|
||||
|
@ -30,7 +30,7 @@ Creating a client
|
|||
|
||||
.. code:: python
|
||||
|
||||
from telethon import TelegramClient
|
||||
from garry import TelegramClient
|
||||
|
||||
# These example values won't work. You must get your own api_id and
|
||||
# api_hash from https://my.telegram.org, under API Development.
|
||||
|
@ -48,7 +48,7 @@ Doing stuff
|
|||
|
||||
print(client.get_me().stringify())
|
||||
|
||||
client.send_message('username', 'Hello! Talking to you from Telethon')
|
||||
client.send_message('username', 'Hello! Talking to you from Garry')
|
||||
client.send_file('username', '/home/myself/Pictures/holidays.jpg')
|
||||
|
||||
client.download_profile_photo('me')
|
||||
|
@ -59,7 +59,7 @@ Doing stuff
|
|||
Next steps
|
||||
----------
|
||||
|
||||
Do you like how Telethon looks? Check out
|
||||
`Read The Docs <http://telethon.rtfd.io/>`_
|
||||
Do you like how Garry looks? Check out
|
||||
`Read The Docs <http://garry.rtfd.io/>`_
|
||||
for a more in-depth explanation, with examples,
|
||||
troubleshooting issues, and more useful information.
|
||||
|
|
|
@ -8,10 +8,10 @@ try:
|
|||
except (ImportError, SystemError):
|
||||
from docs_writer import DocsWriter
|
||||
|
||||
# Small trick so importing telethon_generator works
|
||||
# Small trick so importing garry_generator works
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from telethon_generator.parser import TLParser, TLObject
|
||||
from garry_generator.parser import TLParser, TLObject
|
||||
|
||||
|
||||
# TLObject -> Python class name
|
||||
|
@ -54,7 +54,7 @@ def get_import_code(tlobject):
|
|||
kind = 'functions' if tlobject.is_function else 'types'
|
||||
ns = '.' + tlobject.namespace if tlobject.namespace else ''
|
||||
|
||||
return 'from telethon.tl.{}{} import {}'\
|
||||
return 'from garry.tl.{}{} import {}'\
|
||||
.format(kind, ns, get_class_name(tlobject))
|
||||
|
||||
|
||||
|
@ -601,7 +601,7 @@ if __name__ == '__main__':
|
|||
os.makedirs('generated', exist_ok=True)
|
||||
os.chdir('generated')
|
||||
try:
|
||||
generate_documentation('../../telethon_generator/scheme.tl')
|
||||
generate_documentation('../../garry_generator/scheme.tl')
|
||||
copy_resources()
|
||||
finally:
|
||||
os.chdir(os.pardir)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>Oopsie! | Telethon</title>
|
||||
<title>Oopsie! | Garry</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Telethon API</title>
|
||||
<title>Garry API</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="css/docs.css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro" rel="stylesheet">
|
||||
|
@ -15,7 +15,7 @@
|
|||
<body>
|
||||
<div id="main_div">
|
||||
<noscript>Please enable JavaScript if you would like to use search.</noscript>
|
||||
<h1>Telethon API</h1>
|
||||
<h1>Garry API</h1>
|
||||
<p>This documentation was generated straight from the <code>scheme.tl</code>
|
||||
provided by Telegram. However, there is no official documentation per se
|
||||
on what the methods, constructors and types mean. Nevertheless, this
|
||||
|
@ -29,7 +29,7 @@ users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User></pre>
|
|||
<p>This is <b>not</b> Python code. It's the "TL definition". It's
|
||||
an easy-to-read line that gives a quick overview on the parameters
|
||||
and its result. You don't need to worry about this. See
|
||||
<a href="http://telethon.readthedocs.io/en/latest/extra/developing/understanding-the-type-language.html">here</a>
|
||||
<a href="http://garry.readthedocs.io/en/latest/extra/developing/understanding-the-type-language.html">here</a>
|
||||
for more details on it.</p>
|
||||
|
||||
<h3>Index</h3>
|
||||
|
@ -141,7 +141,7 @@ users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User></pre>
|
|||
|
||||
<h3 id="example">Full example</h3>
|
||||
<p>Documentation for this is now
|
||||
<a href="http://telethon.readthedocs.io/en/latest/extra/advanced-usage/accessing-the-full-api.html">here</a>.
|
||||
<a href="http://garry.readthedocs.io/en/latest/extra/advanced-usage/accessing-the-full-api.html">here</a>.
|
||||
</p>
|
||||
</div>
|
||||
<script src="js/search.js"></script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
This module holds all the base and automatically generated errors that the
|
||||
Telegram API has. See telethon_generator/errors.json for more.
|
||||
Telegram API has. See garry_generator/errors.json for more.
|
||||
"""
|
||||
import urllib.request
|
||||
import re
|
|
@ -3,9 +3,9 @@ import os
|
|||
import struct
|
||||
from hashlib import sha1, sha256
|
||||
|
||||
from telethon.crypto import AES
|
||||
from telethon.errors import SecurityError
|
||||
from telethon.extensions import BinaryReader
|
||||
from garry.crypto import AES
|
||||
from garry.errors import SecurityError
|
||||
from garry.extensions import BinaryReader
|
||||
|
||||
|
||||
# region Multiple utilities
|
|
@ -83,7 +83,7 @@ class TelegramBareClient:
|
|||
if not api_id or not api_hash:
|
||||
raise ValueError(
|
||||
"Your API ID or Hash cannot be empty or None. "
|
||||
"Refer to telethon.rtfd.io for more information.")
|
||||
"Refer to garry.rtfd.io for more information.")
|
||||
|
||||
self._use_ipv6 = use_ipv6
|
||||
|
|
@ -97,7 +97,7 @@ class TelegramClient(TelegramBareClient):
|
|||
Initializes the Telegram client with the specified API ID and Hash.
|
||||
|
||||
Args:
|
||||
session (`str` | `telethon.sessions.abstract.Session`, `None`):
|
||||
session (`str` | `garry.sessions.abstract.Session`, `None`):
|
||||
The file name of the session file to be used if a string is
|
||||
given (it may be a full path), or the Session instance to be
|
||||
used otherwise. If it's ``None``, the session will not be saved,
|
||||
|
@ -549,7 +549,7 @@ class TelegramClient(TelegramBareClient):
|
|||
A single-item list to pass the total parameter by reference.
|
||||
|
||||
Yields:
|
||||
Instances of `telethon.tl.custom.dialog.Dialog`.
|
||||
Instances of `garry.tl.custom.dialog.Dialog`.
|
||||
"""
|
||||
limit = float('inf') if limit is None else int(limit)
|
||||
if limit == 0:
|
||||
|
@ -617,9 +617,9 @@ class TelegramClient(TelegramBareClient):
|
|||
"""
|
||||
Iterator over all open draft messages.
|
||||
|
||||
Instances of `telethon.tl.custom.draft.Draft` are yielded.
|
||||
You can call `telethon.tl.custom.draft.Draft.set_message`
|
||||
to change the message or `telethon.tl.custom.draft.Draft.delete`
|
||||
Instances of `garry.tl.custom.draft.Draft` are yielded.
|
||||
You can call `garry.tl.custom.draft.Draft.set_message`
|
||||
to change the message or `garry.tl.custom.draft.Draft.delete`
|
||||
among other things.
|
||||
"""
|
||||
for update in self(GetAllDraftsRequest()).updates:
|
||||
|
@ -2275,7 +2275,7 @@ class TelegramClient(TelegramBareClient):
|
|||
warnings.warn(
|
||||
'add_update_handler is deprecated, use the @client.on syntax '
|
||||
'or add_event_handler(callback, events.Raw) instead (see '
|
||||
'https://telethon.rtfd.io/en/latest/extra/basic/working-'
|
||||
'https://garry.rtfd.io/en/latest/extra/basic/working-'
|
||||
'with-updates.html)'
|
||||
)
|
||||
return self.add_event_handler(handler, events.Raw)
|
|
@ -46,7 +46,7 @@ class Dialog:
|
|||
How many mentions are currently unread in this dialog. Note that
|
||||
this value won't update when new messages arrive.
|
||||
|
||||
draft (`telethon.tl.custom.draft.Draft`):
|
||||
draft (`garry.tl.custom.draft.Draft`):
|
||||
The draft object in this dialog. It will not be ``None``,
|
||||
so you can call ``draft.set_message(...)``.
|
||||
"""
|
|
@ -1,11 +1,11 @@
|
|||
import os
|
||||
from getpass import getpass
|
||||
|
||||
from telethon.utils import get_display_name
|
||||
from garry.utils import get_display_name
|
||||
|
||||
from telethon import ConnectionMode, TelegramClient
|
||||
from telethon.errors import SessionPasswordNeededError
|
||||
from telethon.tl.types import (
|
||||
from garry import ConnectionMode, TelegramClient
|
||||
from garry.errors import SessionPasswordNeededError
|
||||
from garry.tl.types import (
|
||||
PeerChat, UpdateShortChatMessage, UpdateShortMessage
|
||||
)
|
||||
|
||||
|
@ -42,10 +42,10 @@ def bytes_to_string(byte_count):
|
|||
|
||||
class InteractiveTelegramClient(TelegramClient):
|
||||
"""Full featured Telegram client, meant to be used on an interactive
|
||||
session to see what Telethon is capable off -
|
||||
session to see what Garry is capable off -
|
||||
|
||||
This client allows the user to perform some basic interaction with
|
||||
Telegram through Telethon, such as listing dialogs (open chats),
|
||||
Telegram through Garry, such as listing dialogs (open chats),
|
||||
talking to people, downloading media, and receiving updates.
|
||||
"""
|
||||
|
|
@ -6,7 +6,7 @@ from os import environ
|
|||
# environ is used to get API information from environment variables
|
||||
# You could also use a config file, pass them as arguments,
|
||||
# or even hardcode them (not recommended)
|
||||
from telethon import TelegramClient
|
||||
from garry import TelegramClient
|
||||
|
||||
|
||||
def main():
|
|
@ -14,7 +14,7 @@ from collections import defaultdict
|
|||
from datetime import datetime, timedelta
|
||||
from os import environ
|
||||
|
||||
from telethon import TelegramClient, events, utils
|
||||
from garry import TelegramClient, events, utils
|
||||
|
||||
"""Uncomment this for debugging
|
||||
import logging
|
|
@ -109,16 +109,16 @@ def generate_code(output, json_file, errors_desc):
|
|||
(e, get_class_name(e)) for e in errors if e not in known_base_classes
|
||||
]
|
||||
|
||||
# Prefer the descriptions that are related with Telethon way of coding to
|
||||
# Prefer the descriptions that are related with Garry way of coding to
|
||||
# those that PWRTelegram's API provides.
|
||||
telethon_descriptions = {}
|
||||
garry_descriptions = {}
|
||||
with open(errors_desc, encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line and not line.startswith('#'):
|
||||
equal = line.index('=')
|
||||
message, description = line[:equal], line[equal + 1:]
|
||||
telethon_descriptions[message.rstrip()] = description.lstrip()
|
||||
garry_descriptions[message.rstrip()] = description.lstrip()
|
||||
|
||||
# Names for the captures, or 'x' if unknown
|
||||
capture_names = {
|
||||
|
@ -145,7 +145,7 @@ def generate_code(output, json_file, errors_desc):
|
|||
patterns = [] # Save this dictionary later in the generated code
|
||||
for error_code, error_set in errors.items():
|
||||
for error in sorted(error_set):
|
||||
description = telethon_descriptions.get(
|
||||
description = garry_descriptions.get(
|
||||
error, '\n'.join(data['human_result'].get(
|
||||
error, ['No description known.']
|
||||
))
|
||||
|
@ -171,7 +171,7 @@ def generate_code(output, json_file, errors_desc):
|
|||
|
||||
if __name__ == '__main__':
|
||||
if input('generate (y/n)?: ').lower() == 'y':
|
||||
generate_code('../telethon/errors/rpc_error_list.py',
|
||||
generate_code('../garry/errors/rpc_error_list.py',
|
||||
'errors.json', 'error_descriptions')
|
||||
elif input('fetch (y/n)?: ').lower() == 'y':
|
||||
fetch_errors('errors.json')
|
|
@ -1,8 +1,8 @@
|
|||
import unittest
|
||||
from hashlib import sha1
|
||||
|
||||
import telethon.helpers as utils
|
||||
from telethon.crypto import AES, Factorization
|
||||
import garry.helpers as utils
|
||||
from garry.crypto import AES, Factorization
|
||||
# from crypto.PublicKey import RSA as PyCryptoRSA
|
||||
|
||||
|
|
@ -3,7 +3,7 @@ import os
|
|||
from io import BytesIO
|
||||
from random import randint
|
||||
from hashlib import sha256
|
||||
from telethon import TelegramClient
|
||||
from garry import TelegramClient
|
||||
|
||||
# Fill in your api_id and api_hash when running the tests
|
||||
# and REMOVE THEM once you've finished testing them.
|
|
@ -3,9 +3,9 @@ import socket
|
|||
import threading
|
||||
import unittest
|
||||
|
||||
import telethon.network.authenticator as authenticator
|
||||
from telethon.extensions import TcpClient
|
||||
from telethon.network import Connection
|
||||
import garry.network.authenticator as authenticator
|
||||
from garry.extensions import TcpClient
|
||||
from garry.network import Connection
|
||||
|
||||
|
||||
def run_server_echo_thread(port):
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import unittest
|
||||
from telethon.tl import TLObject
|
||||
from telethon.extensions import BinaryReader
|
||||
from garry.tl import TLObject
|
||||
from garry.extensions import BinaryReader
|
||||
|
||||
|
||||
class UtilsTests(unittest.TestCase):
|
|
@ -4,7 +4,7 @@
|
|||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SPHINXPROJ = Telethon
|
||||
SPHINXPROJ = Garry
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Telethon documentation build configuration file, created by
|
||||
# Garry documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Nov 17 15:36:11 2017.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
|
@ -25,7 +25,7 @@ sys.path.insert(0, os.path.abspath('.'))
|
|||
|
||||
root = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir))
|
||||
|
||||
tl_ref_url = 'https://lonamiwebs.github.io/Telethon'
|
||||
tl_ref_url = 'https://lonamiwebs.github.io/Garry'
|
||||
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
@ -58,7 +58,7 @@ source_suffix = '.rst'
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'Telethon'
|
||||
project = 'Garry'
|
||||
copyright = '2017, Lonami'
|
||||
author = 'Lonami'
|
||||
|
||||
|
@ -67,7 +67,7 @@ author = 'Lonami'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
with open(os.path.join(root, 'telethon', 'version.py')) as f:
|
||||
with open(os.path.join(root, 'garry', 'version.py')) as f:
|
||||
version = re.search(r"^__version__\s+=\s+'(.*)'$",
|
||||
f.read(), flags=re.MULTILINE).group(1)
|
||||
|
||||
|
@ -132,7 +132,7 @@ html_sidebars = {
|
|||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'Telethondoc'
|
||||
htmlhelp_basename = 'Garrydoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
@ -159,7 +159,7 @@ latex_elements = {
|
|||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'Telethon.tex', 'Telethon Documentation',
|
||||
(master_doc, 'Garry.tex', 'Garry Documentation',
|
||||
author, 'manual'),
|
||||
]
|
||||
|
||||
|
@ -169,7 +169,7 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'telethon', 'Telethon Documentation',
|
||||
(master_doc, 'garry', 'Garry Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
|
@ -180,8 +180,8 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'Telethon', 'Telethon Documentation',
|
||||
author, 'Telethon', 'One line description of project.',
|
||||
(master_doc, 'Garry', 'Garry Documentation',
|
||||
author, 'Garry', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ through a sorted list of everything you can do.
|
|||
|
||||
.. note::
|
||||
|
||||
The reason to keep both https://lonamiwebs.github.io/Telethon and this
|
||||
The reason to keep both https://lonamiwebs.github.io/Garry and this
|
||||
documentation alive is that the former allows instant search results
|
||||
as you type, and a "Copy import" button. If you like namespaces, you
|
||||
can also do ``from telethon.tl import types, functions``. Both work.
|
||||
can also do ``from garry.tl import types, functions``. Both work.
|
||||
|
||||
|
||||
You should also refer to the documentation to see what the objects
|
||||
|
@ -35,13 +35,13 @@ clipboard", or your script won't be aware of this class! Now we have:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.messages import SendMessageRequest
|
||||
from garry.tl.functions.messages import SendMessageRequest
|
||||
|
||||
If you're going to use a lot of these, you may do:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl import types, functions
|
||||
from garry.tl import types, functions
|
||||
# We now have access to 'functions.messages.SendMessageRequest'
|
||||
|
||||
We see that this request must take at least two parameters, a ``peer``
|
||||
|
@ -53,7 +53,7 @@ construct one, for instance:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.types import InputPeerUser
|
||||
from garry.tl.types import InputPeerUser
|
||||
|
||||
peer = InputPeerUser(user_id, user_hash)
|
||||
|
||||
|
@ -81,7 +81,7 @@ every time its used, simply call ``.get_input_peer``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import utils
|
||||
from garry import utils
|
||||
peer = utils.get_input_user(entity)
|
||||
|
||||
|
||||
|
@ -135,6 +135,6 @@ This can further be simplified to:
|
|||
though, for instance, in "messages.search" it will actually return 0 items.
|
||||
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/index.html
|
||||
__ https://lonamiwebs.github.io/Telethon/?q=message
|
||||
__ https://lonamiwebs.github.io/Garry
|
||||
__ https://lonamiwebs.github.io/Garry/methods/index.html
|
||||
__ https://lonamiwebs.github.io/Garry/?q=message
|
||||
|
|
|
@ -36,15 +36,15 @@ one of the other implementations or implement your own storage.
|
|||
To use a custom session storage, simply pass the custom session instance to
|
||||
``TelegramClient`` instead of the session name.
|
||||
|
||||
Telethon contains two implementations of the abstract ``Session`` class:
|
||||
Garry contains two implementations of the abstract ``Session`` class:
|
||||
|
||||
* ``MemorySession``: stores session data in Python variables.
|
||||
* ``SQLiteSession``, (default): stores sessions in their own SQLite databases.
|
||||
|
||||
There are other community-maintained implementations available:
|
||||
|
||||
* `SQLAlchemy <https://github.com/tulir/telethon-session-sqlalchemy>`_: stores all sessions in a single database via SQLAlchemy.
|
||||
* `Redis <https://github.com/ezdev128/telethon-session-redis>`_: stores all sessions in a single Redis data store.
|
||||
* `SQLAlchemy <https://github.com/tulir/garry-session-sqlalchemy>`_: stores all sessions in a single database via SQLAlchemy.
|
||||
* `Redis <https://github.com/ezdev128/garry-session-redis>`_: stores all sessions in a single Redis data store.
|
||||
|
||||
Creating your own storage
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -52,7 +52,7 @@ Creating your own storage
|
|||
The easiest way to create your own storage implementation is to use ``MemorySession``
|
||||
as the base and check out how ``SQLiteSession`` or one of the community-maintained
|
||||
implementations work. You can find the relevant Python files under the ``sessions``
|
||||
directory in Telethon.
|
||||
directory in Garry.
|
||||
|
||||
After you have made your own implementation, you can add it to the community-maintained
|
||||
session implementation list above with a pull request.
|
||||
|
|
|
@ -49,7 +49,7 @@ let's reply to them with the same text reversed:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.types import UpdateShortMessage, PeerUser
|
||||
from garry.tl.types import UpdateShortMessage, PeerUser
|
||||
|
||||
def replier(update):
|
||||
if isinstance(update, UpdateShortMessage) and not update.out:
|
||||
|
@ -140,5 +140,5 @@ As a complete example:
|
|||
|
||||
This is the preferred way to use if you're simply going to listen for updates.
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon/types/update.html
|
||||
__ https://lonamiwebs.github.io/Garry/types/update.html
|
||||
__ https://github.com/python-telegram-bot/python-telegram-bot/blob/4b3315db6feebafb94edcaa803df52bb49999ced/telegram/ext/updater.py#L460
|
||||
|
|
|
@ -26,7 +26,7 @@ one is very simple:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import TelegramClient
|
||||
from garry import TelegramClient
|
||||
|
||||
# Use your own values here
|
||||
api_id = 12345
|
||||
|
@ -58,7 +58,7 @@ If you're not authorized, you need to ``.sign_in()``:
|
|||
myself = client.sign_in(phone_number, input('Enter code: '))
|
||||
# If .sign_in raises PhoneNumberUnoccupiedError, use .sign_up instead
|
||||
# If .sign_in raises SessionPasswordNeeded error, call .sign_in(password=...)
|
||||
# You can import both exceptions from telethon.errors.
|
||||
# You can import both exceptions from garry.errors.
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -130,14 +130,14 @@ Two Factor Authorization (2FA)
|
|||
******************************
|
||||
|
||||
If you have Two Factor Authorization (from now on, 2FA) enabled on your
|
||||
account, calling :meth:`telethon.TelegramClient.sign_in` will raise a
|
||||
account, calling :meth:`garry.TelegramClient.sign_in` will raise a
|
||||
``SessionPasswordNeededError``. When this happens, just
|
||||
:meth:`telethon.TelegramClient.sign_in` again with a ``password=``:
|
||||
:meth:`garry.TelegramClient.sign_in` again with a ``password=``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import getpass
|
||||
from telethon.errors import SessionPasswordNeededError
|
||||
from garry.errors import SessionPasswordNeededError
|
||||
|
||||
client.sign_in(phone)
|
||||
try:
|
||||
|
@ -160,7 +160,7 @@ See the examples below:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.errors import EmailUnconfirmedError
|
||||
from garry.errors import EmailUnconfirmedError
|
||||
|
||||
# Sets 2FA password for first time:
|
||||
client.edit_2fa(new_password='supersecurepassword')
|
||||
|
|
|
@ -49,7 +49,7 @@ you're able to just do this:
|
|||
|
||||
# You can be more explicit about the type for said ID by wrapping
|
||||
# it inside a Peer instance. This is recommended but not necessary.
|
||||
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
|
||||
from garry.tl.types import PeerUser, PeerChat, PeerChannel
|
||||
|
||||
my_user = client.get_entity(PeerUser(some_id))
|
||||
my_chat = client.get_entity(PeerChat(some_id))
|
||||
|
|
|
@ -9,7 +9,7 @@ Getting Started
|
|||
Simple Installation
|
||||
*******************
|
||||
|
||||
``pip3 install telethon``
|
||||
``pip3 install garry``
|
||||
|
||||
**More details**: :ref:`installation`
|
||||
|
||||
|
@ -19,7 +19,7 @@ Creating a client
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import TelegramClient
|
||||
from garry import TelegramClient
|
||||
|
||||
# These example values won't work. You must get your own api_id and
|
||||
# api_hash from https://my.telegram.org, under API Development.
|
||||
|
@ -41,13 +41,13 @@ Basic Usage
|
|||
print(client.get_me().stringify())
|
||||
|
||||
# Sending a message (you can use 'me' or 'self' to message yourself)
|
||||
client.send_message('username', 'Hello World from Telethon!')
|
||||
client.send_message('username', 'Hello World from Garry!')
|
||||
|
||||
# Sending a file
|
||||
client.send_file('username', '/home/myself/Pictures/holidays.jpg')
|
||||
|
||||
# Retrieving messages from a chat
|
||||
from telethon import utils
|
||||
from garry import utils
|
||||
for message in client.get_message_history('username', limit=10):
|
||||
print(utils.get_display_name(message.sender), message.message)
|
||||
|
||||
|
@ -71,7 +71,7 @@ Handling Updates
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import events
|
||||
from garry import events
|
||||
|
||||
# We need to have some worker running
|
||||
client.updates.workers = 1
|
||||
|
|
|
@ -8,25 +8,25 @@ Installation
|
|||
Automatic Installation
|
||||
**********************
|
||||
|
||||
To install Telethon, simply do:
|
||||
To install Garry, simply do:
|
||||
|
||||
``pip3 install telethon``
|
||||
``pip3 install garry``
|
||||
|
||||
Needless to say, you must have Python 3 and PyPi installed in your system.
|
||||
See https://python.org and https://pypi.python.org/pypi/pip for more.
|
||||
|
||||
If you already have the library installed, upgrade with:
|
||||
|
||||
``pip3 install --upgrade telethon``
|
||||
``pip3 install --upgrade garry``
|
||||
|
||||
You can also install the library directly from GitHub or a fork:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
# pip3 install git+https://github.com/LonamiWebs/Telethon.git
|
||||
# pip3 install git+https://github.com/LonamiWebs/Garry.git
|
||||
or
|
||||
$ git clone https://github.com/LonamiWebs/Telethon.git
|
||||
$ cd Telethon/
|
||||
$ git clone https://github.com/LonamiWebs/Garry.git
|
||||
$ cd Garry/
|
||||
# pip install -Ue .
|
||||
|
||||
If you don't have root access, simply pass the ``--user`` flag to the pip
|
||||
|
@ -38,7 +38,7 @@ which can be really slow when uploading or downloading files. If you don't
|
|||
mind using a C extension, install `cryptg <https://github.com/Lonami/cryptg>`__
|
||||
via ``pip`` or as an extra:
|
||||
|
||||
``pip3 install telethon[cryptg]``
|
||||
``pip3 install garry[cryptg]``
|
||||
|
||||
|
||||
Manual Installation
|
||||
|
@ -49,10 +49,10 @@ Manual Installation
|
|||
|
||||
``sudo -H pip3 install pyaes rsa``
|
||||
|
||||
2. Clone Telethon's GitHub repository:
|
||||
``git clone https://github.com/LonamiWebs/Telethon.git``
|
||||
2. Clone Garry's GitHub repository:
|
||||
``git clone https://github.com/LonamiWebs/Garry.git``
|
||||
|
||||
3. Enter the cloned repository: ``cd Telethon``
|
||||
3. Enter the cloned repository: ``cd Garry``
|
||||
|
||||
4. Run the code generator: ``python3 setup.py gen_tl``
|
||||
|
||||
|
@ -75,5 +75,5 @@ __ https://github.com/ricmoo/pyaes
|
|||
__ https://pypi.python.org/pypi/pyaes
|
||||
__ https://github.com/sybrenstuvel/python-rsa
|
||||
__ https://pypi.python.org/pypi/rsa/3.4.2
|
||||
__ https://lonamiwebs.github.io/Telethon
|
||||
__ https://lonamiwebs.github.io/Garry
|
||||
__ https://github.com/Lonami/cryptg
|
||||
|
|
|
@ -10,7 +10,7 @@ Introduction
|
|||
|
||||
.. note::
|
||||
|
||||
Check the :ref:`telethon-package` if you're looking for the methods
|
||||
Check the :ref:`garry-package` if you're looking for the methods
|
||||
reference instead of this tutorial.
|
||||
|
||||
The ``TelegramClient`` is the central class of the library, the one
|
||||
|
@ -56,12 +56,12 @@ Many other common methods for quick scripts are also available:
|
|||
.. code-block:: python
|
||||
|
||||
# Note that you can use 'me' or 'self' to message yourself
|
||||
client.send_message('username', 'Hello World from Telethon!')
|
||||
client.send_message('username', 'Hello World from Garry!')
|
||||
|
||||
client.send_file('username', '/home/myself/Pictures/holidays.jpg')
|
||||
|
||||
# The utils package has some goodies, like .get_display_name()
|
||||
from telethon import utils
|
||||
from garry import utils
|
||||
for message in client.get_message_history('username', limit=10):
|
||||
print(utils.get_display_name(message.sender), message.message)
|
||||
|
||||
|
@ -91,7 +91,7 @@ Please refer to :ref:`accessing-the-full-api` if these aren't enough,
|
|||
and don't be afraid to read the source code of the InteractiveTelegramClient_
|
||||
or even the TelegramClient_ itself to learn how it works.
|
||||
|
||||
To see the methods available in the client, see :ref:`telethon-package`.
|
||||
To see the methods available in the client, see :ref:`garry-package`.
|
||||
|
||||
.. _InteractiveTelegramClient: https://github.com/LonamiWebs/Telethon/blob/master/telethon_examples/interactive_telegram_client.py
|
||||
.. _TelegramClient: https://github.com/LonamiWebs/Telethon/blob/master/telethon/telegram_client.py
|
||||
.. _InteractiveTelegramClient: https://github.com/LonamiWebs/Garry/blob/master/garry_examples/interactive_telegram_client.py
|
||||
.. _TelegramClient: https://github.com/LonamiWebs/Garry/blob/master/garry/telegram_client.py
|
||||
|
|
|
@ -8,7 +8,7 @@ Working with Updates
|
|||
The library comes with the :mod:`events` module. *Events* are an abstraction
|
||||
over what Telegram calls `updates`__, and are meant to ease simple and common
|
||||
usage when dealing with them, since there are many updates. If you're looking
|
||||
for the method reference, check :ref:`telethon-events-package`, otherwise,
|
||||
for the method reference, check :ref:`garry-events-package`, otherwise,
|
||||
let's dive in!
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ Getting Started
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import TelegramClient, events
|
||||
from garry import TelegramClient, events
|
||||
|
||||
client = TelegramClient(..., update_workers=1, spawn_read_thread=False)
|
||||
client.start()
|
||||
|
@ -47,7 +47,7 @@ Not much, but there might be some things unclear. What does this code do?
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import TelegramClient, events
|
||||
from garry import TelegramClient, events
|
||||
|
||||
client = TelegramClient(..., update_workers=1, spawn_read_thread=False)
|
||||
client.start()
|
||||
|
@ -118,14 +118,14 @@ for example:
|
|||
|
||||
# Either a single item or a list of them will work for the chats.
|
||||
# You can also use the IDs, Peers, or even User/Chat/Channel objects.
|
||||
@client.on(events.NewMessage(chats=('TelethonChat', 'TelethonOffTopic')))
|
||||
@client.on(events.NewMessage(chats=('GarryChat', 'GarryOffTopic')))
|
||||
def normal_handler(event):
|
||||
if 'roll' in event.raw_text:
|
||||
event.reply(str(random.randint(1, 6)))
|
||||
|
||||
|
||||
# Similarly, you can use incoming=True for messages that you receive
|
||||
@client.on(events.NewMessage(chats='TelethonOffTopic', outgoing=True))
|
||||
@client.on(events.NewMessage(chats='GarryOffTopic', outgoing=True))
|
||||
def admin_handler(event):
|
||||
if event.raw_text.startswith('eval'):
|
||||
expression = event.raw_text.replace('eval', '').strip()
|
||||
|
@ -164,7 +164,7 @@ propagation of the update through your handlers to stop:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.events import StopPropagation
|
||||
from garry.events import StopPropagation
|
||||
|
||||
@client.on(events.NewMessage)
|
||||
def _(event):
|
||||
|
@ -181,8 +181,8 @@ propagation of the update through your handlers to stop:
|
|||
pass
|
||||
|
||||
|
||||
Remember to check :ref:`telethon-events-package` if you're looking for
|
||||
Remember to check :ref:`garry-events-package` if you're looking for
|
||||
the methods reference.
|
||||
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon/types/update.html
|
||||
__ https://lonamiwebs.github.io/Garry/types/update.html
|
||||
|
|
|
@ -284,7 +284,7 @@ Updates as Events (v0.17.1)
|
|||
|
||||
Of course there was more work to be done regarding updates, and it's here!
|
||||
The library comes with a new ``events`` module (which you will often import
|
||||
as ``from telethon import TelegramClient, events``). This are pretty much
|
||||
as ``from garry import TelegramClient, events``). This are pretty much
|
||||
all the additions that come with this version change, but they are a nice
|
||||
addition. Refer to :ref:`working-with-updates` to get started with events.
|
||||
|
||||
|
@ -319,7 +319,7 @@ Enhancements
|
|||
- ``client.send_file()`` now accepts ``Message``'s and
|
||||
``MessageMedia``'s as the ``file`` parameter.
|
||||
- Some documentation updates and fixed to clarify certain things.
|
||||
- New exact match feature on https://lonamiwebs.github.io/Telethon.
|
||||
- New exact match feature on https://lonamiwebs.github.io/Garry.
|
||||
- Return as early as possible from ``.get_input_entity()`` and similar,
|
||||
to avoid penalizing you for doing this right.
|
||||
|
||||
|
@ -512,7 +512,7 @@ It's here, it has come! The library now **supports IPv6**! Just pass
|
|||
``use_ipv6=True`` when creating a ``TelegramClient``. Note that I could
|
||||
*not* test this feature because my machine doesn't have IPv6 setup. If
|
||||
you know IPv6 works in your machine but the library doesn't, please
|
||||
refer to `#425 <https://github.com/LonamiWebs/Telethon/issues/425>`_.
|
||||
refer to `#425 <https://github.com/LonamiWebs/Garry/issues/425>`_.
|
||||
|
||||
Additions
|
||||
~~~~~~~~~
|
||||
|
@ -615,11 +615,11 @@ things again! A lot of updates were being dropped (all those gzipped),
|
|||
and this has been fixed too.
|
||||
|
||||
More bug fixes include a `correct
|
||||
parsing <https://github.com/LonamiWebs/Telethon/commit/ee01724cdb7027c1e38625d31446ba1ea7bade92>`__
|
||||
parsing <https://github.com/LonamiWebs/Garry/commit/ee01724cdb7027c1e38625d31446ba1ea7bade92>`__
|
||||
of certain TLObjects thanks to @stek29, and
|
||||
`some <https://github.com/LonamiWebs/Telethon/commit/ed77ba6f8ff115ac624f02f691c9991e5b37be60>`__
|
||||
`some <https://github.com/LonamiWebs/Garry/commit/ed77ba6f8ff115ac624f02f691c9991e5b37be60>`__
|
||||
`wrong
|
||||
calls <https://github.com/LonamiWebs/Telethon/commit/16cf94c9add5e94d70c4eee2ac142d8e76af48b9>`__
|
||||
calls <https://github.com/LonamiWebs/Garry/commit/16cf94c9add5e94d70c4eee2ac142d8e76af48b9>`__
|
||||
that would cause the library to crash thanks to @andr-04, and the
|
||||
``ReadThread`` not re-starting if you were already authorized.
|
||||
|
||||
|
@ -684,7 +684,7 @@ Custom Entity Database (v0.15.1)
|
|||
|
||||
*Published at 2017/10/05*
|
||||
|
||||
The main feature of this release is that Telethon now has a custom
|
||||
The main feature of this release is that Garry now has a custom
|
||||
database for all the entities you encounter, instead depending on
|
||||
``@lru_cache`` on the ``.get_entity()`` method.
|
||||
|
||||
|
@ -803,7 +803,7 @@ Internal changes
|
|||
|
||||
**[1]:** Broken due to a condition which should had been the opposite
|
||||
(sigh), fixed 4 commits ahead on
|
||||
https://github.com/LonamiWebs/Telethon/commit/62ea77cbeac7c42bfac85aa8766a1b5b35e3a76c.
|
||||
https://github.com/LonamiWebs/Garry/commit/62ea77cbeac7c42bfac85aa8766a1b5b35e3a76c.
|
||||
|
||||
--------------
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ This update brings a new way to work with updates, and it's begging for
|
|||
your **feedback**, or better names or ways to do what you can do now.
|
||||
|
||||
Please refer to the `wiki/Usage
|
||||
Modes <https://github.com/LonamiWebs/Telethon/wiki/Usage-Modes>`__ for
|
||||
Modes <https://github.com/LonamiWebs/Garry/wiki/Usage-Modes>`__ for
|
||||
an in-depth description on how to work with updates now. Notice that you
|
||||
cannot invoke requests from within handlers anymore, only the
|
||||
``v.0.13.1`` patch allowed you to do so.
|
||||
|
@ -1114,7 +1114,7 @@ Connection modes (v0.13)
|
|||
|
||||
The purpose of this release is to denote a big change, now you can
|
||||
connect to Telegram through different `**connection
|
||||
modes** <https://github.com/LonamiWebs/Telethon/blob/v0.13/telethon/network/connection.py>`__.
|
||||
modes** <https://github.com/LonamiWebs/Garry/blob/v0.13/garry/network/connection.py>`__.
|
||||
Also, a **second thread** will *always* be started when you connect a
|
||||
``TelegramClient``, despite whether you'll be handling updates or
|
||||
ignoring them, whose sole purpose is to constantly read from the
|
||||
|
@ -1176,7 +1176,7 @@ Besides this. ``TLObject.stringify()`` was showing bytes as lists (now
|
|||
fixed) and RPC errors are reported by default:
|
||||
|
||||
In an attempt to help everyone who works with the Telegram API,
|
||||
Telethon will by default report all Remote Procedure Call errors to
|
||||
Garry will by default report all Remote Procedure Call errors to
|
||||
`PWRTelegram <https://pwrtelegram.xyz/>`__, a public database anyone can
|
||||
query, made by `Daniil <https://github.com/danog>`__. All the information
|
||||
sent is a GET request with the error code, error message and method used.
|
||||
|
@ -1213,7 +1213,7 @@ public keys now uses a different module instead the old strange
|
|||
hand-crafted version.
|
||||
|
||||
Hope the new, super simple ``README.rst`` encourages people to use
|
||||
Telethon and make it better with either suggestions, or pull request.
|
||||
Garry and make it better with either suggestions, or pull request.
|
||||
Pull requests are *super* appreciated, but showing some support by
|
||||
leaving a star also feels nice ⭐️.
|
||||
|
||||
|
@ -1226,7 +1226,7 @@ Newbie friendly update (v0.12)
|
|||
| Scheme layer used: 70 |
|
||||
+-----------------------+
|
||||
|
||||
This update is overall an attempt to make Telethon a bit more user
|
||||
This update is overall an attempt to make Garry a bit more user
|
||||
friendly, along with some other stability enhancements, although it
|
||||
brings quite a few changes.
|
||||
|
||||
|
@ -1303,26 +1303,26 @@ get_input_* everywhere (v0.11.4)
|
|||
*Published at 2017/07/10*
|
||||
|
||||
For some reason, Telegram doesn't have enough with the
|
||||
`InputPeer <https://lonamiwebs.github.io/Telethon/types/input_peer.html>`__.
|
||||
`InputPeer <https://lonamiwebs.github.io/Garry/types/input_peer.html>`__.
|
||||
There also exist
|
||||
`InputChannel <https://lonamiwebs.github.io/Telethon/types/input_channel.html>`__
|
||||
`InputChannel <https://lonamiwebs.github.io/Garry/types/input_channel.html>`__
|
||||
and
|
||||
`InputUser <https://lonamiwebs.github.io/Telethon/types/input_user.html>`__!
|
||||
`InputUser <https://lonamiwebs.github.io/Garry/types/input_user.html>`__!
|
||||
You don't have to worry about those anymore, it's handled internally
|
||||
now.
|
||||
|
||||
Besides this, every Telegram object now features a new default
|
||||
``.__str__`` look, and also a `.stringify()
|
||||
method <https://github.com/LonamiWebs/Telethon/commit/8fd0d7eadd944ff42e18aaf06228adc7aba794b5>`__
|
||||
method <https://github.com/LonamiWebs/Garry/commit/8fd0d7eadd944ff42e18aaf06228adc7aba794b5>`__
|
||||
to pretty format them, if you ever need to inspect them.
|
||||
|
||||
The library now uses `the DEBUG
|
||||
level <https://github.com/LonamiWebs/Telethon/commit/1f7ac7118750ed84e2165dce9c6aca2e6ea0c6a4>`__
|
||||
level <https://github.com/LonamiWebs/Garry/commit/1f7ac7118750ed84e2165dce9c6aca2e6ea0c6a4>`__
|
||||
everywhere, so no more warnings or information messages if you had
|
||||
logging enabled.
|
||||
|
||||
The ``no_webpage`` parameter from ``.send_message`` `has been
|
||||
renamed <https://github.com/LonamiWebs/Telethon/commit/0119a006585acd1a1a9a8901a21bb2f193142cfe>`__
|
||||
renamed <https://github.com/LonamiWebs/Garry/commit/0119a006585acd1a1a9a8901a21bb2f193142cfe>`__
|
||||
to ``link_preview`` for clarity, so now it does the opposite (but has a
|
||||
clearer intention).
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ anymore.
|
|||
Bugs fixes
|
||||
~~~~~~~~~~
|
||||
|
||||
- Fixed some errors when installing Telethon via ``pip`` (for those
|
||||
- Fixed some errors when installing Garry via ``pip`` (for those
|
||||
using either source distributions or a Python version ≤ 3.5).
|
||||
- ``ConnectionResetError`` didn't flag sockets as closed, but now it
|
||||
does.
|
||||
|
@ -1406,7 +1406,7 @@ Breaking changes
|
|||
|
||||
- Every Telegram error has now its **own class**, so it's easier to
|
||||
fine-tune your ``except``\ 's.
|
||||
- Markdown parsing is **not part** of Telethon itself anymore, although
|
||||
- Markdown parsing is **not part** of Garry itself anymore, although
|
||||
there are plans to support it again through a some external module.
|
||||
- The ``.list_sessions()`` has been moved to the ``Session`` class
|
||||
instead.
|
||||
|
@ -1472,7 +1472,7 @@ resistant to upgrades.
|
|||
.. warning::
|
||||
|
||||
You **must** upgrade to this version before any higher one if you've
|
||||
used Telethon ≤ v0.10. If you happen to upgrade to an higher version,
|
||||
used Garry ≤ v0.10. If you happen to upgrade to an higher version,
|
||||
that's okay, but you will have to manually delete the ``*.session`` file,
|
||||
and logout from that session from an official client.
|
||||
|
||||
|
@ -1481,7 +1481,7 @@ Additions
|
|||
|
||||
- New ``.get_me()`` function to get the **current** user.
|
||||
- ``.is_user_authorized()`` is now more reliable.
|
||||
- New nice button to copy the ``from telethon.tl.xxx.yyy import Yyy``
|
||||
- New nice button to copy the ``from garry.tl.xxx.yyy import Yyy``
|
||||
on the online documentation.
|
||||
- **More error codes** added to the ``errors`` file.
|
||||
|
||||
|
@ -1499,7 +1499,7 @@ Full support for different DCs and ++stable (v0.10)
|
|||
|
||||
Working with **different data centers** finally *works*! On a different
|
||||
order of things, **reconnection** is now performed automatically every
|
||||
time Telegram decides to kick us off their servers, so now Telethon can
|
||||
time Telegram decides to kick us off their servers, so now Garry can
|
||||
really run **forever and ever**! In theory.
|
||||
|
||||
Enhancements
|
||||
|
@ -1516,7 +1516,7 @@ Enhancements
|
|||
and other internal improvements (which affect the **updates
|
||||
thread**), such as using ``logger`` instead a bare ``print()`` too.
|
||||
|
||||
This brings Telethon a whole step closer to ``v1.0``, though more things
|
||||
This brings Garry a whole step closer to ``v1.0``, though more things
|
||||
should preferably be changed.
|
||||
|
||||
Stability improvements (v0.9.1)
|
||||
|
@ -1524,7 +1524,7 @@ Stability improvements (v0.9.1)
|
|||
|
||||
*Published at 2017/05/23*
|
||||
|
||||
Telethon used to crash a lot when logging in for the very first time.
|
||||
Garry used to crash a lot when logging in for the very first time.
|
||||
The reason for this was that the reconnection (or dead connections) were
|
||||
not handled properly. Now they are, so you should be able to login
|
||||
directly, without needing to delete the ``*.session`` file anymore.
|
||||
|
@ -1538,7 +1538,7 @@ Enhancements
|
|||
proper permissions.
|
||||
- In-code documentation now shows the returning type.
|
||||
- **Relative import** is now used everywhere, so you can rename
|
||||
``telethon`` to anything else.
|
||||
``garry`` to anything else.
|
||||
- **Dead connections** are now **detected** instead entering an infinite loop.
|
||||
- **Sockets** can now be **closed** (and re-opened) properly.
|
||||
- Telegram decided to update the layer 66 without increasing the number.
|
||||
|
@ -1557,9 +1557,9 @@ Additions
|
|||
~~~~~~~~~
|
||||
|
||||
- The **documentation**, available online
|
||||
`here <https://lonamiwebs.github.io/Telethon/>`__, has a new search bar.
|
||||
`here <https://lonamiwebs.github.io/Garry/>`__, has a new search bar.
|
||||
- Better **cross-thread safety** by using ``threading.Event``.
|
||||
- More improvements for running Telethon during a **long period of time**.
|
||||
- More improvements for running Garry during a **long period of time**.
|
||||
|
||||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
@ -1588,7 +1588,7 @@ Additions
|
|||
- **Bot login**, thanks to @JuanPotato for hinting me about how to do
|
||||
it.
|
||||
- **Proxy support**, thanks to @exzhawk for implementing it.
|
||||
- **Logging support**, used by passing ``--telethon-log=DEBUG`` (or
|
||||
- **Logging support**, used by passing ``--garry-log=DEBUG`` (or
|
||||
``INFO``) as a command line argument.
|
||||
|
||||
Bug fixes
|
||||
|
@ -1605,7 +1605,7 @@ Long-run bug fix (v0.7.1)
|
|||
|
||||
*Published at 2017/02/19*
|
||||
|
||||
If you're one of those who runs Telethon for a long time (more than 30
|
||||
If you're one of those who runs Garry for a long time (more than 30
|
||||
minutes), this update by @strayge will be great for you. It sends
|
||||
periodic pings to the Telegram servers so you don't get disconnected and
|
||||
you can still send and receive updates!
|
||||
|
@ -1620,7 +1620,7 @@ Two factor authentication (v0.7)
|
|||
+-----------------------+
|
||||
|
||||
If you're one of those who love security the most, these are good news.
|
||||
You can now use two factor authentication with Telethon too! As internal
|
||||
You can now use two factor authentication with Garry too! As internal
|
||||
changes, the coding style has been improved, and you can easily use
|
||||
custom session objects, and various little bugs have been fixed.
|
||||
|
||||
|
@ -1634,8 +1634,8 @@ Updated pip version (v0.6)
|
|||
+-----------------------+
|
||||
|
||||
This release has no new major features. However, it contains some small
|
||||
changes that make using Telethon a little bit easier. Now those who have
|
||||
installed Telethon via ``pip`` can also take advantage of changes, such
|
||||
changes that make using Garry a little bit easier. Now those who have
|
||||
installed Garry via ``pip`` can also take advantage of changes, such
|
||||
as less bugs, creating empty instances of ``TLObjects``, specifying a
|
||||
timeout and more!
|
||||
|
||||
|
@ -1644,8 +1644,8 @@ Ready, pip, go! (v0.5)
|
|||
|
||||
*Published at 2016/09/18*
|
||||
|
||||
Telethon is now available as a **`Python
|
||||
package <https://pypi.python.org/pypi?name=Telethon>`__**! Those are
|
||||
Garry is now available as a **`Python
|
||||
package <https://pypi.python.org/pypi?name=Garry>`__**! Those are
|
||||
really exciting news (except, sadly, the project structure had to change
|
||||
*a lot* to be able to do that; but hopefully it won't need to change
|
||||
much more, any more!)
|
||||
|
@ -1653,7 +1653,7 @@ much more, any more!)
|
|||
Not only that, but more improvements have also been made: you're now
|
||||
able to both **sign up** and **logout**, watch a pretty
|
||||
"Uploading/Downloading… x%" progress, and other minor changes which make
|
||||
using Telethon **easier**.
|
||||
using Garry **easier**.
|
||||
|
||||
Made InteractiveTelegramClient cool (v0.4)
|
||||
==========================================
|
||||
|
|
|
@ -6,7 +6,7 @@ Project Structure
|
|||
Main interface
|
||||
**************
|
||||
|
||||
The library itself is under the ``telethon/`` directory. The
|
||||
The library itself is under the ``garry/`` directory. The
|
||||
``__init__.py`` file there exposes the main ``TelegramClient``, a class
|
||||
that servers as a nice interface with the most commonly used methods on
|
||||
Telegram such as sending messages, retrieving the message history,
|
||||
|
@ -36,8 +36,8 @@ intermediate…).
|
|||
Auto-generated code
|
||||
*******************
|
||||
|
||||
The files under ``telethon_generator/`` are used to generate the code
|
||||
that gets placed under ``telethon/tl/``. The ``TLGenerator`` takes in a
|
||||
The files under ``garry_generator/`` are used to generate the code
|
||||
that gets placed under ``garry/tl/``. The ``TLGenerator`` takes in a
|
||||
``.tl`` file, and spits out the generated classes which represent, as
|
||||
Python classes, the request and types defined in the ``.tl`` file. It
|
||||
also constructs an index so that they can be imported easily.
|
||||
|
|
|
@ -3,7 +3,7 @@ Telegram API in Other Languages
|
|||
===============================
|
||||
|
||||
|
||||
Telethon was made for **Python**, and as far as I know, there is no
|
||||
Garry was made for **Python**, and as far as I know, there is no
|
||||
*exact* port to other languages. However, there *are* other
|
||||
implementations made by awesome people (one needs to be awesome to
|
||||
understand the official Telegram documentation) on several languages
|
||||
|
@ -61,7 +61,7 @@ A fairly new (as of the end of 2017) Telegram library written from the
|
|||
ground up in Python by
|
||||
`@delivrance <https://github.com/delivrance>`__ and his
|
||||
`Pyrogram <https://github.com/pyrogram/pyrogram>`__ library.
|
||||
There isn't really a reason to pick it over Telethon and it'd be kinda
|
||||
There isn't really a reason to pick it over Garry and it'd be kinda
|
||||
sad to see you go, but it would be nice to know what you miss from each
|
||||
other library in either one so both can improve.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Test Servers
|
|||
============
|
||||
|
||||
|
||||
To run Telethon on a test server, use the following code:
|
||||
To run Garry on a test server, use the following code:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ If you're going to use the code on this repository to guide you, please
|
|||
be kind and don't forget to mention it helped you!
|
||||
|
||||
You should start by reading the source code on the `first
|
||||
release <https://github.com/LonamiWebs/Telethon/releases/tag/v0.1>`__ of
|
||||
release <https://github.com/LonamiWebs/Garry/releases/tag/v0.1>`__ of
|
||||
the project, and start creating a ``MtProtoSender``. Once this is made,
|
||||
you should write by hand the code to authenticate on the Telegram's
|
||||
server, which are some steps required to get the key required to talk to
|
||||
|
|
|
@ -28,6 +28,6 @@ this project for helping you out.
|
|||
|
||||
This is only a introduction. The ``TL`` language is not *that* easy. But
|
||||
it's not that hard either. You're free to sniff the
|
||||
``telethon_generator/`` files and learn how to parse other more complex
|
||||
``garry_generator/`` files and learn how to parse other more complex
|
||||
lines, such as ``flags`` (to indicate things that may or may not be
|
||||
written at all) and ``vector``\ 's.
|
||||
|
|
|
@ -17,7 +17,7 @@ not *interact* with a voting message), by making use of the
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.messages import GetInlineBotResultsRequest
|
||||
from garry.tl.functions.messages import GetInlineBotResultsRequest
|
||||
|
||||
bot_results = client(GetInlineBotResultsRequest(
|
||||
bot, user_or_chat, 'query', ''
|
||||
|
@ -28,7 +28,7 @@ And you can select any of their results by using
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.messages import SendInlineBotResultRequest
|
||||
from garry.tl.functions.messages import SendInlineBotResultRequest
|
||||
|
||||
client(SendInlineBotResultRequest(
|
||||
get_input_peer(user_or_chat),
|
||||
|
@ -45,7 +45,7 @@ To interact with a message that has a special reply markup, such as
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.messages import GetBotCallbackAnswerRequest
|
||||
from garry.tl.functions.messages import GetBotCallbackAnswerRequest
|
||||
|
||||
client(GetBotCallbackAnswerRequest(
|
||||
user_or_chat,
|
||||
|
@ -58,7 +58,7 @@ show it visually (button rows, and buttons within each row, each with
|
|||
its own data).
|
||||
|
||||
__ https://t.me/vote
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/get_inline_bot_results.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/send_inline_bot_result.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/get_bot_callback_answer.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/get_inline_bot_results.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/send_inline_bot_result.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/get_bot_callback_answer.html
|
||||
__ https://t.me/vote
|
||||
|
|
|
@ -24,11 +24,11 @@ to, you can make use of the `JoinChannelRequest`__ to join such channel:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.channels import JoinChannelRequest
|
||||
from garry.tl.functions.channels import JoinChannelRequest
|
||||
client(JoinChannelRequest(channel))
|
||||
|
||||
# In the same way, you can also leave such channel
|
||||
from telethon.tl.functions.channels import LeaveChannelRequest
|
||||
from garry.tl.functions.channels import LeaveChannelRequest
|
||||
client(LeaveChannelRequest(input_channel))
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ example, is the ``hash`` of the chat or channel. Now you can use
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.messages import ImportChatInviteRequest
|
||||
from garry.tl.functions.messages import ImportChatInviteRequest
|
||||
updates = client(ImportChatInviteRequest('AAAAAEHbEkejzxUjAUCfYg'))
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ use is very straightforward, or `InviteToChannelRequest`__ for channels:
|
|||
.. code-block:: python
|
||||
|
||||
# For normal chats
|
||||
from telethon.tl.functions.messages import AddChatUserRequest
|
||||
from garry.tl.functions.messages import AddChatUserRequest
|
||||
|
||||
client(AddChatUserRequest(
|
||||
chat_id,
|
||||
|
@ -70,7 +70,7 @@ use is very straightforward, or `InviteToChannelRequest`__ for channels:
|
|||
))
|
||||
|
||||
# For channels
|
||||
from telethon.tl.functions.channels import InviteToChannelRequest
|
||||
from garry.tl.functions.channels import InviteToChannelRequest
|
||||
|
||||
client(InviteToChannelRequest(
|
||||
channel,
|
||||
|
@ -86,22 +86,22 @@ If you don't need to join but rather check whether it's a group or a
|
|||
channel, you can use the `CheckChatInviteRequest`__, which takes in
|
||||
the hash of said channel or group.
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon/constructors/chat.html
|
||||
__ https://lonamiwebs.github.io/Telethon/constructors/channel.html
|
||||
__ https://lonamiwebs.github.io/Telethon/types/chat.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/join_channel.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/index.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/import_chat_invite.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/add_chat_user.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/invite_to_channel.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/check_chat_invite.html
|
||||
__ https://lonamiwebs.github.io/Garry/constructors/chat.html
|
||||
__ https://lonamiwebs.github.io/Garry/constructors/channel.html
|
||||
__ https://lonamiwebs.github.io/Garry/types/chat.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/join_channel.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/index.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/import_chat_invite.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/add_chat_user.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/invite_to_channel.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/check_chat_invite.html
|
||||
|
||||
|
||||
Retrieving all chat members (channels too)
|
||||
******************************************
|
||||
|
||||
You can use
|
||||
`client.get_participants <telethon.telegram_client.TelegramClient.get_participants>`
|
||||
`client.get_participants <garry.telegram_client.TelegramClient.get_participants>`
|
||||
to retrieve the participants (click it to see the relevant parameters).
|
||||
Most of the time you will just need ``client.get_participants(entity)``.
|
||||
|
||||
|
@ -119,8 +119,8 @@ a fixed limit:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.channels import GetParticipantsRequest
|
||||
from telethon.tl.types import ChannelParticipantsSearch
|
||||
from garry.tl.functions.channels import GetParticipantsRequest
|
||||
from garry.tl.types import ChannelParticipantsSearch
|
||||
from time import sleep
|
||||
|
||||
offset = 0
|
||||
|
@ -150,12 +150,12 @@ Note that ``GetParticipantsRequest`` returns `ChannelParticipants`__,
|
|||
which may have more information you need (like the role of the
|
||||
participants, total count of members, etc.)
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/get_participants.html
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/get_participants.html
|
||||
__ https://lonamiwebs.github.io/Telethon/types/channel_participants_filter.html
|
||||
__ https://lonamiwebs.github.io/Telethon/constructors/channel_participants_search.html
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/573
|
||||
__ https://lonamiwebs.github.io/Telethon/constructors/channels/channel_participants.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/get_participants.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/get_participants.html
|
||||
__ https://lonamiwebs.github.io/Garry/types/channel_participants_filter.html
|
||||
__ https://lonamiwebs.github.io/Garry/constructors/channel_participants_search.html
|
||||
__ https://github.com/LonamiWebs/Garry/issues/573
|
||||
__ https://lonamiwebs.github.io/Garry/constructors/channels/channel_participants.html
|
||||
|
||||
|
||||
Recent Actions
|
||||
|
@ -166,8 +166,8 @@ the "admin log". Simply use `GetAdminLogRequest`__ for that, and
|
|||
you'll get AdminLogResults.events in return which in turn has the final
|
||||
`.action`__.
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/get_admin_log.html
|
||||
__ https://lonamiwebs.github.io/Telethon/types/channel_admin_log_event_action.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/get_admin_log.html
|
||||
__ https://lonamiwebs.github.io/Garry/types/channel_admin_log_event_action.html
|
||||
|
||||
|
||||
Admin Permissions
|
||||
|
@ -177,8 +177,8 @@ Giving or revoking admin permissions can be done with the `EditAdminRequest`__:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.channels import EditAdminRequest
|
||||
from telethon.tl.types import ChannelAdminRights
|
||||
from garry.tl.functions.channels import EditAdminRequest
|
||||
from garry.tl.types import ChannelAdminRights
|
||||
|
||||
# You need both the channel and who to grant permissions
|
||||
# They can either be channel/user or input channel/input user.
|
||||
|
@ -218,10 +218,10 @@ Giving or revoking admin permissions can be done with the `EditAdminRequest`__:
|
|||
| the permissions the user needs. If you don't need to change a permission,
|
||||
| it can be omitted (full list `here`__).
|
||||
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/channels/edit_admin.html
|
||||
__ https://lonamiwebs.github.io/Garry/methods/channels/edit_admin.html
|
||||
__ https://github.com/Kyle2142
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/490
|
||||
__ https://lonamiwebs.github.io/Telethon/constructors/channel_admin_rights.html
|
||||
__ https://github.com/LonamiWebs/Garry/issues/490
|
||||
__ https://lonamiwebs.github.io/Garry/constructors/channel_admin_rights.html
|
||||
|
||||
|
||||
Increasing View Count in a Channel
|
||||
|
@ -249,8 +249,8 @@ running this in a loop will obviously not increase the views forever
|
|||
unless you wait a day between each iteration. If you run it any sooner
|
||||
than that, the views simply won't be increased.
|
||||
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/233
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/305
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/409
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/447
|
||||
__ https://lonamiwebs.github.io/Telethon/methods/messages/get_messages_views.html
|
||||
__ https://github.com/LonamiWebs/Garry/issues/233
|
||||
__ https://github.com/LonamiWebs/Garry/issues/305
|
||||
__ https://github.com/LonamiWebs/Garry/issues/409
|
||||
__ https://github.com/LonamiWebs/Garry/issues/447
|
||||
__ https://lonamiwebs.github.io/Garry/methods/messages/get_messages_views.html
|
||||
|
|
|
@ -12,7 +12,7 @@ Forwarding messages
|
|||
*******************
|
||||
|
||||
This request is available as a friendly method through
|
||||
`client.forward_messages <telethon.telegram_client.TelegramClient.forward_messages>`,
|
||||
`client.forward_messages <garry.telegram_client.TelegramClient.forward_messages>`,
|
||||
and can be used like shown below:
|
||||
|
||||
.. code-block:: python
|
||||
|
@ -31,7 +31,7 @@ and can be used like shown below:
|
|||
)
|
||||
|
||||
# You can also do it manually if you prefer
|
||||
from telethon.tl.functions.messages import ForwardMessagesRequest
|
||||
from garry.tl.functions.messages import ForwardMessagesRequest
|
||||
|
||||
messages = foo() # retrieve a few messages (or even one, in a list)
|
||||
from_entity = bar()
|
||||
|
@ -56,8 +56,8 @@ into issues_. A valid example would be:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from telethon.tl.functions.messages import SearchRequest
|
||||
from telethon.tl.types import InputMessagesFilterEmpty
|
||||
from garry.tl.functions.messages import SearchRequest
|
||||
from garry.tl.types import InputMessagesFilterEmpty
|
||||
|
||||
filter = InputMessagesFilterEmpty()
|
||||
result = client(SearchRequest(
|
||||
|
@ -128,7 +128,7 @@ send yourself the very first sticker you have:
|
|||
))
|
||||
|
||||
|
||||
.. _ForwardMessagesRequest: https://lonamiwebs.github.io/Telethon/methods/messages/forward_messages.html
|
||||
.. _SearchRequest: https://lonamiwebs.github.io/Telethon/methods/messages/search.html
|
||||
.. _issues: https://github.com/LonamiWebs/Telethon/issues/215
|
||||
.. _InputUserEmpty: https://lonamiwebs.github.io/Telethon/constructors/input_user_empty.html
|
||||
.. _ForwardMessagesRequest: https://lonamiwebs.github.io/Garry/methods/messages/forward_messages.html
|
||||
.. _SearchRequest: https://lonamiwebs.github.io/Garry/methods/messages/search.html
|
||||
.. _issues: https://github.com/LonamiWebs/Garry/issues/215
|
||||
.. _InputUserEmpty: https://lonamiwebs.github.io/Garry/constructors/input_user_empty.html
|
||||
|
|
|
@ -23,4 +23,4 @@ For more discussion, please see `issue 297`__.
|
|||
|
||||
|
||||
__ https://t.me/SpamBot
|
||||
__ https://github.com/LonamiWebs/Telethon/issues/297
|
||||
__ https://github.com/LonamiWebs/Garry/issues/297
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enabling Logging
|
||||
================
|
||||
|
||||
Telethon makes use of the `logging`__ module, and you can enable it as follows:
|
||||
Garry makes use of the `logging`__ module, and you can enable it as follows:
|
||||
|
||||
.. code:: python
|
||||
|
||||
|
@ -32,7 +32,7 @@ log level for the library:
|
|||
import logging
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
# For instance, show only warnings and above
|
||||
logging.getLogger('telethon').setLevel(level=logging.WARNING)
|
||||
logging.getLogger('garry').setLevel(level=logging.WARNING)
|
||||
|
||||
|
||||
__ https://docs.python.org/3/library/logging.html
|
||||
|
|
|
@ -6,7 +6,7 @@ RPC stands for Remote Procedure Call, and when the library raises
|
|||
a ``RPCError``, it's because you have invoked some of the API
|
||||
methods incorrectly (wrong parameters, wrong permissions, or even
|
||||
something went wrong on Telegram's server). All the errors are
|
||||
available in :ref:`telethon-errors-package`, but some examples are:
|
||||
available in :ref:`garry-errors-package`, but some examples are:
|
||||
|
||||
- ``FloodWaitError`` (420), the same request was repeated many times.
|
||||
Must wait ``.seconds`` (you can access this parameter).
|
||||
|
|
|
@ -4,15 +4,15 @@ Wall of Shame
|
|||
|
||||
|
||||
This project has an
|
||||
`issues <https://github.com/LonamiWebs/Telethon/issues>`__ section for
|
||||
`issues <https://github.com/LonamiWebs/Garry/issues>`__ section for
|
||||
you to file **issues** whenever you encounter any when working with the
|
||||
library. Said section is **not** for issues on *your* program but rather
|
||||
issues with Telethon itself.
|
||||
issues with Garry itself.
|
||||
|
||||
If you have not made the effort to 1. read through the docs and 2.
|
||||
`look for the method you need <https://lonamiwebs.github.io/Telethon/>`__,
|
||||
`look for the method you need <https://lonamiwebs.github.io/Garry/>`__,
|
||||
you will end up on the `Wall of
|
||||
Shame <https://github.com/LonamiWebs/Telethon/issues?q=is%3Aissue+label%3ARTFM+is%3Aclosed>`__,
|
||||
Shame <https://github.com/LonamiWebs/Garry/issues?q=is%3Aissue+label%3ARTFM+is%3Aclosed>`__,
|
||||
i.e. all issues labeled
|
||||
`"RTFM" <http://www.urbandictionary.com/define.php?term=RTFM>`__:
|
||||
|
||||
|
@ -34,7 +34,7 @@ If you have indeed read the docs, and have tried looking for the method,
|
|||
and yet you didn't find what you need, **that's fine**. Telegram's API
|
||||
can have some obscure names at times, and for this reason, there is a
|
||||
`"question"
|
||||
label <https://github.com/LonamiWebs/Telethon/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20label%3Aquestion%20>`__
|
||||
label <https://github.com/LonamiWebs/Garry/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20label%3Aquestion%20>`__
|
||||
with questions that are okay to ask. Just state what you've tried so
|
||||
that we know you've made an effort, or you'll go to the Wall of Shame.
|
||||
|
||||
|
@ -46,7 +46,7 @@ Current winner
|
|||
--------------
|
||||
|
||||
The current winner is `issue
|
||||
213 <https://github.com/LonamiWebs/Telethon/issues/213>`__:
|
||||
213 <https://github.com/LonamiWebs/Garry/issues/213>`__:
|
||||
|
||||
**Issue:**
|
||||
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
telethon\.crypto package
|
||||
garry\.crypto package
|
||||
========================
|
||||
|
||||
|
||||
telethon\.crypto\.aes module
|
||||
garry\.crypto\.aes module
|
||||
----------------------------
|
||||
|
||||
.. automodule:: telethon.crypto.aes
|
||||
.. automodule:: garry.crypto.aes
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.crypto\.aes\_ctr module
|
||||
garry\.crypto\.aes\_ctr module
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: telethon.crypto.aes_ctr
|
||||
.. automodule:: garry.crypto.aes_ctr
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.crypto\.auth\_key module
|
||||
garry\.crypto\.auth\_key module
|
||||
----------------------------------
|
||||
|
||||
.. automodule:: telethon.crypto.auth_key
|
||||
.. automodule:: garry.crypto.auth_key
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.crypto\.cdn\_decrypter module
|
||||
garry\.crypto\.cdn\_decrypter module
|
||||
---------------------------------------
|
||||
|
||||
.. automodule:: telethon.crypto.cdn_decrypter
|
||||
.. automodule:: garry.crypto.cdn_decrypter
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.crypto\.factorization module
|
||||
garry\.crypto\.factorization module
|
||||
--------------------------------------
|
||||
|
||||
.. automodule:: telethon.crypto.factorization
|
||||
.. automodule:: garry.crypto.factorization
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.crypto\.rsa module
|
||||
garry\.crypto\.rsa module
|
||||
----------------------------
|
||||
|
||||
.. automodule:: telethon.crypto.rsa
|
||||
.. automodule:: garry.crypto.rsa
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,22 +1,22 @@
|
|||
.. _telethon-errors-package:
|
||||
.. _garry-errors-package:
|
||||
|
||||
|
||||
telethon\.errors package
|
||||
garry\.errors package
|
||||
========================
|
||||
|
||||
|
||||
telethon\.errors\.common module
|
||||
garry\.errors\.common module
|
||||
-------------------------------
|
||||
|
||||
.. automodule:: telethon.errors.common
|
||||
.. automodule:: garry.errors.common
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.errors\.rpc\_base\_errors module
|
||||
garry\.errors\.rpc\_base\_errors module
|
||||
------------------------------------------
|
||||
|
||||
.. automodule:: telethon.errors.rpc_base_errors
|
||||
.. automodule:: garry.errors.rpc_base_errors
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
9
readthedocs/garry.events.rst
Normal file
9
readthedocs/garry.events.rst
Normal file
|
@ -0,0 +1,9 @@
|
|||
.. _garry-events-package:
|
||||
|
||||
garry\.events package
|
||||
========================
|
||||
|
||||
.. automodule:: garry.events
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,27 +1,27 @@
|
|||
telethon\.extensions package
|
||||
garry\.extensions package
|
||||
============================
|
||||
|
||||
|
||||
telethon\.extensions\.binary\_reader module
|
||||
garry\.extensions\.binary\_reader module
|
||||
-------------------------------------------
|
||||
|
||||
.. automodule:: telethon.extensions.binary_reader
|
||||
.. automodule:: garry.extensions.binary_reader
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.extensions\.markdown module
|
||||
garry\.extensions\.markdown module
|
||||
-------------------------------------
|
||||
|
||||
.. automodule:: telethon.extensions.markdown
|
||||
.. automodule:: garry.extensions.markdown
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.extensions\.tcp\_client module
|
||||
garry\.extensions\.tcp\_client module
|
||||
----------------------------------------
|
||||
|
||||
.. automodule:: telethon.extensions.tcp_client
|
||||
.. automodule:: garry.extensions.tcp_client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,35 +1,35 @@
|
|||
telethon\.network package
|
||||
garry\.network package
|
||||
=========================
|
||||
|
||||
|
||||
telethon\.network\.authenticator module
|
||||
garry\.network\.authenticator module
|
||||
---------------------------------------
|
||||
|
||||
.. automodule:: telethon.network.authenticator
|
||||
.. automodule:: garry.network.authenticator
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.network\.connection module
|
||||
garry\.network\.connection module
|
||||
------------------------------------
|
||||
|
||||
.. automodule:: telethon.network.connection
|
||||
.. automodule:: garry.network.connection
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.network\.mtproto\_plain\_sender module
|
||||
garry\.network\.mtproto\_plain\_sender module
|
||||
------------------------------------------------
|
||||
|
||||
.. automodule:: telethon.network.mtproto_plain_sender
|
||||
.. automodule:: garry.network.mtproto_plain_sender
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.network\.mtproto\_sender module
|
||||
garry\.network\.mtproto\_sender module
|
||||
-----------------------------------------
|
||||
|
||||
.. automodule:: telethon.network.mtproto_sender
|
||||
.. automodule:: garry.network.mtproto_sender
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,107 +1,107 @@
|
|||
.. _telethon-package:
|
||||
.. _garry-package:
|
||||
|
||||
|
||||
telethon package
|
||||
garry package
|
||||
================
|
||||
|
||||
|
||||
telethon\.telegram\_client module
|
||||
garry\.telegram\_client module
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: telethon.telegram_client
|
||||
.. automodule:: garry.telegram_client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.telegram\_bare\_client module
|
||||
garry\.telegram\_bare\_client module
|
||||
---------------------------------------
|
||||
|
||||
.. automodule:: telethon.telegram_bare_client
|
||||
.. automodule:: garry.telegram_bare_client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.utils module
|
||||
garry\.utils module
|
||||
----------------------
|
||||
|
||||
.. automodule:: telethon.utils
|
||||
.. automodule:: garry.utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.helpers module
|
||||
garry\.helpers module
|
||||
------------------------
|
||||
|
||||
.. automodule:: telethon.helpers
|
||||
.. automodule:: garry.helpers
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.events package
|
||||
garry\.events package
|
||||
------------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.events
|
||||
garry.events
|
||||
|
||||
|
||||
telethon\.update\_state module
|
||||
garry\.update\_state module
|
||||
------------------------------
|
||||
|
||||
.. automodule:: telethon.update_state
|
||||
.. automodule:: garry.update_state
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.sessions module
|
||||
garry\.sessions module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: telethon.sessions
|
||||
.. automodule:: garry.sessions
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.cryto package
|
||||
garry\.cryto package
|
||||
------------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.crypto
|
||||
garry.crypto
|
||||
|
||||
telethon\.errors package
|
||||
garry\.errors package
|
||||
------------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.errors
|
||||
garry.errors
|
||||
|
||||
telethon\.extensions package
|
||||
garry\.extensions package
|
||||
----------------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.extensions
|
||||
garry.extensions
|
||||
|
||||
telethon\.network package
|
||||
garry\.network package
|
||||
-------------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.network
|
||||
garry.network
|
||||
|
||||
telethon\.tl package
|
||||
garry\.tl package
|
||||
--------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.tl
|
||||
garry.tl
|
||||
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: telethon
|
||||
.. automodule:: garry
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,21 +1,21 @@
|
|||
telethon\.tl\.custom package
|
||||
garry\.tl\.custom package
|
||||
============================
|
||||
|
||||
|
||||
telethon\.tl\.custom\.draft module
|
||||
garry\.tl\.custom\.draft module
|
||||
----------------------------------
|
||||
|
||||
.. automodule:: telethon.tl.custom.draft
|
||||
.. automodule:: garry.tl.custom.draft
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
|
||||
telethon\.tl\.custom\.dialog module
|
||||
garry\.tl\.custom\.dialog module
|
||||
-----------------------------------
|
||||
|
||||
.. automodule:: telethon.tl.custom.dialog
|
||||
.. automodule:: garry.tl.custom.dialog
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,40 +1,40 @@
|
|||
telethon\.tl package
|
||||
garry\.tl package
|
||||
====================
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
telethon.tl.custom
|
||||
garry.tl.custom
|
||||
|
||||
|
||||
telethon\.tl\.gzip\_packed module
|
||||
garry\.tl\.gzip\_packed module
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: telethon.tl.gzip_packed
|
||||
.. automodule:: garry.tl.gzip_packed
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.tl\.message\_container module
|
||||
garry\.tl\.message\_container module
|
||||
---------------------------------------
|
||||
|
||||
.. automodule:: telethon.tl.message_container
|
||||
.. automodule:: garry.tl.message_container
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.tl\.tl\_message module
|
||||
garry\.tl\.tl\_message module
|
||||
--------------------------------
|
||||
|
||||
.. automodule:: telethon.tl.tl_message
|
||||
.. automodule:: garry.tl.tl_message
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.tl\.tlobject module
|
||||
garry\.tl\.tlobject module
|
||||
-----------------------------
|
||||
|
||||
.. automodule:: telethon.tl.tlobject
|
||||
.. automodule:: garry.tl.tlobject
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
|
@ -1,22 +1,22 @@
|
|||
.. Telethon documentation master file, created by
|
||||
.. Garry documentation master file, created by
|
||||
sphinx-quickstart on Fri Nov 17 15:36:11 2017.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
====================================
|
||||
Welcome to Telethon's documentation!
|
||||
Welcome to Garry's documentation!
|
||||
====================================
|
||||
|
||||
|
||||
Pure Python 3 Telegram client library.
|
||||
Official Site `here <https://lonamiwebs.github.io/Telethon>`_.
|
||||
Official Site `here <https://lonamiwebs.github.io/Garry>`_.
|
||||
Please follow the links on the index below to navigate from here,
|
||||
or use the menu on the left. Remember to read the :ref:`changelog`
|
||||
when you upgrade!
|
||||
|
||||
.. important::
|
||||
If you're new here, you want to read :ref:`getting-started`. If you're
|
||||
looking for the method reference, you should check :ref:`telethon-package`.
|
||||
looking for the method reference, you should check :ref:`garry-package`.
|
||||
|
||||
|
||||
What is this?
|
||||
|
@ -102,7 +102,7 @@ heavy job for you, so you can focus on developing an application.
|
|||
|
||||
|
||||
.. toctree::
|
||||
:caption: Telethon modules
|
||||
:caption: Garry modules
|
||||
|
||||
modules
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user