Closed culexjj closed 10 months ago
Hello
I'm using the Java TDLib Example for my thesis and I need to get the output from 'TdApi.SearchChatMessages' function in order to save it on a file.
Checking the API I see it should returns a FoundChatMessages object but I have problems to get it.
e.g: If I run it this way --> client.send(new TdApi.SearchChatMessages(chat, "me imagino", null, 0, 0, 10, null, 0), defaultHandler);
The function runs properly and shows on the console the output but I can't get the FoundChatMessages object for saving after in a file
FoundChatMessages { totalCount = 2 messages = vector[2] { Message { id = 46990884864 senderId = MessageSenderUser { userId = 79259861 } chatId = -1001281593169 sendingState = null ...........
The closer I got is next but the output isn't right since I get the query not the output
private static void getChatMessages(final int limit, final long chat) { client.send( (chatMessages = (new TdApi.SearchChatMessages(chat, "me imagino", null, 0, 0, 10, null, 0))), defaultHandler); System.out.println( "CHAT MESSAGES: " + chatMessages); }
CHAT MESSAGES: SearchChatMessages { chatId = -1001281593169 query = "me imagino" senderId = null fromMessageId = 0 offset = 0 limit = 10 filter = null messageThreadId = 0 }
Can you give some advice?
Br
Culex
See https://core.telegram.org/tdlib/getting-started and mentioned there Java example. You need to provide handler for the request and handle response there.
Thanks, it working now :)
Hello
I'm using the Java TDLib Example for my thesis and I need to get the output from 'TdApi.SearchChatMessages' function in order to save it on a file.
Checking the API I see it should returns a FoundChatMessages object but I have problems to get it.
e.g: If I run it this way --> client.send(new TdApi.SearchChatMessages(chat, "me imagino", null, 0, 0, 10, null, 0), defaultHandler);
The function runs properly and shows on the console the output but I can't get the FoundChatMessages object for saving after in a file
FoundChatMessages { totalCount = 2 messages = vector[2] { Message { id = 46990884864 senderId = MessageSenderUser { userId = 79259861 } chatId = -1001281593169 sendingState = null ...........
The closer I got is next but the output isn't right since I get the query not the output
private static void getChatMessages(final int limit, final long chat) {
client.send( (chatMessages = (new TdApi.SearchChatMessages(chat, "me imagino", null, 0, 0, 10, null, 0))), defaultHandler);
System.out.println( "CHAT MESSAGES: " + chatMessages); }
CHAT MESSAGES: SearchChatMessages { chatId = -1001281593169 query = "me imagino" senderId = null fromMessageId = 0 offset = 0 limit = 10 filter = null messageThreadId = 0 }
Can you give some advice?
Br
Culex