Comments (15)
With limit 20 works fine, but with limit 200 returns only 100 chats.
Correct chats order returns by events updateChatOrder
. And paging with them works! Thanks!
from phptdlib.
with limit 200 returns only 100 chats.
Due to the docs,
For optimal performance the number of returned chats is chosen by the library.
Tdlib will not return more then 100 chats because of it's internal limit.
from phptdlib.
Getting the list of chats is also covered by https://core.telegram.org/tdlib/getting-started#getting-the-list-of-chats.
from phptdlib.
Seems this and this might help. Can you provide some your code for reproducing? When I try to query getChats
it seems works as expected: "{"@type":"chats","chat_ids":[ids],"@extra":1681692777}"
from phptdlib.
I wanna get all my chats, but tdlib returns last 100. It seems i have to pass pair chat.order and chat.id. But chat.order always equals "0"
Request:
{
"@type": "getChat",
"chat_id": -1001316515825,
"@extra": "3a7635623e2144d8421a694c23c8c87c"
}
Response:
{
"@type": "chat",
"id": -1001316515825,
"type": {
"@type": "chatTypeSupergroup",
"supergroup_id": 1316515825,
"is_channel": false
},
"title": "ildar_test_group_4",
"last_message": {
"@type": "message",
"id": 46137344,
"sender_user_id": 205997042,
"chat_id": -1001316515825,
"is_outgoing": true,
"can_be_edited": true,
"can_be_forwarded": true,
"can_be_deleted_only_for_self": false,
"can_be_deleted_for_all_users": true,
"is_channel_post": false,
"contains_unread_mention": false,
"date": 1565181834,
"edit_date": 0,
"reply_to_message_id": 0,
"ttl": 0,
"ttl_expires_in": 0.000000,
"via_bot_user_id": 0,
"author_signature": "",
"views": 0,
"media_album_id": "0",
"content": {
"@type": "messageText",
"text": {
"@type": "formattedText",
"text": "ddddddddddddddddddddddddd",
"entities": []
}
}
},
"order": "0", ------------------------------------------------- ?????---------------------------
"is_pinned": false,
"is_marked_as_unread": false,
"is_sponsored": false,
"can_be_deleted_only_for_self": false,
"can_be_deleted_for_all_users": false,
"can_be_reported": false,
"default_disable_notification": false,
"unread_count": 0,
"last_read_inbox_message_id": 46137344,
"last_read_outbox_message_id": 19922944,
"unread_mention_count": 0,
"notification_settings": {
"@type": "chatNotificationSettings",
"use_default_mute_for": true,
"mute_for": 0,
"use_default_sound": true,
"sound": "default",
"use_default_show_preview": true,
"show_preview": false,
"use_default_disable_pinned_message_notifications": true,
"disable_pinned_message_notifications": false,
"use_default_disable_mention_notifications": true,
"disable_mention_notifications": false
},
"pinned_message_id": 0,
"reply_markup_message_id": 0,
"client_data": "",
"@extra": "3a7635623e2144d8421a694c23c8c87c"
}
from phptdlib.
Hm, interesting question =)
std::int64_t | order_ Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined.
From docs
And if you want to receive more than 100 chats use getChats
with limit
parameter. Also with offset if needs. Something like: {"@type": "getChats", "limit": 200, "@extra": "1"}
In response you will receive chat_ids
, which you can use if need detailed information for each ("@type": "getChat", "chat_id": $id
).
from phptdlib.
"limit": 200 - doesn't work, returns only 100 chats
from phptdlib.
And i can't paging it, because last chat order is equal "0"
from phptdlib.
"limit": 200 - doesn't work, returns only 100 chats
try this: {"@type":"getChats","limit":200,"offset_order":9223372036854775807,"offset_chat_id":0}
. Same behavior for you? I can't check at this moment because in response I have received empty list =) If yes, you should ask (or find existing) about this in tdlib/td.
And i can't paging it, because last chat order is equal "0"
If the order number of two chats is the same, they must be sorted in descending order by ID
from phptdlib.
If I correctly understood what you want to achieve, than you need use offset_chat_id
. For example, collected first 100. Store last chat_id. For next page you should pass just offset_chat_id
. But I don't know if this is correct way. Actually this question more likely related to tdlib/td, not the extension. And I would be happy to help, but thatβs all I can say. Please let me know how the problem was solved and whether it was solved at all.
from phptdlib.
Request:
{
"@type": "getChats",
"limit": 200,
"offset_order": 9223372036854775807,
"offset_chat_id": 0,
"@extra": "f5c93e3b26c383ca2e775cb54b808509"
}
Response:
{
"@type": "chats",
"chat_ids": [========100 items ===========],
"@extra": "f5c93e3b26c383ca2e775cb54b808509"
}
from phptdlib.
Thanks! It seems bug in tdlib
from phptdlib.
ping @levlam
Is that bug, or something wrong in this extension? Or we doing something wrong?
from phptdlib.
"{"@type":"getChats","limit":200,"offset_order":9223372036854775807,"offset_chat_id":0}"
[ 3][t 4][1565260465.402750969][Td.cpp:3285][#1][!Td][&td_requests] Receive request 3: getChats {
offset_order = 9223372036854775807
offset_chat_id = 0
limit = 200
}
[ 3][t 4][1565260465.403002262][MessagesManager.cpp:11455][#1][!GetChatsRequest] Get chats with offset [9223372036854775807, 0] and limit 200. Know about order of 0 chat(s). last_dialog_date_ = [9223372036854775807, 0], last_server_dialog_date_ = [9223372036854775807, 0], last_loaded_database_dialog_date_ = [9223372036854775807, 0]
[ 3][t 4][1565260465.403044224][MessagesManager.cpp:11487][#1][!GetChatsRequest] Load dialog list with limit 100
[ 3][t 4][1565260465.403148174][MessagesManager.cpp:11521][#1][!GetChatsRequest] Load 100 dialogs from database from [9223372036854775807, 0], last database server dialog date = [0, 0]
[ 3][t 1][1565260465.403553724][DialogDb.cpp:208][#1][!DialogDbActor] Load chat 777000 with order 6721688753850548233
[ 3][t 4][1565260465.404390335][MessagesManager.cpp:11537][#1][!MessagesManager] Receive 1 from expected 100 dialogs in result of GetDialogsFromDatabase
[ 3][t 4][1565260465.404471397][MessagesManager.cpp:24587][#1][!MessagesManager] Loaded chat 777000 of size 624 from database
[ 3][t 4][1565260465.404742002][MessagesManager.cpp:4065][#1][!MessagesManager] Set unread mention message count in chat 777000 to -1
[ 3][t 4][1565260465.405164719][ContactsManager.cpp:5478][#1][!MessagesManager] Trying to load user 777000 from database
[ 3][t 4][1565260465.405285120][ContactsManager.cpp:5385][#1][!MessagesManager] Successfully loaded user 777000 of size 64 from database
[ 4][t 4][1565260465.405455828][ContactsManager.cpp:6203][#1][!MessagesManager] Cancel online timeout for user 777000
...
[ 3][t 4][1565260465.407611609][MessagesManager.cpp:8459][#1][!MessagesManager] Recalculate unread counts
[ 4][t 4][1565260465.407623529][MessagesManager.cpp:8482][#1][!MessagesManager] Have 9 messages in chat 777000
[ 3][t 4][1565260465.407636404][MessagesManager.cpp:11583][#1][!MessagesManager] Schedule chat list preload
[ 3][t 4][1565260465.407859564][MessagesManager.cpp:11455][#1][!GetChatsRequest] Get chats with offset [9223372036854775807, 0] and limit 200. Know about order of 1 chat(s). last_dialog_date_ = [0, 0], last_server_dialog_date_ = [0, 0], last_loaded_database_dialog_date_ = [0, 0]
[ 3][t 4][1565260465.407997608][Td.cpp:4395][#1][!Td][&td_requests] Sending result for request 3: chats {
chat_ids = vector[1] {
777000
}
}
from phptdlib.
I have just tested with limit 20. Works fine. @ildarsaitkulov can you check please? I can't test with limit 200, cause I have just 40 channels =) Seems that not a bug in tdlib/td.
from phptdlib.
Related Issues (20)
- /usr/include/phpcpp/throwable.h:29:1: error: expected class-name before β{β token HOT 3
- Valid api_id must be provided. Can be obtained at https://my.telegram.org HOT 4
- SendMessage Issue HOT 4
- What is the problem?The server system is centos7
- Setup on WIndows 10 HOT 1
- How do I upgrade tdlib from version 1.8.10 to the latest 1.8.25? HOT 6
- more example HOT 1
- TDApi and TDLib not visible on PHP HOT 13
- TdConfig.cmake version: unknown HOT 13
- Please add example callback definition on new message event HOT 1
- Error while cmake HOT 1
- how to add a contact with phptdlib? HOT 4
- How to send a message to a newly added contact.? HOT 7
- how to integrate phptdlib in laravel HOT 1
- importContacts causes an error HOT 4
- how to accept terms of service in authorizationStateWaitRegistration? HOT 4
- Migrate from Travis CI to Github Actions
- setAuthenticationPhoneNumber Verify phone number timed out HOT 8
- Compile error on MessagesManager.cpp.o HOT 2
- Fatal error when git cloning this repo (submodules): "The unauthenticated git protocol on port 9418 is no longer supported."
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phptdlib.