mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Update documentation to reflect new methods
This commit is contained in:
parent
eda8d0dbc8
commit
1b424b3fe7
|
@ -402,7 +402,7 @@ location, phone number, or simply for them to easily send a message:
|
|||
.. code-block:: python
|
||||
|
||||
client.send_message(chat, 'Welcome', buttons=[
|
||||
Button.text('Thanks!'),
|
||||
Button.text('Thanks!', resize=True, single_use=True),
|
||||
Button.request_phone('Send phone'),
|
||||
Button.request_location('Send location')
|
||||
])
|
||||
|
@ -644,3 +644,36 @@ Note that the utils package also has a `get_peer_id
|
|||
<telethon.utils.get_peer_id>` but it won't work with things
|
||||
that need access to the network such as usernames or phones,
|
||||
which need to be in your contact list.
|
||||
|
||||
Getting the Admin Log
|
||||
*********************
|
||||
|
||||
If you're an administrator in a channel or megagroup, then you have access
|
||||
to the admin log. This is a list of events within the last 48 hours of
|
||||
different actions, such as joining or leaving members, edited or deleted
|
||||
messages, new promotions, bans or restrictions.
|
||||
|
||||
You can iterate over all the available actions like so:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
for event in client.iter_admin_log(channel):
|
||||
if event.changed_title:
|
||||
print('The title changed from', event.old, 'to', event.new)
|
||||
|
||||
You can also filter to only show some text or actions.
|
||||
Let's find people who swear to ban them:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Get a list of deleted message events which said "heck"
|
||||
events = client.get_admin_log(channel, search='heck', delete=True)
|
||||
|
||||
# Print the old message before it was deleted
|
||||
print(events[0].old)
|
||||
|
||||
You can find here the documentation for `client.iter_admin_log
|
||||
<telethon.client.chats.ChatMethods.iter_admin_log>`, and be sure
|
||||
to also check the properties of the returned `AdminLogEvent
|
||||
<telethon.tl.custom.adminlogevent.AdminLogEvent>` to know what
|
||||
you can access.
|
||||
|
|
|
@ -19,6 +19,7 @@ when you upgrade!
|
|||
* Are you new here? Jump straight into :ref:`getting-started`!
|
||||
* Looking for available friendly methods? See :ref:`telethon-client`.
|
||||
* Used Telethon before v1.0? See :ref:`compatibility-and-convenience`.
|
||||
* Need the full API reference? https://lonamiwebs.github.io/Telethon/.
|
||||
|
||||
|
||||
What is this?
|
||||
|
|
|
@ -97,3 +97,11 @@ telethon\.tl\.custom\.conversation module
|
|||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
telethon\.tl\.custom\.adminlogevent module
|
||||
------------------------------------------
|
||||
|
||||
.. automodule:: telethon.tl.custom.adminlogevent
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
|
|
@ -41,6 +41,7 @@ CHAT_ADMIN_REQUIRED,400 403,"Chat admin privileges are required to do that in th
|
|||
CHAT_FORBIDDEN,,You cannot write in this chat
|
||||
CHAT_ID_EMPTY,400,The provided chat ID is empty
|
||||
CHAT_ID_INVALID,400,"Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead"
|
||||
CHAT_INVALID,400,The chat is invalid for this request
|
||||
CHAT_NOT_MODIFIED,400,"The chat or channel wasn't modified (title, invites, username, admins, etc. are the same)"
|
||||
CHAT_RESTRICTED,400,The chat is restricted and cannot be used in that request
|
||||
CHAT_SEND_GIFS_FORBIDDEN,403,You can't send gifs in this chat
|
||||
|
|
|
|
@ -54,7 +54,7 @@ channels.getFullChannel,unknown,CHANNEL_INVALID CHANNEL_PRIVATE CHANNEL_PUBLIC_G
|
|||
channels.getMessages,unknown,CHANNEL_INVALID CHANNEL_PRIVATE MESSAGE_IDS_EMPTY
|
||||
channels.getParticipant,unknown,CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED USER_ID_INVALID USER_NOT_PARTICIPANT
|
||||
channels.getParticipants,unknown,CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED INPUT_CONSTRUCTOR_INVALID Timeout
|
||||
channels.inviteToChannel,user,BOTS_TOO_MUCH BOT_GROUPS_BLOCKED CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED CHAT_WRITE_FORBIDDEN INPUT_USER_DEACTIVATED USERS_TOO_MUCH USER_BANNED_IN_CHANNEL USER_BLOCKED USER_BOT USER_CHANNELS_TOO_MUCH USER_ID_INVALID USER_KICKED USER_NOT_MUTUAL_CONTACT USER_PRIVACY_RESTRICTED
|
||||
channels.inviteToChannel,user,BOTS_TOO_MUCH BOT_GROUPS_BLOCKED CHANNEL_INVALID CHANNEL_PRIVATE CHAT_ADMIN_REQUIRED CHAT_INVALID CHAT_WRITE_FORBIDDEN INPUT_USER_DEACTIVATED USERS_TOO_MUCH USER_BANNED_IN_CHANNEL USER_BLOCKED USER_BOT USER_CHANNELS_TOO_MUCH USER_ID_INVALID USER_KICKED USER_NOT_MUTUAL_CONTACT USER_PRIVACY_RESTRICTED
|
||||
channels.joinChannel,user,CHANNELS_TOO_MUCH CHANNEL_INVALID CHANNEL_PRIVATE
|
||||
channels.leaveChannel,unknown,CHANNEL_INVALID CHANNEL_PRIVATE CHANNEL_PUBLIC_GROUP_NA USER_CREATOR USER_NOT_PARTICIPANT
|
||||
channels.readHistory,user,CHANNEL_INVALID CHANNEL_PRIVATE
|
||||
|
|
|
Loading…
Reference in New Issue
Block a user