Sun
Sun
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
I did not consider that! Yes the await activateUpdateUser(interaction); is an async call and this does check the db. I previously had this as a header more or less on each individual command, thought it would be simplified here as this will be called on every interaction the same way. It seems like this is not the wisest decision in hindsight. I imagine my belief "it never takes more than ms to run x so it shouldn't cause a problem" - is absolutely faulty logic. So I need to fully rethink how I handle these interactions and commands, and rework a large portion - I am thankful just to have a direction to move in. I believe I may have saved myself a bit of work in how I implemented a potential defer mechanic (which I haven't used or tested yet but will get plenty of practice with) where I intended to "import" the defer in the command call in the interaction handler:
const {
data = null,
moderator = false,
maintenance = false,
deferReply = false,
cooldownCount = null,
subCommand = null,
subCooldownCount = null,
} = command;

if (deferReply) {
console.error('defer command');
console.error(interaction.member.user.username, interaction.member.id);
interaction.deferReply();
console.error('exit', interaction.member.user.username, interaction.member.id);
}
const {
data = null,
moderator = false,
maintenance = false,
deferReply = false,
cooldownCount = null,
subCommand = null,
subCooldownCount = null,
} = command;

if (deferReply) {
console.error('defer command');
console.error(interaction.member.user.username, interaction.member.id);
interaction.deferReply();
console.error('exit', interaction.member.user.username, interaction.member.id);
}
I genuinely appreciate all of your insights so far Qjuh, hopefully it comes across that this has been an awesome learning experience for me! I'd been flying completely solo so far lol. If there were any other take-aways or suggestions you feel might be relevant or something you feel I should implement (or most likely misunderstood!), I would be all ears and most appreciative!
9 replies
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
Awesome thank you! That is definitely awesome information to have corrected - and gives me a bit of work because that is practically how every command I've made so far is built haha. If you have a spare moment sometime (of course feel no obligation I appreciate all of your help so far!) would you mind looking at the ping command with me? https://github.com/sun-cv/Bot_Geo/blob/master/commands/utility/ping.js I have seen the exact error on this command as well and it is I believe a full async task (minus the interaction.reply) - there is no resolving required just simple if true checks and it has still triggered that error before. Unless I am missing something entirely it seems like we may still not be at the root cause?
9 replies
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
Just to ask as a follow up - my understanding of asynchronous tasks was that they can continue to process all at once - unless we are resolving a specific promise in which case we have to await that resolve/reject. When you say to defer before async tasks you mean when we are required to wait/resolve those functions inside a command?
9 replies
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
I need a Piccard level face palm for that one haha
9 replies
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
I see! Perhaps this was a wrong impression I caught early on, what I believed to more or less mean: "never defer unless absolutely needed" - and as such have followed that practice Could this just have been bad advice and is there no harm in doing so? Especially when I am awaiting multiple functions inside of the commands?
9 replies
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
Absolutely! I appreciate you taking the time. Feel like a bit of a fool could have posted the git anytime: https://github.com/sun-cv/Bot_Geo The Pull command specifically: https://github.com/sun-cv/Bot_Geo/blob/master/commands/mercy/pull/pull.js
9 replies
DIAdiscord.js - Imagine an app
Created by Sun on 3/21/2024 in #djs-questions
DiscordAPIError[10062] With no consistent reproducibility
No description
9 replies