Closed abdhass closed 5 years ago
Excuse i ask here @abdhass, did you get messages.getHistory to work in channels? I only get CODE#400 PEER_ID_INVALID sending stuff like this:
peer: {
"_": "inputPeerChannel",
"channel_id": 1245892652,
"access_hash": "2078923260725999679"
},
limit: 3
is there any format mistake?
Yes I did @ismenc Try this... taken from the examples folder
peer: {
_ : 'inputPeerChannel',
channel_id : chat.id,
access_hash: chat.access_hash
},
max_id: offset,
offset: -full.length,
limit
Thanks m8. After some time i realized the problem was i was using readHistory instead of getHistory. Sad life >.<
Issue
From the examples folder, if you run the chat history with a limit of 5 this happens:
2:19 [undefined] msg 1 22:19 [undefined] msg 2 15:13 [undefined] msg 3 15:9 [undefined] msg 4 13:44 [undefined] msg 5 22:19 [undefined] msg 2 << repeats from here 15:13 [undefined] msg 3 15:9 [undefined] msg 4 13:44 [undefined] msg 5
Seems like messages.getHistory doesnt offset from the max_id
in this case, the maximum messages in the telegram group i was querying is 32.
To test this:
Be in a channel you can test this issue.
npm install
Uncomment chat and chathistory lines in examples/index.js
Update to
dev:false
in examples/init.jsconst server = { webogram: true, dev: false }
In chat-history.js change the limit to 5
const limit = 5
runnode examples/index.js
After logging in, choose a channel.
Im actually having this problem in my own app, but thought id test it in a new clone of this repo and the problem is there too.
Any advice appreciated. Thanks!