我想做的是一个机器人,该机器人连接多个抽搐流并说“玩”以玩大理石。
它只能与一个流一起使用,但如何与更多流连接?
公共静态void main(String [] args)引发IOException,IrcException {
Configuration config = new Configuration.Builder()
.setName(BOTNAME)
.setServer("irc.chat.twitch.tv", 6667)
.setServerPassword(OAUTH)
.addListener(new Bot())
.addAutoJoinChannel("#" + CHANNEL)
.buildConfiguration();
Configuration config2 = new Configuration.Builder()
.setName(BOTNAME)
.setServer("irc.chat.twitch.tv", 6667)
.setServerPassword(OAUTH)
.addListener(new Bot())
.addAutoJoinChannel("#" + CHANNEL2)
.buildConfiguration();
MultiBotManager manager = new MultiBotManager();
manager.addBot(config);
manager.addBot(config2);
manager.start();
}
public void onGenericMessage(GenericMessageEvent event) throws Exception {
String command = getCommandFromMessage(message);*/
String command = event.getMessage();
runCommands(command);
}
private void runCommands(String command) throws InterruptedException {
if (command.equalsIgnoreCase("!play")){
count++;
if (count == 3) {
System.out.println("c'est parti");
sendMessage("!play");
System.out.println("compteur lancé");
TimeUnit.SECONDS.sleep(50);
System.out.println("50 secondes ?");
count=0;
}
}
}
private void sendMessage(String message) {
Main.monBot.sendIRC().message("#" + Main.CHANNEL, message);
}
实际上我只能连接和播放一个流,并且我想连接更多