#Confirmation and error messages problem:

1 messages · Page 1 of 1 (latest)

coral vessel

Hi everybody

I'm currently trying to make a slash command with 4 subcommands:
The first creates a new role and adds users within it
The second allow to add people in roles
The third removes people from roles
The fourth and last delete the selected role

The command does what I expect. It aims to allow people to create custom roles and add many users so they can @ that role when they want instead of mention all the members of that group each time they have to speak to them. With the bot, I don't have to manage this myself, and member can do it by themselves.

The problems comes when I want to put an error message: if a user try to manage admin role for exemple, Discord API doesn't allow it (which is exactly what I want, no problem with that) but in my chat I have a confirmation message like if the command worked, but it actually not. Beyond the problem if this command, it will be a big problem if I'm not able to create simple confirmation message when the command works and an error message if it's not.

So here is my code for one of the subcommands, but the problem is the same for the 3 others (case is in french, I translated console.error + interactions). I don't post it directly because discord doesn't display it properly but if you want the whole code just tell me I'll do a pastebin :

https://i.imgur.com/s1i9Acz.png

When I use interaction.reply line 100 I get

DiscordAPIError[40060]: Interaction has already been acknowledged pointing at node_modules\@discordjs\rest\dist\index.js:722:13

And if I use interaction.followUp :
Error [InteractionNotReplied]: The reply to this interaction has not been sent or deferred.

I also tried to put a try...catch but it's exactly the same way

Actually, I could do this role attribution myself, but I'm not done with slash commands creation and if I don't understand how manage confirmation and error messages I'll get in trouble anyway.

If I delete the confirmation embed to see what it does, it prints the confirmation embed of the next subcommand so I'm sure I did something wrong (for not to say I totally messed up, I'm not a developper but I try to learn) with the embed place and the if/else, but after many researchs I don't manage to understand how to correct this, so I turn to you.

Thx by advance