stuyy/Katana

This error occurs when the bot receives a lot of message.

dongsu8142 opened this issue · 6 comments

error: Uncaught TypeError: Cannot read property 'id' of undefined
let user: User = client.users.get(author.id);
^
at buildMessage (https://deno.land/x/katana/src/utils/resolvers.ts:252:44)
at TextChannel.send (https://deno.land/x/katana/src/models/channels/TextChannel.ts:57:20)

stuyy commented

Yup. It's because you're getting rate limited from the Gateway, so it sends a Payload with an error message. Will have to handle this and apply some sort of rate limit.

I hope this problem will be solved quickly and API will grow a lot.

stuyy commented

Yep, since the API allows 120 requests per 60 seconds, that means you can only send 2 events per second. So I might just add a setTimeout(). However, I may set up a PriorityQueue structure and use that to handle events to prevent rate limiting. Will have to experiment. Thank you for bringing this up.

I want you to fix the error quickly.

Stuff like this takes time, give the man a break

okay I'm sorry I rushed you.