Try to fix Discord API Error
This commit is contained in:
parent
d50e1833b7
commit
1a59d2d5d3
@ -5,6 +5,8 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||
import net.dv8tion.jda.api.utils.cache.CacheFlag;
|
||||
@ -53,8 +55,10 @@ public class Bot {
|
||||
private static void registerCommands() {
|
||||
logger.info("Loading commands...");
|
||||
for (Command command : commandsArray) {
|
||||
Objects.requireNonNull(jda.getGuildById(config.guildId)).updateCommands().addCommands(command.buildSlash()).complete();
|
||||
Guild guild = Objects.requireNonNull(jda.getGuildById(config.guildId));
|
||||
commands.put(command.getName(), command);
|
||||
guild.updateCommands().complete();
|
||||
guild.upsertCommand(command.buildSlash()).complete();
|
||||
logger.info("Loaded command: {}", command.getName());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user