Closed SnapdragonLee closed 5 months ago
If I change chat_id to any other chats, or change type to photo/file no behaviors either.
You can use only identifiers received from TDLib, therefore you must receive the chat_id
from TDLib before you can use it.
Additionally, you can check TDLib logs to see requests received by TDLib and their responses.
You can use only identifiers received from TDLib, therefore you must receive the
chat_id
from TDLib before you can use it.Additionally, you can check TDLib logs to see requests received by TDLib and their responses.
Thanks for the reply. From my side, I could see the identifiers in a 10 digits format, and I have handled the json event each time I send to myself on other clients.
For the TDLib, what level of logs should I use? level 2? I may have a try to redirect stdout to a file.
You need level 3 or bigger to see all requests in the log.
OK, I have do some tests on daemon thread.
time.sleep(3)
td_send({
# '@type': 'loadChats',
# 'limit': 1
'@type': 'getChat',
'chat_id': {19xxxxxxxxx}
})
time.sleep(3)
td_send({
"@type": "sendMessage",
"chat_id": 19xxxxxxxxx,
"input_message_content": {
"@type": "inputMessageText",
"text": {
"@type": "formattedText",
"text": "Hello, this is a test message."
}
}
})
The first one, loadChats and limit set to 1, I could send this message. But for the second, openChat or getChat, the log in severity 3 reports that Chat is not found with a 400 return. Why I got this thing? Just a little bit confusing.
A "Chat not found" error means that you are trying to pass a hardcoded chat identifier to TDLib. You can only use identifiers received from the same TDLIb instance programmatically.
I'm sorry that I may not get you. I just wanna send something to 'Saved Message' by TdLib. How could I manage this before sent sendMessage to target chat_id: 19xxxxxxxxx? What function should I call for receiving the chat_id?
You need to use getMe
to get the current user, then use createPrivateChat
with received user_id
to create the chat with self, and then use received chat identifier to send messages.
Because of the simple event handler architechture in python, I'm using tdjson to send text/file/photo to myself.
Why there's no return/sending behavior or any traceback error after excuted this command? Actually, this text has not been sent to my chat.