luzede
DIAdiscord.js - Imagine an app
•Created by luzede on 6/17/2024 in #djs-questions
client.on() not handling/accepting requests when awaiting response from SQLite when it is busy
This is how I register events in index.ts
This code is run on "InteractionCreate" event
The first interaction gets received and runs
deferReply
and then execute(interaction, db)
But while the call to the database
is running inside the execute(interaction, db)
Any more slash command requests are not going through the client.on(Events.InteractionCreate, ...)
event handler. Only when the call to the database is finished it receives responses. I tried using sleep command to see if by stopping the interaction from executing, subsequent calls would be ignored or not, but they were not, all the InteractionCreate events were going through and deferred even though the previous one had not finished fully responding.
I use better-sqlite3
and kysely
query builder and orm.
database.ts
index.ts
7 replies
DIAdiscord.js - Imagine an app
•Created by luzede on 6/16/2024 in #djs-questions
Any performance issues if non-async function runs an async, compared to running async alone
On discordjs.guide, this is suggested
But if I were to write manually
It would be like this, where the function in the client.on parameter would be async.
In the first one though, it is non-async function running an async function, will it have any performance issues?
3 replies
DIAdiscord.js - Imagine an app
•Created by luzede on 7/11/2022 in #djs-questions
message.delete is not a function (while deleting a reply to a command in DM)
On server the reply message is getting deleted normally but when I do it to replies in DM it fails and the program stops. Gives the following error:
TypeError: message.delete is not a function
I would use deleteReply()
but that does not work when I have edited the message with editReply()
. deleteReply()
works in DMs but only if I didn't edit the message.1 replies