Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.togetherjava.tjbot.commands.system.CommandSystem;
import org.togetherjava.tjbot.config.Config;
import org.togetherjava.tjbot.db.Database;
import org.togetherjava.tjbot.routines.ModAuditLogRoutine;

import javax.security.auth.login.LoginException;
import java.io.IOException;
Expand Down Expand Up @@ -81,6 +82,10 @@ public static void runBot(String token, Path databasePath) {
jda.awaitReady();
logger.info("Bot is ready");

// TODO This should be moved into some proper command system instead (see GH issue #235
// which adds support for routines)
Comment thread
Zabuzard marked this conversation as resolved.
Resolved
new ModAuditLogRoutine(jda, database).start();

Runtime.getRuntime().addShutdownHook(new Thread(Application::onShutdown));
} catch (LoginException e) {
logger.error("Failed to login", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ public final class Config {
private final String databasePath;
private final String projectWebsite;
private final String discordGuildInvite;
private final String modAuditLogChannelPattern;
private final String mutedRolePattern;

@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private Config(@JsonProperty("token") String token,
@JsonProperty("databasePath") String databasePath,
@JsonProperty("projectWebsite") String projectWebsite,
@JsonProperty("discordGuildInvite") String discordGuildInvite) {
@JsonProperty("discordGuildInvite") String discordGuildInvite,
@JsonProperty("modAuditLogChannelPattern") String modAuditLogChannelPattern,
@JsonProperty("mutedRolePattern") String mutedRolePattern) {
this.token = token;
this.databasePath = databasePath;
this.projectWebsite = projectWebsite;
this.discordGuildInvite = discordGuildInvite;
this.modAuditLogChannelPattern = modAuditLogChannelPattern;
this.mutedRolePattern = mutedRolePattern;
}

/**
Expand All @@ -59,6 +65,25 @@ public static Config getInstance() {
"can not get the configuration before it has been loaded");
}

/**
* Gets the REGEX pattern used to identify the role assigned to muted users.
*
* @return the role name pattern
*/
public String getMutedRolePattern() {
return mutedRolePattern;
}

/**
* Gets the REGEX pattern used to identify the channel that is supposed to contain all mod audit
* logs.
*
* @return the channel name pattern
*/
public String getModAuditLogChannelPattern() {
return modAuditLogChannelPattern;
}

/**
* Gets the token of the Discord bot to connect this application to.
*
Expand Down
Loading