From bc799fd82c3ff6aa83040a82ec292e964fcccafe Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sun, 23 Aug 2020 11:45:45 +0200 Subject: [PATCH] Remove usage of the main group username in the docs --- readthedocs/basic/quick-start.rst | 2 +- readthedocs/concepts/asyncio.rst | 21 ++++++++++----------- readthedocs/concepts/entities.rst | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/readthedocs/basic/quick-start.rst b/readthedocs/basic/quick-start.rst index 91481983..b3168701 100644 --- a/readthedocs/basic/quick-start.rst +++ b/readthedocs/basic/quick-start.rst @@ -41,7 +41,7 @@ use these if possible. # ...to your contacts await client.send_message('+34600123123', 'Hello, friend!') # ...or even to any username - await client.send_message('TelethonChat', 'Hello, Telethon!') + await client.send_message('username', 'Testing Telethon!') # You can, of course, use markdown in your messages: message = await client.send_message( diff --git a/readthedocs/concepts/asyncio.rst b/readthedocs/concepts/asyncio.rst index eabb8f76..ef7c3cd3 100644 --- a/readthedocs/concepts/asyncio.rst +++ b/readthedocs/concepts/asyncio.rst @@ -310,27 +310,26 @@ you can run requests in parallel: async def main(): last, sent, download_path = await asyncio.gather( - client.get_messages('TelethonChat', 10), - client.send_message('TelethonOfftopic', 'Hey guys!'), - client.download_profile_photo('TelethonChat') + client.get_messages('telegram', 10), + client.send_message('me', 'Using asyncio!'), + client.download_profile_photo('telegram') ) loop.run_until_complete(main()) -This code will get the 10 last messages from `@TelethonChat -`_, send one to `@TelethonOfftopic -`_, and also download the profile -photo of the main group. `asyncio` will run all these three tasks -at the same time. You can run all the tasks you want this way. +This code will get the 10 last messages from `@telegram +`_, send one to the chat with yourself, and also +download the profile photo of the channel. `asyncio` will run all these +three tasks at the same time. You can run all the tasks you want this way. A different way would be: .. code-block:: python - loop.create_task(client.get_messages('TelethonChat', 10)) - loop.create_task(client.send_message('TelethonOfftopic', 'Hey guys!')) - loop.create_task(client.download_profile_photo('TelethonChat')) + loop.create_task(client.get_messages('telegram', 10)) + loop.create_task(client.send_message('me', 'Using asyncio!')) + loop.create_task(client.download_profile_photo('telegram')) They will run in the background as long as the loop is running too. diff --git a/readthedocs/concepts/entities.rst b/readthedocs/concepts/entities.rst index d05d1040..4ee55d48 100644 --- a/readthedocs/concepts/entities.rst +++ b/readthedocs/concepts/entities.rst @@ -296,10 +296,10 @@ applications"? Now do the same with the library. Use what applies: await client.get_dialogs() # Are they participant of some group? Get them. - await client.get_participants('TelethonChat') + await client.get_participants('username') # Is the entity the original sender of a forwarded message? Get it. - await client.get_messages('TelethonChat', 100) + await client.get_messages('username', 100) # NOW you can use the ID, anywhere! await client.send_message(123456, 'Hi!')