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β€’13mo 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
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
Bot.js file:
zeyad
zeyadβ€’13mo ago
Can you send the code in a bin?
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
How?
zeyad
zeyadβ€’13mo ago
sourcebin or smth
brncray
brncrayβ€’13mo ago
off topic, but holy hot bar
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
?
zeyad
zeyadβ€’13mo 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β€’13mo ago
Then give the link here
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
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β€’13mo ago
You should not have too many event listeners to a single event
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
How can I do that, I didn't found a good course about that How to make it easier
brncray
brncrayβ€’13mo 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β€’13mo ago
Exactly
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
Can I get an example from my code?
zeyad
zeyadβ€’13mo ago
@AC / LogicTubes_Boss πŸ‡ΈπŸ‡¦ your issue is that you have too many listeners, and in each one you just return/ignore all other commands)
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
exactly Ah!
zeyad
zeyadβ€’13mo ago
In ur case, the first event should be the one that triggers first
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
I understand
zeyad
zeyadβ€’13mo ago
And you return all other commands that don't have the name 'manage'
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
you mean if it's about buttons, then I need only one event listener for them? and for slash commands one listener?
zeyad
zeyadβ€’13mo 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
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
Ah, okay ok, I will try
zeyad
zeyadβ€’13mo 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β€’13mo 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
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
I understand, no problem Thank you so much guys
brncray
brncrayβ€’13mo ago
🫑 no nitro :(
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
:Rw8_love: Np man πŸ˜‚πŸ˜‚πŸ˜‚ Thank you @zeyad_155
zeyad
zeyadβ€’13mo ago
hbb
./linpeas.sh πŸŒ™
./linpeas.sh πŸŒ™OPβ€’13mo ago
:sxb_hearts:

Did you find this page helpful?