This repository was archived by the owner on Jan 19, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +11
-6
lines changed
java/uk/co/unitycoders/pircbotx Expand file tree Collapse file tree 5 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ public class Bot
4242{
4343 public static void main (String [] args ) throws Exception
4444 {
45- CommandProcessor processor = new CommandProcessor ('&' );
45+ // Bot Configuration
46+ Configuration config = ConfigurationManager .loadJsonConfig ();
47+
48+ CommandProcessor processor = new CommandProcessor (config .trigger );
4649
4750 ProfileManager profiles = new ProfileManager (DBConnection .getProfileModel ());
4851 DateTimeCommand dtCmd = new DateTimeCommand ();
@@ -72,9 +75,6 @@ public static void main(String[] args) throws Exception
7275 bot .setAutoReconnect (true );
7376 bot .setAutoReconnectChannels (true );
7477
75- // Bot Configuration
76- Configuration config = ConfigurationManager .loadJsonConfig ();
77-
7878 try
7979 {
8080 bot .setName (config .nick );
Original file line number Diff line number Diff line change @@ -30,4 +30,5 @@ public class Configuration {
3030 public int port ;
3131 public Boolean ssl ;
3232 public String [] channels ;
33+ public char trigger ;
3334}
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ public class ConfigurationManager {
4141 public static final String DEFAULT_PORT = "6697" ;
4242 public static final String DEFAULT_SSL = "true" ;
4343 public static final String DEFAULT_CHANS = "#unity-coders" ;
44+ public static final String DEFAULT_TRIGGER = "&" ;
4445
4546 private static Reader getFileReader (String file ) throws IOException {
4647 return new FileReader (file );
@@ -57,6 +58,7 @@ public static Configuration loadConfig() throws IOException {
5758 config .port = Integer .parseInt (properties .getProperty ("port" , DEFAULT_PORT ));
5859 config .nick = properties .getProperty ("nick" , DEFAULT_BOT_NAME );
5960 config .ssl = Boolean .parseBoolean (properties .getProperty ("ssl" , DEFAULT_SSL ));
61+ config .trigger = properties .getProperty ("trigger" , DEFAULT_TRIGGER ).charAt (0 );
6062
6163 //work out what channels to connect to
6264 String channelStr = properties .getProperty ("channels" ,DEFAULT_CHANS );
Original file line number Diff line number Diff line change 11{
2- "nick" : " uc_pircbotx " ,
2+ "nick" : " uc_pircbotx2 " ,
33 "host" : " irc.freenode.net" ,
44 "port" : 6697 ,
55 "ssl" : true ,
6+ "trigger" : " &" ,
67 "channels" : [
78 " #unity-coders" ,
89 " #unity-coders-bots"
Original file line number Diff line number Diff line change @@ -8,5 +8,6 @@ host = irc.freenode.net
88port = 6697
99ssl = true
1010
11- # Channel settings
11+ # Bot settings
12+ trigger = &
1213channels = #unity-coders,#unity-coders-bots
You can’t perform that action at this time.
0 commit comments