AcceptEncryptionRequest
Only users can use this request. See code examples.
---functions--- messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat
Returns
| EncryptedChat |
This type can be an instance of either:
| EncryptedChat | EncryptedChatDiscarded |
| EncryptedChatEmpty | EncryptedChatRequested |
| EncryptedChatWaiting |
Parameters
| peer | InputEncryptedChat | |
| g_b | bytes | |
| key_fingerprint | long |
Known RPC errors
This request can cause 4 known errors:
ChatIdInvalidError | 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. |
EncryptionAlreadyAcceptedError | Secret chat already accepted. |
EncryptionAlreadyDeclinedError | The secret chat was already declined. |
EncryptionOccupyFailedError | TDLib developer claimed it is not an error while accepting secret chats and 500 is used instead of 420. |
You can import these from telethon.errors.
Example
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.AcceptEncryptionRequest(
peer=types.InputEncryptedChat(
chat_id=478614198,
access_hash=-12398745604826
),
g_b=b'arbitrary\x7f data \xfa here',
key_fingerprint=-12398745604826
))
print(result.stringify())