有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

PircBotX类型的java方法connect()不可见

我正在尝试使用PircBotX创建一个机器人,但我甚至无法开始制作。仅使用基本示例代码,我无法让connect()方法工作,它总是在编译时给出标题中提到的错误。以下是我使用的代码:

import org.pircbotx.Configuration;
import org.pircbotx.PircBotX;

public class MyBot {
    public static void main(String[] args) throws Exception {
        Configuration configuration = new Configuration.Builder()
        .setName("PircBotX") //Set the nick of the bot. CHANGE IN YOUR CODE
        .setLogin("LQ") //login part of hostmask, eg name:login@host
        .setAutoNickChange(true) //Automatically change nick when the current one is in use
        .setCapEnabled(true) //Enable CAP features
        .setServerHostname("irc.freenode.net")
        .addAutoJoinChannel("#pircbotx") //Join the official #pircbotx channel
        .buildConfiguration();
        PircBotX bot = new PircBotX(configuration);

        //Connect to server
        try {
            bot.connect();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

错误发生在bot.connect();

PircBotX可以在其谷歌代码页上找到:https://code.google.com/p/pircbotx/


共 (0) 个答案