私のツイッチチャットのボットを作ろうとしていますが、チャットに接続する際にいくつか問題があります。 ライブラリーについて少しお読みください: http://www.jibble.org/pircbot.php 自分のチャットに接続しようとしましたが、エラーが表示されます。ツイッチチャット用のボットを作成する。接続を取得するエラー
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.
ログインしてみるとエラーが表示されますが、接続されたメッセージは印刷され、接続が解除されると表示されます。 これまでのところ私は幸運なことなしに異なる宣誓鍵を試しました。誰もがこの問題につまずいているのですか? HERESに私のコード:この
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);
}
}
よう
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");
}
私の主なルックスは、私はちょうどので、気にいけない私の誓いとチャンネル名をcencoredました。私は似たようなポストを読んだが、ほとんどは解決しただけで新しい誓いの鍵を得て、それは私を助けなかった。 ここから私の鍵を持ってきましたhttps://twitchapps.com/tmi/#access_token=371rq3e2mr2zjknu176wt93849l7kp&scope=chat_login