Skip to content

Commit

Permalink
SlashCommands Fixed
Browse files Browse the repository at this point in the history
Added Redis Support

v1.0.5
  • Loading branch information
iFran2019 committed Jan 12, 2025
1 parent 2946623 commit 0beb432
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>i.fran2019.BotMaster</groupId>
<artifactId>BotMasterDC</artifactId>
<version>1.0.4</version>
<version>1.0.5</version>
<repositories>
<repository>
<id>central</id>
Expand Down Expand Up @@ -107,6 +107,11 @@
<version>1.18.32</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>

</project>
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BotMaster is open-source software that enables the creation of modular bots easi
## TODO List

- [ ] Add button component handler.
- [ ] Add redis support.
- [X] Add redis support.
- [ ] Add mysql support.

## Usage
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/i/fran2019/BotMaster/BotMaster.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
import net.dv8tion.jda.api.exceptions.InvalidTokenException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.UnifiedJedis;

public class BotMaster {
@Getter private static Logger logger = LoggerFactory.getLogger(BotMaster.class);
@Getter private static BotMaster botMaster;
@Getter private CommandManager commandManager;
@Getter private PluginManager pluginManager;
@Getter private MongoClient mongoClient;
@Getter private UnifiedJedis redisClient;
@Getter private ConfigManager configManager;
@Getter private JDA jda;

Expand All @@ -32,6 +34,7 @@ private void start() {
logger.info("Starting Bot");
this.configManager = new ConfigManager();
this.mongoClient = this.configManager.MONGODB_ENABLED ? MongoClients.create(this.configManager.MONGODB_URI) : null;
this.redisClient = this.configManager.REDIS_ENABLED ? new UnifiedJedis(this.configManager.REDIS_URI) : null;
botMaster.build();

this.commandManager = new CommandManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class ConfigManager {
public String TOKEN;
public Boolean MONGODB_ENABLED;
public String MONGODB_URI;
public Boolean REDIS_ENABLED;
public String REDIS_URI;
public Boolean COMMANDS_SLASH_ENABLED;
public String COMMANDS_SLASH_REGISTER;
public List<String> COMMANDS_DISABLED;
Expand All @@ -32,6 +34,8 @@ private void setConfigValues(){
TOKEN = (String) getConfigValue("token");
MONGODB_ENABLED = (Boolean) getConfigValue("mongodb.enabled");
MONGODB_URI = (String) getConfigValue("mongodb.uri");
REDIS_ENABLED = (Boolean) getConfigValue("redis.enabled");
REDIS_URI = (String) getConfigValue("redis.uri");
COMMANDS_SLASH_ENABLED = (Boolean) getConfigValue("commands.slash.enabled");
COMMANDS_SLASH_REGISTER = (String) getConfigValue("commands.slash.register");
COMMANDS_DISABLED = (List<String>) getConfigValue("commands.disabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
return findClass(name);
}
}
}
}
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ token: ""
mongodb:
enabled: false
uri: ""
redis:
enabled: false
uri: ""
commands:
slash:
enabled: true
Expand Down

0 comments on commit 0beb432

Please sign in to comment.