mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 13:29:47 +00:00
Update iter_ usages with get_
This commit is contained in:
@@ -32,7 +32,7 @@ use these if possible.
|
||||
print(me.phone)
|
||||
|
||||
# You can print all the dialogs/conversations that you are part of:
|
||||
async for dialog in client.iter_dialogs():
|
||||
async for dialog in client.get_dialogs():
|
||||
print(dialog.name, 'has ID', dialog.id)
|
||||
|
||||
# You can send messages to yourself...
|
||||
@@ -62,7 +62,7 @@ use these if possible.
|
||||
await client.send_file('me', '/home/me/Pictures/holidays.jpg')
|
||||
|
||||
# You can print the message history of any chat:
|
||||
async for message in client.iter_messages('me'):
|
||||
async for message in client.get_messages('me'):
|
||||
print(message.id, message.text)
|
||||
|
||||
# You can download media from messages, too!
|
||||
|
@@ -75,7 +75,7 @@ loops or use ``async with``:
|
||||
async with client:
|
||||
# ^ this is an asynchronous with block
|
||||
|
||||
async for message in client.iter_messages(chat):
|
||||
async for message in client.get_messages(chat):
|
||||
# ^ this is a for loop over an asynchronous generator
|
||||
|
||||
print(message.sender.username)
|
||||
|
@@ -28,7 +28,7 @@ In short, you should do this:
|
||||
buttons = await event.get_buttons()
|
||||
|
||||
async def main():
|
||||
async for message in client.iter_messages('me', 10):
|
||||
async for message in client.get_messages('me', 10):
|
||||
# Methods from the client always have these properties ready
|
||||
chat = message.input_chat
|
||||
sender = message.sender
|
||||
|
@@ -159,8 +159,8 @@ AdminLogEvent
|
||||
=============
|
||||
|
||||
The `AdminLogEvent <telethon.tl.custom.adminlogevent.AdminLogEvent>` object
|
||||
is returned by the `client.iter_admin_log()
|
||||
<telethon.client.chats.ChatMethods.iter_admin_log>` method to easily iterate
|
||||
is returned by the `client.get_admin_log()
|
||||
<telethon.client.chats.ChatMethods.get_admin_log>` method to easily iterate
|
||||
over past "events" (deleted messages, edits, title changes, leaving members…)
|
||||
|
||||
These are all the properties you can find in it:
|
||||
@@ -270,7 +270,7 @@ Dialog
|
||||
======
|
||||
|
||||
The `Dialog <telethon.tl.custom.dialog.Dialog>` object is returned when
|
||||
you call `client.iter_dialogs() <telethon.client.dialogs.DialogMethods.iter_dialogs>`.
|
||||
you call `client.get_dialogs() <telethon.client.dialogs.DialogMethods.get_dialogs>`.
|
||||
|
||||
.. currentmodule:: telethon.tl.custom.dialog.Dialog
|
||||
|
||||
@@ -286,7 +286,7 @@ Draft
|
||||
======
|
||||
|
||||
The `Draft <telethon.tl.custom.draft.Draft>` object is returned when
|
||||
you call `client.iter_drafts() <telethon.client.dialogs.DialogMethods.iter_drafts>`.
|
||||
you call `client.get_drafts() <telethon.client.dialogs.DialogMethods.get_drafts>`.
|
||||
|
||||
.. currentmodule:: telethon.tl.custom.draft.Draft
|
||||
|
||||
|
Reference in New Issue
Block a user