这是我第一次用Java构建一个Discord机器人。考虑到最后没有错误并且只有在编译之后,我认为我的代码是正确的。
我确实听说过JDA 3.8.1的某些语法已更改,但我有点迷失了。如果没有提供足够的信息,我深表歉意。
public class MrCoolVibes {
private static String prefix = "~";
public static void main(String[] args) throws LoginException {
JDABuilder builder = new JDABuilder();
builder.setToken("I actually have a Token here");
builder.setStatus(OnlineStatus.ONLINE);
}
}
例外:
Exception in thread "main" java.lang.NoClassDefFoundError: net/dv8tion/jda/core/JDABuilder
at mrCoolVibes.MrCoolVibes.main(MrCoolVibes.java:19)
Caused by: java.lang.ClassNotFoundException: net.dv8tion.jda.core.JDABuilder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more