File tree Expand file tree Collapse file tree 6 files changed +18
-3
lines changed
java/i/fran2019/BotMaster Expand file tree Collapse file tree 6 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 66
77 <groupId >i.fran2019.BotMaster</groupId >
88 <artifactId >BotMasterDC</artifactId >
9- <version >1.0.4 </version >
9+ <version >1.0.5 </version >
1010 <repositories >
1111 <repository >
1212 <id >central</id >
107107 <version >1.18.32</version >
108108 <scope >provided</scope >
109109 </dependency >
110+ <dependency >
111+ <groupId >redis.clients</groupId >
112+ <artifactId >jedis</artifactId >
113+ <version >5.2.0</version >
114+ </dependency >
110115 </dependencies >
111116
112117</project >
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ BotMaster is open-source software that enables the creation of modular bots easi
1212## TODO List
1313
1414- [ ] Add button component handler.
15- - [ ] Add redis support.
15+ - [X ] Add redis support.
1616- [ ] Add mysql support.
1717
1818## Usage
Original file line number Diff line number Diff line change 1111import net .dv8tion .jda .api .exceptions .InvalidTokenException ;
1212import org .slf4j .Logger ;
1313import org .slf4j .LoggerFactory ;
14+ import redis .clients .jedis .UnifiedJedis ;
1415
1516public class BotMaster {
1617 @ Getter private static Logger logger = LoggerFactory .getLogger (BotMaster .class );
1718 @ Getter private static BotMaster botMaster ;
1819 @ Getter private CommandManager commandManager ;
1920 @ Getter private PluginManager pluginManager ;
2021 @ Getter private MongoClient mongoClient ;
22+ @ Getter private UnifiedJedis redisClient ;
2123 @ Getter private ConfigManager configManager ;
2224 @ Getter private JDA jda ;
2325
@@ -32,6 +34,7 @@ private void start() {
3234 logger .info ("Starting Bot" );
3335 this .configManager = new ConfigManager ();
3436 this .mongoClient = this .configManager .MONGODB_ENABLED ? MongoClients .create (this .configManager .MONGODB_URI ) : null ;
37+ this .redisClient = this .configManager .REDIS_ENABLED ? new UnifiedJedis (this .configManager .REDIS_URI ) : null ;
3538 botMaster .build ();
3639
3740 this .commandManager = new CommandManager ();
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ public class ConfigManager {
1515 public String TOKEN ;
1616 public Boolean MONGODB_ENABLED ;
1717 public String MONGODB_URI ;
18+ public Boolean REDIS_ENABLED ;
19+ public String REDIS_URI ;
1820 public Boolean COMMANDS_SLASH_ENABLED ;
1921 public String COMMANDS_SLASH_REGISTER ;
2022 public List <String > COMMANDS_DISABLED ;
@@ -32,6 +34,8 @@ private void setConfigValues(){
3234 TOKEN = (String ) getConfigValue ("token" );
3335 MONGODB_ENABLED = (Boolean ) getConfigValue ("mongodb.enabled" );
3436 MONGODB_URI = (String ) getConfigValue ("mongodb.uri" );
37+ REDIS_ENABLED = (Boolean ) getConfigValue ("redis.enabled" );
38+ REDIS_URI = (String ) getConfigValue ("redis.uri" );
3539 COMMANDS_SLASH_ENABLED = (Boolean ) getConfigValue ("commands.slash.enabled" );
3640 COMMANDS_SLASH_REGISTER = (String ) getConfigValue ("commands.slash.register" );
3741 COMMANDS_DISABLED = (List <String >) getConfigValue ("commands.disabled" );
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
1717 return findClass (name );
1818 }
1919 }
20- }
20+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ token: ""
22mongodb :
33 enabled : false
44 uri : " "
5+ redis :
6+ enabled : false
7+ uri : " "
58commands :
69 slash :
710 enabled : true
You can’t perform that action at this time.
0 commit comments