Update README example

This commit is contained in:
Emery Hemingway 2024-05-21 20:02:48 +02:00
parent 5d347b2ba8
commit 7384d8393b
1 changed files with 47 additions and 3 deletions

View File

@ -26,6 +26,9 @@ let ?ds = dataspace
]
$ds [
?? <recv {"@type": "error", "code": ?code, "message": ?message}> [
$log ! <log "-" { error: {code: $code, message: $message } }>
]
?? <send ?v> [ $log ! <log "-" { |>>>|: $v }> ]
?? <recv ?v> [ $log ! <log "-" { |<<<|: $v }> ]
? ?v [ $log ! <log "-" { assertion: $v }> ]
@ -35,13 +38,13 @@ $ds [
?? <recv {"@type": "updateAuthorizationState", "authorization_state": {"@type": "authorizationStateWaitTdlibParameters"}}> [
! <send {
"@type":"setTdlibParameters"
"database_directory":"tdlib"
"database_directory":"/home/cache/tdlib"
"use_message_database":true
"use_secret_chats":true
"api_id": $api_id
"api_hash": $api_hash
"system_language_code":"en"
"device_model":"Desktop"
"system_language_code":"en-GB"
"device_model":"Phone Z"
"application_version":"1.0"
}>
]
@ -58,7 +61,48 @@ $ds [
"@type":"checkAuthenticationCode"
"code": $login_code
}>
]
?? <recv {"@type": "updateAuthorizationState", "authorization_state": {"@type": "authorizationStateReady"}}> [
! <send {
"@type": "loadChats"
"limit": 32
}>
]
?? <recv {"@type": "updateNewChat", "id": ?id,"chat": {"title": ?title}}> [
$ds <chat $id $title>
]
?? <recv {
"@type": "updateUser"
"user": {
"id": ?id
"first_name": ?first_name
"last_name": ?last_name
}
}> [
$ds <user $id $first_name $last_name>
]
?? <recv {
"@type": "updateChatLastMessage"
"chat_id": ?chat_id
"last_message": {
"content": {
"text": {
"text": ?text
}
}
"date": ?date
"sender_id": {
"user_id": ?user_id
}
}
}> [
$ds ? <user $user_id ?first_name> [
$log ! <log "-" { chat_id: $chat_id, first_name: $first_name, updateChatLastMessage: $text, date: $date, user_id: $user_id }>
]
]
]