Java 正在为twitch聊天创建机器人。获取连接错误
我正在尝试为我的twitch聊天制作一个机器人,但是我在连接到聊天时遇到了一些问题。 我在以下网站上读到一些关于图书馆的信息: 并试图连接到我自己的聊天室,但我遇到了一个错误Java 正在为twitch聊天创建机器人。获取连接错误,java,login,twitch,disconnect,pircbot,Java,Login,Twitch,Disconnect,Pircbot,我正在尝试为我的twitch聊天制作一个机器人,但是我在连接到聊天时遇到了一些问题。 我在以下网站上读到一些关于图书馆的信息: 并试图连接到我自己的聊天室,但我遇到了一个错误 1462989951913 *** Connected to server. 1462989951915 >>>PASS oauth:cencoring oath. 1462989951915 >>>NICK FredsBot 1462989951915 >>>USER
1462989951913 *** Connected to server.
1462989951915 >>>PASS oauth:cencoring oath.
1462989951915 >>>NICK FredsBot
1462989951915 >>>USER FredsBot 8 * :PircBot 1.5.0 Java IRC Bot - www.jibble.org
1462989952324 :tmi.twitch.tv NOTICE * :Error logging in
1462989962324 *** Logged onto server.
Connected!
1462989962324 >>>JOIN #mychannel
1462989962324 *** Disconnected.
正如您所看到的,我在尝试登录时出错,但它会在断开连接后打印出连接的消息。
到目前为止,我已经尝试了不同的誓言钥匙,但没有任何运气。有人偶然发现这个问题吗?
这是我的密码:
import org.jibble.pircbot.*;
public class MyBot extends PircBot {
private static final String channelName = "#mychannel";
private final String botName = "FredsBot";
public MyBot() {
this.setName(botName);
this.setLogin(botName);
}
public String getchannelName() {
return channelName;
}
@Override
public void onMessage(String channel, String sender,
String login, String hostname, String message) {
if (message.equalsIgnoreCase("time")) {
String time = new java.util.Date().toString();
sendMessage(channel, sender + ": The time is now " + time);
}
}
@Override
protected void onConnect() {
System.out.println("Connected!");
joinChannel(channelName);
super.onConnect();
sendMessage(getchannelName(), "Hello, i am a bot");
}
我的主菜看起来像这样
private static final String OAUTH = "myoath";
private static final String ADRESS = "irc.chat.twitch.tv.";
private static final int PORT = 6667;
public static void main(String[] args) {
MyBot bot = new MyBot();
bot.setVerbose(true);
try {
bot.connect(ADRESS, PORT, OAUTH);
// bot.onMessage(channelName, "Bot", channelName, channelName, channelName);
} catch (IOException ex) {
Logger.getLogger(MainFile.class.getName()).log(Level.SEVERE, null, ex);
} catch (IrcException ex) {
Logger.getLogger(MainFile.class.getName()).log(Level.SEVERE, null, ex);
}
}
我刚刚写了我的誓言和频道名称,所以别介意。我确实读过类似的帖子,但大多数问题都解决了,只是得到了一把新的誓言钥匙,这对我没有帮助。所以我发现了问题所在。我不知道我需要用我在代码中声明的确切名称为bot创建一个帐户。 愚蠢的错误