Closed VingGit closed 3 years ago
huh, i'm missing something crucial here. I changed the contents of the method back to that provided template and it still acts all the same. Enters the method correctyl but nothing happens.
Currently at work, I'll get back to you
You said you made a new bot, did you change the value of your APPLICATION_ID variable to the new application id?
indeed i did. That makes it so weird.
First i got it from a config file and then i changed it to hardcoded and still the result is the same.
submitGuildCommand()
returns you a CompletableFuture, you can listen to the result by calling whenComplete()
. Is the returned Throwable object null?
ah, i'm sorry. i don't know how to proceed.
submitGuildCommand(...).whenComplete((commandId, throwable) -> {
System.out.println("COMMAND ID: " + commandId);
if (throwable != null) {
System.err.println(throwable.getMessage());
}
});
Replace the ...
with your command and your command listener and let me know what it prints to the console
it says
28.04 15:49:34 [Bot] de.cerus.jdasc.http.DiscordApiException: Expected one of [200, 201] but got 403
and that's all
That means that the bot is not authorized to register a command. Are you sure that the bot token and the application id are both correct?
they have to be, i got the from the very same page.
i'll get back to you when i can
Did you give the bot command perms when adding it to the server?
using oauth
What perms? I think i gave it the same perms as i did to the previous bot. I have been a bit busy these last days but i will check in 3 hours or so once i finally get back to the computer.
Did you give the bot command perms when adding it to the server?
You're right, I completely forgot about that. Bots also need the slash commands permission.
nah, i even tried to give it all the possible permissions and i got no luck. And yes, i did invite the bot again and i did restart it. The error is still the same. (and yes, i changed the application id.)
In the oAuth url generator you need to also select the following.
This is also shown in the discord api docs: https://discord.com/developers/docs/interactions/slash-commands
You are a beautiful human being, you know that right? Thank you!
😃
During testing, i deleted a current bot i had and made a new. This time, it goes into the initcommands method, executes it without exceptions. but the commands are not there.
here's the pastebin, notice how in lines 76 and 176 it says if the initialization was successful
https://pastebin.com/p5gGCpdq
here's the relevant github again,if it's of any help. https://github.com/VingGit/UnicaBot/blob/supermoniveto/src/main/java/Botti/Botti.java