Can I cache the peer information to redis and use it to send message?
See original GitHub issueDear all,
I have a task to send multiple messages to just ONE person by him username. I got this error
FloodWaitError: A wait of 24597 seconds is required (caused by contacts.ResolveUsername)
So, my idea is use Redis to cache the peer information and use it to sending message to the same people the next time.
I am following this article to rebuild the peer object by the cached information https://gram.js.org/beta/classes/Api.PeerUser.html
var u = {
peer: {
userId: BigInt(xxx),
className: 'PeerUser',
CONSTRUCTOR_ID: 1498486562,
SUBCLASS_OF_ID: 47470215,
classType: 'constructor'
}
}
var p = new Api.PeerUser(u.peer);
Then send message by the API
let res = await client.invoke(new Api.messages.SendMessage({
peer: p,
message: message
}));
console.log(res)
I got this error:
Error: Could not find the input entity for {"userId":"xxx","className":"PeerUser","CONSTRUCTOR_ID":1498486562,"SUBCLASS_OF_ID":47470215,"classType":"constructor"}.
Can you tell me why? Thanks for your time!
Issue Analytics
- State:
- Created a year ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Client-side caching in Redis
When client-side caching is used, the application will store the reply of popular ... This costs memory in the server side, but sends...
Read more >How to build a Chat application using Redis
In this tutorial, we will see how to develop real time messaging apps with Flask, Socket.IO and Redis. This example uses Redis Pub/sub ......
Read more >Let's learn how to to build a chat application with Redis ...
The connected chat users (clients) can send messages to the application ( WebSocket server) and can exchange messages with each other - similar ......
Read more >Realtime Collaborative Drawing (part 4): Redis PubSub + ...
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.
Read more >Implementing Caching in Node.js using Redis - Section.io
Caching refers to the process of storing data in a temporary location so that the data can be accessed with minimal resources.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
it’s not a bug. this is just how javascript works.
you can’t use normal numbers to represent big integers
I try
Helpers.returnBigInt('-3563441647559576810')
and it work. I think there is a bug at here