そこで、経験を積むためだけに、Twitch IRC ボットを作成してみることにしました。これまでのところ、私は多くのことを学びましたが、今は障害にぶつかり、ボットを接続できないようです.
twitch irc に正常に接続できる IRC クライアントがありますが、irc.twitch.tv に ping を実行することはできません。私のボットは、PircBotX フレームワークをベースとして使用しており、これまでのところ、サーバーに接続する必要があるだけですが、接続していません。 t。Eclipse ですべてをセットアップしましたが、すべて問題ないように見えますが、ボットが実際に接続することはありません。試行錯誤しますが、決してうまくいかないようです。
なぜ機能しないのかわかりません。また、ルーターで必要な場合に備えて、ポートをポート転送しましたが、うまくいきませんでした。Eclipse でボットを実行すると、接続が開始され、実行が停止します。
私は、pircbotx のドキュメント、このボットのコード: https://github.com/MattsMc/MankiniBot、および私が見つけたこの YouTube シリーズ: https://www.youtube.com/watch?v=a1WDUKI5-PIから物事をつなぎ合わせてきました。 . あなたが提供できるどんな助けも素晴らしいでしょう。ありがとう。
PS: OAUTH コードを変更したので、心配する必要はありません :)
基本的にここに私のコードがあります:
package firedingo.project.bot;
import com.google.common.collect.*;
import com.google.guava.*;
import org.pircbotx.Configuration;
import org.pircbotx.PircBotX;
public class TheDingoPack {
private int count;
//starting config again in case config derp is issue, will need clean up HERE
Configuration<PircBotX> Config = new Configuration.Builder<PircBotX>()
.setServerPassword(firedingo.project.bot.reference.Reference.OAUTH)
.setName(firedingo.project.bot.reference.Reference.NICK)
.setLogin(firedingo.project.bot.reference.Reference.NICK)
.setAutoNickChange(true)
.setServerHostname(firedingo.project.bot.reference.Reference.HOST)
.setServerPort(firedingo.project.bot.reference.Reference.PORT)
.addAutoJoinChannel(firedingo.project.bot.reference.Reference.BOTCHAN)
.buildConfiguration();
//Constructor to actually create the bot
public TheDingoPack() {
PircBotX TheDingoPack = new PircBotX(Config);
try {
TheDingoPack.startBot();
System.out.println("Attempting To Connect");
}
catch(Exception e) {
System.out.println("Connection Failed - Error Thrown");
}
}
//realized constructor needed a call so added it here. Nearly derped :P
public static void main(String[] args) {
new TheDingoPack();
}
}
package firedingo.project.bot.reference;
public class Reference {
//Connection Details As Constants For Easy Customizability
public static final String NICK = "thedingopack";
public static final String HOST = "irc.twitch.tv";
public static final String OAUTH = "6lw8eg2zw81pmpj09kbr9pa62d006f";
public static final int PORT = 6667;
//these two channels can be changed as necessary, extras can also be added.
public static final String BOTCHAN = "#thedingopack";
public static final String MODCHAN = "#firedingo99365";
}