Hello. My command does't work at all. I followed the example that u have provided in the wiki. It doesn't work. I have already register the CommandClient before the ready event start. It will be good if u can tell me where the mistakes are I've made.
Here is the code.
My main class:
package core;
import com.jagrosh.jdautilities.commandclient.CommandClient;
import com.jagrosh.jdautilities.commandclient.CommandClientBuilder;
import commands.FirstCmd;
import listeners.readyListener;
import listeners.voiceListener;
import net.dv8tion.jda.core.AccountType;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.JDABuilder;
import net.dv8tion.jda.core.OnlineStatus;
import net.dv8tion.jda.core.entities.Game;
import net.dv8tion.jda.core.exceptions.RateLimitedException;
import util.secrets;
import javax.security.auth.login.LoginException;
public class Main {
public static JDABuilder b;
public static void main(String args[]) {
//commandBuilder
CommandClientBuilder cb = new CommandClientBuilder();
cb.setOwnerId(I will have to block this.);
cb.setPrefix("w!");
cb.setGame(Game.playing("help"));
cb.addCommand(new FirstCmd());
//commandClient
CommandClient cc = cb.build();
b = new JDABuilder(AccountType.BOT);
b.addEventListener(cc);
b.addEventListener(new voiceListener());
b.addEventListener(new readyListener());
b.setToken(secrets.TOKEN);
b.setAutoReconnect(true);
b.setStatus(OnlineStatus.DO_NOT_DISTURB);
try {
JDA jda = b.buildBlocking();
} catch (LoginException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (RateLimitedException e) {
e.printStackTrace();
}
}
}
My Command class:
package commands;
import com.jagrosh.jdautilities.commandclient.Command;
import com.jagrosh.jdautilities.commandclient.CommandEvent;
public class FirstCmd extends Command{
public void FirstCmd() {
this.name = "firstCmd";
this.aliases = new String[]{"demo", "test"};
this.help = "example command";
}
@Override
protected void execute(CommandEvent event) {
event.reply("this is a reply");
}
}
Hello. My command does't work at all. I followed the example that u have provided in the wiki. It doesn't work. I have already register the CommandClient before the ready event start. It will be good if u can tell me where the mistakes are I've made. Here is the code. My main class:
My Command class:
If its not enough, i can provide more code to u.