Browse Source

feat: Choix du démarage ou non de twitter et mastodon

Martin Passard 6 years ago
parent
commit
78419164e5
2 changed files with 10 additions and 6 deletions
  1. 2 0
      ressources/config/default.properties
  2. 8 6
      src/main/java/bot/irc/main/Main.java

+ 2 - 0
ressources/config/default.properties

@@ -60,3 +60,5 @@ Mastodon_access_token=""
 Mastodon_instance=toot.aquilenet.fr
 Mastodon_enable=true
 
+#Twitter
+Twitter_enable=true

+ 8 - 6
src/main/java/bot/irc/main/Main.java

@@ -42,14 +42,16 @@ public class Main {
 			IRCBOT = new IRCBot();
 			BOTS.add(IRCBOT);
 			
-			TWITTER = new TwitterBot();
-			BOTS.add(TWITTER);
-			TWITTER.start();
+			if(Config.getPropertyAsBoolean("Twitter_enable")) {
+				TWITTER = new TwitterBot();
+				BOTS.add(TWITTER);
+				TWITTER.start();
+			}
 			
 			RSSChecker rcheck = new RSSChecker(Config.getProperty("RSS_address"), BOTS);
 			RSS_DATA_REMAINDER = rcheck.getRemainder();
 			
-			if(Config.getPropertyAsBoolean("mastodon_enable")) {
+			if(Config.getPropertyAsBoolean("Mastodon_enable")) {
 				MASTODON = new MastodonBot();
 				BOTS.add(MASTODON);
 				MASTODON.start();
@@ -71,8 +73,8 @@ public class Main {
 			
 			rcheck.start();
 			RSS_DATA_REMAINDER.addObserver(IRCBOT);
-			RSS_DATA_REMAINDER.addObserver(TWITTER);
-			RSS_DATA_REMAINDER.addObserver(MASTODON);
+			if(Config.getPropertyAsBoolean("Twitter_enable")) RSS_DATA_REMAINDER.addObserver(TWITTER);
+			if(Config.getPropertyAsBoolean("Mastodon_enable")) RSS_DATA_REMAINDER.addObserver(MASTODON);
 			
 			
 		}catch(ConnectException ce) {