How to register Slash Command in Discord4j core 3.2.3?

299 Views Asked by At

I am trying to implement slash commands to my discord bot using discord4j core but I cant find a working way to register the commands.

I looked up the example at the discord4j page. They use

GuildCommandRegistrar.create(client.getRestClient(), guildId, Collections.singletonList(randomCommand))
                .registerCommands()
                .doOnError(e -> log.warn("Unable to create guild command", e))
                .onErrorResume(e -> Mono.empty())
                .blockLast();

But I can't get this to work for me. In the example project they use this import

import discord4j.core.support.GuildCommandRegistrar;

But I can't use this for myself. Does anyone know how I can register my Slash command with discord4j?

Thanks in advance

1

There are 1 best solutions below

0
NovaFox161 On BEST ANSWER