首页 > 解决方案 > 构造函数 JDABuilder(AccountType) 已弃用

问题描述

在 JDA 中,我不断收到错误“构造函数 JDABuilder(AccountType) 已弃用”

package diaduck.Playground;

import net.dv8tion.jda.api.AccountType;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;

public class Main {
    public static JDA jda;
    
    public static void main(String[] args) {
        jda = new JDABuilder(AccountType.BOT).setToken("**************************").buildAsync();
    }
}

标签: javadiscorddiscord-jda

解决方案


This constructor has been deprecated for well over a year now. The documentation tells you exactly why and what needs to be done. In fact, this constructor no longer even exists on the latest version of JDA.

The migration guide tells you to use the new factory methods instead. Read more on GitHub


推荐阅读