No response from client

I don't know why and by the way the "Command" word printed is the on on the client.on('ready')..., not in the tickets_system slash command need help
30 Replies
d.js toolkit
d.js toolkitβ€’9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - βœ… Marked as resolved by OP
zeyad
zeyadβ€’9mo ago
Can you send the code in a bin?
zeyad
zeyadβ€’9mo ago
sourcebin or smth
brncray
brncrayβ€’9mo ago
off topic, but holy hot bar
zeyad
zeyadβ€’9mo ago
Go to https://sourceb.in and put your code there and copy the link
SourceBin
SourceBin | Sharing code made easy
Instantly share your code with the world.
zeyad
zeyadβ€’9mo ago
Then give the link here
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
https://sourceb.in/VcAv2as0kS I'm sorry, it's not ordered code but there is a general problem there the token in the bottom I changed it to an old one due to privacy
zeyad
zeyadβ€’9mo ago
You should not have too many event listeners to a single event
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
How can I do that, I didn't found a good course about that How to make it easier
brncray
brncrayβ€’9mo ago
to add to this you could have one event and then do something like
if (interaction.isButton()) {
let button = client.buttons.get(interaction.customId)

if (!button) return;
try {
await button.execute(interaction, client);
} catch (error) {
console.error(error);
}
if (interaction.isButton()) {
let button = client.buttons.get(interaction.customId)

if (!button) return;
try {
await button.execute(interaction, client);
} catch (error) {
console.error(error);
}
and then so on for commands, select menus etc (that would be inside your interactionCreate event)
zeyad
zeyadβ€’9mo ago
Exactly
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
Can I get an example from my code?
zeyad
zeyadβ€’9mo ago
@AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦ your issue is that you have too many listeners, and in each one you just return/ignore all other commands)
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
exactly Ah!
zeyad
zeyadβ€’9mo ago
In ur case, the first event should be the one that triggers first
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
I understand
zeyad
zeyadβ€’9mo ago
And you return all other commands that don't have the name 'manage'
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
you mean if it's about buttons, then I need only one event listener for them? and for slash commands one listener?
zeyad
zeyadβ€’9mo ago
Instead, put all your code under one event, and check if the command meets the if statement, not the other way around All interactions can go under one event
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
Ah, okay ok, I will try
zeyad
zeyadβ€’9mo ago
Otherwise, if you wish to keep different interactions in different events, don't return if it doesn't meet the if statement Instead run the code if it meets the if statement
brncray
brncrayβ€’9mo ago
i couldn't really as you'd have to modify it to fit your code, what I do is have extensions endings for example btn.js, find that file and then execute it based off the button custom id which i showed here
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
I understand, no problem Thank you so much guys
brncray
brncrayβ€’9mo ago
🫑 no nitro :(
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
:Rw8_love: Np man πŸ˜‚πŸ˜‚πŸ˜‚ Thank you @zeyad_155
zeyad
zeyadβ€’9mo ago
hbb
AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦
:sxb_hearts:
Want results from more Discord servers?
Add your server