mirror of https://github.com/bvn13/JIrcBot.git
implemented multiple server connections
parent
a834ba1f68
commit
fd06b97800
|
@ -7,6 +7,14 @@
|
|||
"channelsNames" : ["#voidforum"],
|
||||
"botName" : "jircbot-test",
|
||||
"masterNick" : "bvn13"
|
||||
},
|
||||
{
|
||||
"enabled" : true,
|
||||
"server" : "irc.mozilla.org",
|
||||
"port" : 6667,
|
||||
"channelsNames" : ["#borsch"],
|
||||
"botName" : "jircbot-test",
|
||||
"masterNick" : "bvn13"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
[Service]
|
||||
User=bvn13
|
||||
WorkingDirectory=/srv/jircbot
|
||||
ExecStart=/usr/bin/java -jar /srv/jircbot/jircbot-1.1.7.jar
|
||||
ExecStart=/usr/bin/java -jar /srv/jircbot/jircbot-1.1.8.jar
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>ru.bvn13</groupId>
|
||||
<artifactId>jircbot</artifactId>
|
||||
<version>1.1.8</version>
|
||||
<version>1.2.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.bvn13.jircbot.bot;
|
|||
|
||||
|
||||
import org.pircbotx.Configuration;
|
||||
import org.pircbotx.MultiBotManager;
|
||||
import org.pircbotx.PircBotX;
|
||||
import org.pircbotx.UtilSSLSocketFactory;
|
||||
import org.pircbotx.cap.TLSCapHandler;
|
||||
|
@ -142,16 +143,14 @@ public class JircBot extends ListenerAdapter {
|
|||
);
|
||||
});
|
||||
|
||||
//bot.connect throws various exceptions for failures
|
||||
this.bots.forEach((id, b) -> {
|
||||
try {
|
||||
b.startBot();
|
||||
} catch (Exception ex) {
|
||||
logger.error("ERROR STARTING BOT: "+id);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
MultiBotManager manager = new MultiBotManager();
|
||||
|
||||
this.bots.forEach((id, bot) -> {
|
||||
manager.addBot(bot);
|
||||
});
|
||||
|
||||
manager.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue