diff --git a/.gitignore b/.gitignore index f2090e85..68aa1ae7 100755 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in index 0eed5bd4..3e6bcb97 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include LICENSE include README.rst -recursive-include telethon * +recursive-include garry * diff --git a/README.rst b/README.rst index a2e0d3de..e64cbb16 100755 --- a/README.rst +++ b/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 `_ +Do you like how Garry looks? Check out +`Read The Docs `_ for a more in-depth explanation, with examples, troubleshooting issues, and more useful information. diff --git a/docs/generate.py b/docs/generate.py index 75ab3091..72daa78e 100755 --- a/docs/generate.py +++ b/docs/generate.py @@ -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) diff --git a/docs/res/404.html b/docs/res/404.html index 8eb3d37d..fd98ac5e 100644 --- a/docs/res/404.html +++ b/docs/res/404.html @@ -1,6 +1,6 @@ - Oopsie! | Telethon + Oopsie! | Garry diff --git a/docs/res/core.html b/docs/res/core.html index 25295494..d7cf3010 100644 --- a/docs/res/core.html +++ b/docs/res/core.html @@ -2,7 +2,7 @@ - Telethon API + Garry API @@ -15,7 +15,7 @@
-

Telethon API

+

Garry API

This documentation was generated straight from the scheme.tl 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>

This is not 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 - here + here for more details on it.

Index

@@ -141,7 +141,7 @@ users.getUsers#0d91a548 id:Vector<InputUser> = Vector<User>

Full example

Documentation for this is now - here. + here.

diff --git a/telethon/__init__.py b/garry/__init__.py similarity index 100% rename from telethon/__init__.py rename to garry/__init__.py diff --git a/telethon/crypto/__init__.py b/garry/crypto/__init__.py similarity index 100% rename from telethon/crypto/__init__.py rename to garry/crypto/__init__.py diff --git a/telethon/crypto/aes.py b/garry/crypto/aes.py similarity index 100% rename from telethon/crypto/aes.py rename to garry/crypto/aes.py diff --git a/telethon/crypto/aes_ctr.py b/garry/crypto/aes_ctr.py similarity index 100% rename from telethon/crypto/aes_ctr.py rename to garry/crypto/aes_ctr.py diff --git a/telethon/crypto/auth_key.py b/garry/crypto/auth_key.py similarity index 100% rename from telethon/crypto/auth_key.py rename to garry/crypto/auth_key.py diff --git a/telethon/crypto/cdn_decrypter.py b/garry/crypto/cdn_decrypter.py similarity index 100% rename from telethon/crypto/cdn_decrypter.py rename to garry/crypto/cdn_decrypter.py diff --git a/telethon/crypto/factorization.py b/garry/crypto/factorization.py similarity index 100% rename from telethon/crypto/factorization.py rename to garry/crypto/factorization.py diff --git a/telethon/crypto/rsa.py b/garry/crypto/rsa.py similarity index 100% rename from telethon/crypto/rsa.py rename to garry/crypto/rsa.py diff --git a/telethon/errors/__init__.py b/garry/errors/__init__.py similarity index 97% rename from telethon/errors/__init__.py rename to garry/errors/__init__.py index d9875849..a53b2cfe 100644 --- a/telethon/errors/__init__.py +++ b/garry/errors/__init__.py @@ -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 diff --git a/telethon/errors/common.py b/garry/errors/common.py similarity index 100% rename from telethon/errors/common.py rename to garry/errors/common.py diff --git a/telethon/errors/rpc_base_errors.py b/garry/errors/rpc_base_errors.py similarity index 100% rename from telethon/errors/rpc_base_errors.py rename to garry/errors/rpc_base_errors.py diff --git a/telethon/events/__init__.py b/garry/events/__init__.py similarity index 100% rename from telethon/events/__init__.py rename to garry/events/__init__.py diff --git a/telethon/extensions/__init__.py b/garry/extensions/__init__.py similarity index 100% rename from telethon/extensions/__init__.py rename to garry/extensions/__init__.py diff --git a/telethon/extensions/binary_reader.py b/garry/extensions/binary_reader.py similarity index 100% rename from telethon/extensions/binary_reader.py rename to garry/extensions/binary_reader.py diff --git a/telethon/extensions/html.py b/garry/extensions/html.py similarity index 100% rename from telethon/extensions/html.py rename to garry/extensions/html.py diff --git a/telethon/extensions/markdown.py b/garry/extensions/markdown.py similarity index 100% rename from telethon/extensions/markdown.py rename to garry/extensions/markdown.py diff --git a/telethon/extensions/tcp_client.py b/garry/extensions/tcp_client.py similarity index 100% rename from telethon/extensions/tcp_client.py rename to garry/extensions/tcp_client.py diff --git a/telethon/helpers.py b/garry/helpers.py similarity index 97% rename from telethon/helpers.py rename to garry/helpers.py index 9ca91e4f..83825399 100644 --- a/telethon/helpers.py +++ b/garry/helpers.py @@ -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 diff --git a/telethon/network/__init__.py b/garry/network/__init__.py similarity index 100% rename from telethon/network/__init__.py rename to garry/network/__init__.py diff --git a/telethon/network/authenticator.py b/garry/network/authenticator.py similarity index 100% rename from telethon/network/authenticator.py rename to garry/network/authenticator.py diff --git a/telethon/network/connection.py b/garry/network/connection.py similarity index 100% rename from telethon/network/connection.py rename to garry/network/connection.py diff --git a/telethon/network/mtproto_plain_sender.py b/garry/network/mtproto_plain_sender.py similarity index 100% rename from telethon/network/mtproto_plain_sender.py rename to garry/network/mtproto_plain_sender.py diff --git a/telethon/network/mtproto_sender.py b/garry/network/mtproto_sender.py similarity index 100% rename from telethon/network/mtproto_sender.py rename to garry/network/mtproto_sender.py diff --git a/telethon/sessions/__init__.py b/garry/sessions/__init__.py similarity index 100% rename from telethon/sessions/__init__.py rename to garry/sessions/__init__.py diff --git a/telethon/sessions/abstract.py b/garry/sessions/abstract.py similarity index 100% rename from telethon/sessions/abstract.py rename to garry/sessions/abstract.py diff --git a/telethon/sessions/memory.py b/garry/sessions/memory.py similarity index 100% rename from telethon/sessions/memory.py rename to garry/sessions/memory.py diff --git a/telethon/sessions/sqlite.py b/garry/sessions/sqlite.py similarity index 100% rename from telethon/sessions/sqlite.py rename to garry/sessions/sqlite.py diff --git a/telethon/telegram_bare_client.py b/garry/telegram_bare_client.py similarity index 99% rename from telethon/telegram_bare_client.py rename to garry/telegram_bare_client.py index a8a43774..9a83d51f 100644 --- a/telethon/telegram_bare_client.py +++ b/garry/telegram_bare_client.py @@ -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 diff --git a/telethon/telegram_client.py b/garry/telegram_client.py similarity index 99% rename from telethon/telegram_client.py rename to garry/telegram_client.py index ca072f4f..05d8a2b3 100644 --- a/telethon/telegram_client.py +++ b/garry/telegram_client.py @@ -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) diff --git a/telethon/tl/__init__.py b/garry/tl/__init__.py similarity index 100% rename from telethon/tl/__init__.py rename to garry/tl/__init__.py diff --git a/telethon/tl/custom/__init__.py b/garry/tl/custom/__init__.py similarity index 100% rename from telethon/tl/custom/__init__.py rename to garry/tl/custom/__init__.py diff --git a/telethon/tl/custom/dialog.py b/garry/tl/custom/dialog.py similarity index 98% rename from telethon/tl/custom/dialog.py rename to garry/tl/custom/dialog.py index 74b2598a..e0e67115 100644 --- a/telethon/tl/custom/dialog.py +++ b/garry/tl/custom/dialog.py @@ -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(...)``. """ diff --git a/telethon/tl/custom/draft.py b/garry/tl/custom/draft.py similarity index 100% rename from telethon/tl/custom/draft.py rename to garry/tl/custom/draft.py diff --git a/telethon/tl/custom/input_sized_file.py b/garry/tl/custom/input_sized_file.py similarity index 100% rename from telethon/tl/custom/input_sized_file.py rename to garry/tl/custom/input_sized_file.py diff --git a/telethon/tl/gzip_packed.py b/garry/tl/gzip_packed.py similarity index 100% rename from telethon/tl/gzip_packed.py rename to garry/tl/gzip_packed.py diff --git a/telethon/tl/message_container.py b/garry/tl/message_container.py similarity index 100% rename from telethon/tl/message_container.py rename to garry/tl/message_container.py diff --git a/telethon/tl/tl_message.py b/garry/tl/tl_message.py similarity index 100% rename from telethon/tl/tl_message.py rename to garry/tl/tl_message.py diff --git a/telethon/tl/tlobject.py b/garry/tl/tlobject.py similarity index 100% rename from telethon/tl/tlobject.py rename to garry/tl/tlobject.py diff --git a/telethon/update_state.py b/garry/update_state.py similarity index 100% rename from telethon/update_state.py rename to garry/update_state.py diff --git a/telethon/utils.py b/garry/utils.py similarity index 100% rename from telethon/utils.py rename to garry/utils.py diff --git a/telethon/version.py b/garry/version.py similarity index 100% rename from telethon/version.py rename to garry/version.py diff --git a/telethon_examples/interactive_telegram_client.py b/garry_examples/interactive_telegram_client.py similarity index 97% rename from telethon_examples/interactive_telegram_client.py rename to garry_examples/interactive_telegram_client.py index 44185995..ea38618d 100644 --- a/telethon_examples/interactive_telegram_client.py +++ b/garry_examples/interactive_telegram_client.py @@ -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. """ diff --git a/telethon_examples/print_updates.py b/garry_examples/print_updates.py similarity index 96% rename from telethon_examples/print_updates.py rename to garry_examples/print_updates.py index 4c676a81..2f811c74 100755 --- a/telethon_examples/print_updates.py +++ b/garry_examples/print_updates.py @@ -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(): diff --git a/telethon_examples/replier.py b/garry_examples/replier.py similarity index 98% rename from telethon_examples/replier.py rename to garry_examples/replier.py index ed4cc2fa..5d2ef5db 100755 --- a/telethon_examples/replier.py +++ b/garry_examples/replier.py @@ -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 diff --git a/telethon_generator/__init__.py b/garry_generator/__init__.py similarity index 100% rename from telethon_generator/__init__.py rename to garry_generator/__init__.py diff --git a/telethon_generator/error_descriptions b/garry_generator/error_descriptions similarity index 100% rename from telethon_generator/error_descriptions rename to garry_generator/error_descriptions diff --git a/telethon_generator/error_generator.py b/garry_generator/error_generator.py similarity index 95% rename from telethon_generator/error_generator.py rename to garry_generator/error_generator.py index 4aad78ec..2cc64d91 100644 --- a/telethon_generator/error_generator.py +++ b/garry_generator/error_generator.py @@ -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') diff --git a/telethon_generator/errors.json b/garry_generator/errors.json similarity index 100% rename from telethon_generator/errors.json rename to garry_generator/errors.json diff --git a/telethon_generator/parser/__init__.py b/garry_generator/parser/__init__.py similarity index 100% rename from telethon_generator/parser/__init__.py rename to garry_generator/parser/__init__.py diff --git a/telethon_generator/parser/source_builder.py b/garry_generator/parser/source_builder.py similarity index 100% rename from telethon_generator/parser/source_builder.py rename to garry_generator/parser/source_builder.py diff --git a/telethon_generator/parser/tl_object.py b/garry_generator/parser/tl_object.py similarity index 100% rename from telethon_generator/parser/tl_object.py rename to garry_generator/parser/tl_object.py diff --git a/telethon_generator/parser/tl_parser.py b/garry_generator/parser/tl_parser.py similarity index 100% rename from telethon_generator/parser/tl_parser.py rename to garry_generator/parser/tl_parser.py diff --git a/telethon_generator/scheme.tl b/garry_generator/scheme.tl similarity index 100% rename from telethon_generator/scheme.tl rename to garry_generator/scheme.tl diff --git a/telethon_generator/tl_generator.py b/garry_generator/tl_generator.py similarity index 100% rename from telethon_generator/tl_generator.py rename to garry_generator/tl_generator.py diff --git a/telethon_tests/__init__.py b/garry_tests/__init__.py similarity index 100% rename from telethon_tests/__init__.py rename to garry_tests/__init__.py diff --git a/telethon_tests/test_crypto.py b/garry_tests/test_crypto.py similarity index 98% rename from telethon_tests/test_crypto.py rename to garry_tests/test_crypto.py index 136e6091..3fe220aa 100644 --- a/telethon_tests/test_crypto.py +++ b/garry_tests/test_crypto.py @@ -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 diff --git a/telethon_tests/test_higher_level.py b/garry_tests/test_higher_level.py similarity index 97% rename from telethon_tests/test_higher_level.py rename to garry_tests/test_higher_level.py index 8e933056..de6c2c5d 100644 --- a/telethon_tests/test_higher_level.py +++ b/garry_tests/test_higher_level.py @@ -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. diff --git a/telethon_tests/test_network.py b/garry_tests/test_network.py similarity index 90% rename from telethon_tests/test_network.py rename to garry_tests/test_network.py index 031ad99d..5498be9a 100644 --- a/telethon_tests/test_network.py +++ b/garry_tests/test_network.py @@ -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): diff --git a/telethon_tests/test_parser.py b/garry_tests/test_parser.py similarity index 100% rename from telethon_tests/test_parser.py rename to garry_tests/test_parser.py diff --git a/telethon_tests/test_tl.py b/garry_tests/test_tl.py similarity index 100% rename from telethon_tests/test_tl.py rename to garry_tests/test_tl.py diff --git a/telethon_tests/test_utils.py b/garry_tests/test_utils.py similarity index 97% rename from telethon_tests/test_utils.py rename to garry_tests/test_utils.py index 4a550e3d..348fcb40 100644 --- a/telethon_tests/test_utils.py +++ b/garry_tests/test_utils.py @@ -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): diff --git a/readthedocs/Makefile b/readthedocs/Makefile index fd6e0d0a..94fa5ba0 100644 --- a/readthedocs/Makefile +++ b/readthedocs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = Telethon +SPHINXPROJ = Garry SOURCEDIR = . BUILDDIR = _build diff --git a/readthedocs/conf.py b/readthedocs/conf.py index 2821e069..2af37b90 100644 --- a/readthedocs/conf.py +++ b/readthedocs/conf.py @@ -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'), ] diff --git a/readthedocs/extra/advanced-usage/accessing-the-full-api.rst b/readthedocs/extra/advanced-usage/accessing-the-full-api.rst index b8d63eb6..9c5aa762 100644 --- a/readthedocs/extra/advanced-usage/accessing-the-full-api.rst +++ b/readthedocs/extra/advanced-usage/accessing-the-full-api.rst @@ -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 diff --git a/readthedocs/extra/advanced-usage/sessions.rst b/readthedocs/extra/advanced-usage/sessions.rst index 592d8334..81ea0330 100644 --- a/readthedocs/extra/advanced-usage/sessions.rst +++ b/readthedocs/extra/advanced-usage/sessions.rst @@ -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 `_: stores all sessions in a single database via SQLAlchemy. -* `Redis `_: stores all sessions in a single Redis data store. +* `SQLAlchemy `_: stores all sessions in a single database via SQLAlchemy. +* `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. diff --git a/readthedocs/extra/advanced-usage/update-modes.rst b/readthedocs/extra/advanced-usage/update-modes.rst index 942af9c9..c4ee52c2 100644 --- a/readthedocs/extra/advanced-usage/update-modes.rst +++ b/readthedocs/extra/advanced-usage/update-modes.rst @@ -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 diff --git a/readthedocs/extra/basic/creating-a-client.rst b/readthedocs/extra/basic/creating-a-client.rst index 7a110e0d..7ed62b7a 100644 --- a/readthedocs/extra/basic/creating-a-client.rst +++ b/readthedocs/extra/basic/creating-a-client.rst @@ -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') diff --git a/readthedocs/extra/basic/entities.rst b/readthedocs/extra/basic/entities.rst index ab04a165..5749f23e 100644 --- a/readthedocs/extra/basic/entities.rst +++ b/readthedocs/extra/basic/entities.rst @@ -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)) diff --git a/readthedocs/extra/basic/getting-started.rst b/readthedocs/extra/basic/getting-started.rst index e40bae44..953d7fee 100644 --- a/readthedocs/extra/basic/getting-started.rst +++ b/readthedocs/extra/basic/getting-started.rst @@ -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 diff --git a/readthedocs/extra/basic/installation.rst b/readthedocs/extra/basic/installation.rst index c00ea79c..879c1122 100644 --- a/readthedocs/extra/basic/installation.rst +++ b/readthedocs/extra/basic/installation.rst @@ -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 `__ 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 diff --git a/readthedocs/extra/basic/telegram-client.rst b/readthedocs/extra/basic/telegram-client.rst index decb3765..27ac3178 100644 --- a/readthedocs/extra/basic/telegram-client.rst +++ b/readthedocs/extra/basic/telegram-client.rst @@ -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 diff --git a/readthedocs/extra/basic/working-with-updates.rst b/readthedocs/extra/basic/working-with-updates.rst index 308c3a79..16343c16 100644 --- a/readthedocs/extra/basic/working-with-updates.rst +++ b/readthedocs/extra/basic/working-with-updates.rst @@ -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 diff --git a/readthedocs/extra/changelog.rst b/readthedocs/extra/changelog.rst index e7973363..b2794a0c 100644 --- a/readthedocs/extra/changelog.rst +++ b/readthedocs/extra/changelog.rst @@ -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 `_. +refer to `#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 `__ +parsing `__ of certain TLObjects thanks to @stek29, and -`some `__ +`some `__ `wrong -calls `__ +calls `__ 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 `__ for +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** `__. +modes** `__. 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 `__, a public database anyone can query, made by `Daniil `__. 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 `__. +`InputPeer `__. There also exist -`InputChannel `__ +`InputChannel `__ and -`InputUser `__! +`InputUser `__! 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 `__ +method `__ to pretty format them, if you ever need to inspect them. The library now uses `the DEBUG -level `__ +level `__ everywhere, so no more warnings or information messages if you had logging enabled. The ``no_webpage`` parameter from ``.send_message`` `has been -renamed `__ +renamed `__ 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 `__, has a new search bar. + `here `__, 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 `__**! Those are +Garry is now available as a **`Python +package `__**! 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) ========================================== diff --git a/readthedocs/extra/developing/project-structure.rst b/readthedocs/extra/developing/project-structure.rst index d40c6031..c4850716 100644 --- a/readthedocs/extra/developing/project-structure.rst +++ b/readthedocs/extra/developing/project-structure.rst @@ -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. diff --git a/readthedocs/extra/developing/telegram-api-in-other-languages.rst b/readthedocs/extra/developing/telegram-api-in-other-languages.rst index 22bb416a..66cd7548 100644 --- a/readthedocs/extra/developing/telegram-api-in-other-languages.rst +++ b/readthedocs/extra/developing/telegram-api-in-other-languages.rst @@ -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 `__ and his `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. diff --git a/readthedocs/extra/developing/test-servers.rst b/readthedocs/extra/developing/test-servers.rst index a3288a25..77e93ae6 100644 --- a/readthedocs/extra/developing/test-servers.rst +++ b/readthedocs/extra/developing/test-servers.rst @@ -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 diff --git a/readthedocs/extra/developing/tips-for-porting-the-project.rst b/readthedocs/extra/developing/tips-for-porting-the-project.rst index c7135096..690312f4 100644 --- a/readthedocs/extra/developing/tips-for-porting-the-project.rst +++ b/readthedocs/extra/developing/tips-for-porting-the-project.rst @@ -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 `__ of +release `__ 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 diff --git a/readthedocs/extra/developing/understanding-the-type-language.rst b/readthedocs/extra/developing/understanding-the-type-language.rst index 8e5259a7..bced6585 100644 --- a/readthedocs/extra/developing/understanding-the-type-language.rst +++ b/readthedocs/extra/developing/understanding-the-type-language.rst @@ -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. diff --git a/readthedocs/extra/examples/bots.rst b/readthedocs/extra/examples/bots.rst index fd4d54de..030e8f33 100644 --- a/readthedocs/extra/examples/bots.rst +++ b/readthedocs/extra/examples/bots.rst @@ -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 diff --git a/readthedocs/extra/examples/chats-and-channels.rst b/readthedocs/extra/examples/chats-and-channels.rst index 9851282f..906030de 100644 --- a/readthedocs/extra/examples/chats-and-channels.rst +++ b/readthedocs/extra/examples/chats-and-channels.rst @@ -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 ` +`client.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 diff --git a/readthedocs/extra/examples/working-with-messages.rst b/readthedocs/extra/examples/working-with-messages.rst index 3db1aed0..6311415d 100644 --- a/readthedocs/extra/examples/working-with-messages.rst +++ b/readthedocs/extra/examples/working-with-messages.rst @@ -12,7 +12,7 @@ Forwarding messages ******************* This request is available as a friendly method through -`client.forward_messages `, +`client.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 diff --git a/readthedocs/extra/troubleshooting/deleted-limited-or-deactivated-accounts.rst b/readthedocs/extra/troubleshooting/deleted-limited-or-deactivated-accounts.rst index 6426ada9..fe8ee1f8 100644 --- a/readthedocs/extra/troubleshooting/deleted-limited-or-deactivated-accounts.rst +++ b/readthedocs/extra/troubleshooting/deleted-limited-or-deactivated-accounts.rst @@ -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 diff --git a/readthedocs/extra/troubleshooting/enable-logging.rst b/readthedocs/extra/troubleshooting/enable-logging.rst index 897052e2..2785a241 100644 --- a/readthedocs/extra/troubleshooting/enable-logging.rst +++ b/readthedocs/extra/troubleshooting/enable-logging.rst @@ -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 diff --git a/readthedocs/extra/troubleshooting/rpc-errors.rst b/readthedocs/extra/troubleshooting/rpc-errors.rst index 17299f1f..de40e41d 100644 --- a/readthedocs/extra/troubleshooting/rpc-errors.rst +++ b/readthedocs/extra/troubleshooting/rpc-errors.rst @@ -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). diff --git a/readthedocs/extra/wall-of-shame.rst b/readthedocs/extra/wall-of-shame.rst index 4f7b5660..a0521e38 100644 --- a/readthedocs/extra/wall-of-shame.rst +++ b/readthedocs/extra/wall-of-shame.rst @@ -4,15 +4,15 @@ Wall of Shame This project has an -`issues `__ section for +`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 `__, +`look for the method you need `__, you will end up on the `Wall of -Shame `__, +Shame `__, i.e. all issues labeled `"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 `__ +label `__ 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 `__: +213 `__: **Issue:** diff --git a/readthedocs/telethon.crypto.rst b/readthedocs/garry.crypto.rst similarity index 55% rename from readthedocs/telethon.crypto.rst rename to readthedocs/garry.crypto.rst index 8adf55d5..6ea7ffe3 100644 --- a/readthedocs/telethon.crypto.rst +++ b/readthedocs/garry.crypto.rst @@ -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: diff --git a/readthedocs/telethon.errors.rst b/readthedocs/garry.errors.rst similarity index 50% rename from readthedocs/telethon.errors.rst rename to readthedocs/garry.errors.rst index e90d1819..c07c904f 100644 --- a/readthedocs/telethon.errors.rst +++ b/readthedocs/garry.errors.rst @@ -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: diff --git a/readthedocs/garry.events.rst b/readthedocs/garry.events.rst new file mode 100644 index 00000000..f0b98086 --- /dev/null +++ b/readthedocs/garry.events.rst @@ -0,0 +1,9 @@ +.. _garry-events-package: + +garry\.events package +======================== + +.. automodule:: garry.events + :members: + :undoc-members: + :show-inheritance: diff --git a/readthedocs/telethon.extensions.rst b/readthedocs/garry.extensions.rst similarity index 53% rename from readthedocs/telethon.extensions.rst rename to readthedocs/garry.extensions.rst index 578728b5..c09b3134 100644 --- a/readthedocs/telethon.extensions.rst +++ b/readthedocs/garry.extensions.rst @@ -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: diff --git a/readthedocs/telethon.network.rst b/readthedocs/garry.network.rst similarity index 52% rename from readthedocs/telethon.network.rst rename to readthedocs/garry.network.rst index 3600e985..b94c65ae 100644 --- a/readthedocs/telethon.network.rst +++ b/readthedocs/garry.network.rst @@ -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: diff --git a/readthedocs/telethon.rst b/readthedocs/garry.rst similarity index 54% rename from readthedocs/telethon.rst rename to readthedocs/garry.rst index 0b60b007..b2a5206e 100644 --- a/readthedocs/telethon.rst +++ b/readthedocs/garry.rst @@ -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: diff --git a/readthedocs/telethon.tl.custom.rst b/readthedocs/garry.tl.custom.rst similarity index 54% rename from readthedocs/telethon.tl.custom.rst rename to readthedocs/garry.tl.custom.rst index 7f59596c..ed67cc65 100644 --- a/readthedocs/telethon.tl.custom.rst +++ b/readthedocs/garry.tl.custom.rst @@ -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: diff --git a/readthedocs/telethon.tl.rst b/readthedocs/garry.tl.rst similarity index 54% rename from readthedocs/telethon.tl.rst rename to readthedocs/garry.tl.rst index a10ecc68..b03e92d1 100644 --- a/readthedocs/telethon.tl.rst +++ b/readthedocs/garry.tl.rst @@ -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: diff --git a/readthedocs/index.rst b/readthedocs/index.rst index a3982d86..bf4b0b69 100644 --- a/readthedocs/index.rst +++ b/readthedocs/index.rst @@ -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 `_. +Official Site `here `_. 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 diff --git a/readthedocs/make.bat b/readthedocs/make.bat index f51f7234..0491faa5 100644 --- a/readthedocs/make.bat +++ b/readthedocs/make.bat @@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=. set BUILDDIR=_build -set SPHINXPROJ=Telethon +set SPHINXPROJ=Garry if "%1" == "" goto help diff --git a/readthedocs/modules.rst b/readthedocs/modules.rst index f710574a..d9e5fac9 100644 --- a/readthedocs/modules.rst +++ b/readthedocs/modules.rst @@ -1,7 +1,7 @@ -telethon +garry ======== .. toctree:: :maxdepth: 3 - telethon + garry diff --git a/readthedocs/requirements.txt b/readthedocs/requirements.txt index 97c7493d..df9a9a95 100644 --- a/readthedocs/requirements.txt +++ b/readthedocs/requirements.txt @@ -1 +1 @@ -telethon \ No newline at end of file +garry \ No newline at end of file diff --git a/readthedocs/telethon.events.rst b/readthedocs/telethon.events.rst deleted file mode 100644 index 37ce9f48..00000000 --- a/readthedocs/telethon.events.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _telethon-events-package: - -telethon\.events package -======================== - -.. automodule:: telethon.events - :members: - :undoc-members: - :show-inheritance: diff --git a/run_tests.py b/run_tests.py index d99cfb56..7ed5e314 100755 --- a/run_tests.py +++ b/run_tests.py @@ -2,7 +2,7 @@ import unittest if __name__ == '__main__': - from telethon_tests import \ + from garry_tests import \ CryptoTests, ParserTests, TLTests, UtilsTests, NetworkTests test_classes = [CryptoTests, ParserTests, TLTests, UtilsTests] diff --git a/setup.py b/setup.py index 7178c131..9b8fc2de 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject Extra supported commands are: -* gen_tl, to generate the classes required for Telethon to run +* gen_tl, to generate the classes required for Garry to run * clean_tl, to clean these generated classes * pypi, to generate sdist, bdist_wheel, and push to PyPi """ @@ -37,17 +37,17 @@ class TempWorkDir: os.chdir(self.original) -ERROR_LIST = 'telethon/errors/rpc_error_list.py' -ERRORS_JSON = 'telethon_generator/errors.json' -ERRORS_DESC = 'telethon_generator/error_descriptions' -SCHEME_TL = 'telethon_generator/scheme.tl' -GENERATOR_DIR = 'telethon/tl' +ERROR_LIST = 'garry/errors/rpc_error_list.py' +ERRORS_JSON = 'garry_generator/errors.json' +ERRORS_DESC = 'garry_generator/error_descriptions' +SCHEME_TL = 'garry_generator/scheme.tl' +GENERATOR_DIR = 'garry/tl' IMPORT_DEPTH = 2 def gen_tl(force=True): - from telethon_generator.tl_generator import TLGenerator - from telethon_generator.error_generator import generate_code + from garry_generator.tl_generator import TLGenerator + from garry_generator.error_generator import generate_code generator = TLGenerator(GENERATOR_DIR) if generator.tlobjects_exist(): if not force: @@ -67,7 +67,7 @@ def main(): gen_tl() elif len(argv) >= 2 and argv[1] == 'clean_tl': - from telethon_generator.tl_generator import TLGenerator + from garry_generator.tl_generator import TLGenerator print('Cleaning...') TLGenerator(GENERATOR_DIR).clean_tlobjects() print('Done.') @@ -76,28 +76,28 @@ def main(): # (Re)generate the code to make sure we don't push without it gen_tl() - # Try importing the telethon module to assert it has no errors + # Try importing the garry module to assert it has no errors try: - import telethon + import garry except: print('Packaging for PyPi aborted, importing the module failed.') return - # Need python3.5 or higher, but Telethon is supposed to support 3.x + # Need python3.5 or higher, but Garry is supposed to support 3.x # Place it here since noone should be running ./setup.py pypi anyway from subprocess import run from shutil import rmtree - for x in ('build', 'dist', 'Telethon.egg-info'): + for x in ('build', 'dist', 'Garry.egg-info'): rmtree(x, ignore_errors=True) run('python3 setup.py sdist', shell=True) run('python3 setup.py bdist_wheel', shell=True) run('twine upload dist/*', shell=True) - for x in ('build', 'dist', 'Telethon.egg-info'): + for x in ('build', 'dist', 'Garry.egg-info'): rmtree(x, ignore_errors=True) elif len(argv) >= 2 and argv[1] == 'fetch_errors': - from telethon_generator.error_generator import fetch_errors + from garry_generator.error_generator import fetch_errors fetch_errors(ERRORS_JSON) else: @@ -109,17 +109,17 @@ def main(): with open('README.rst', encoding='utf-8') as f: long_description = f.read() - with open('telethon/version.py', encoding='utf-8') as f: + with open('garry/version.py', encoding='utf-8') as f: version = re.search(r"^__version__\s*=\s*'(.*)'.*$", f.read(), flags=re.MULTILINE).group(1) setup( - name='Telethon', + name='Garry', version=version, description="Full-featured Telegram client library for Python 3", long_description=long_description, - url='https://github.com/LonamiWebs/Telethon', - download_url='https://github.com/LonamiWebs/Telethon/releases', + url='https://github.com/LonamiWebs/Garry', + download_url='https://github.com/LonamiWebs/Garry/releases', author='Lonami Exo', author_email='totufals@hotmail.com', @@ -146,12 +146,12 @@ def main(): ], keywords='telegram api chat client library messaging mtproto', packages=find_packages(exclude=[ - 'telethon_generator', 'telethon_tests', 'run_tests.py', - 'try_telethon.py', - 'telethon_generator/parser/__init__.py', - 'telethon_generator/parser/source_builder.py', - 'telethon_generator/parser/tl_object.py', - 'telethon_generator/parser/tl_parser.py', + 'garry_generator', 'garry_tests', 'run_tests.py', + 'try_garry.py', + 'garry_generator/parser/__init__.py', + 'garry_generator/parser/source_builder.py', + 'garry_generator/parser/tl_object.py', + 'garry_generator/parser/tl_parser.py', ]), install_requires=['pyaes', 'rsa', 'typing' if version_info < (3, 5, 2) else ""], diff --git a/try_telethon.py b/try_garry.py similarity index 96% rename from try_telethon.py rename to try_garry.py index 74eb08c0..2a8c8650 100755 --- a/try_telethon.py +++ b/try_garry.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import traceback -from telethon_examples.interactive_telegram_client \ +from garry_examples.interactive_telegram_client \ import InteractiveTelegramClient