mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-25 20:04:01 +00:00
added the concept of feature modes, these are the modes in which a feature can operate, its basically a separate way how the feature does it jobs, for example mod mail might log or it might not. bot of these are different modes
refactored services for feature flag and feature config
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
abstracto.postTargets.modmail=modmailLog,modmailPing
|
||||
abstracto.emoteNames.readReaction=readReaction
|
||||
abstracto.defaultEmotes.readReaction=\uD83D\uDC40
|
||||
abstracto.features.modmail=false
|
||||
abstracto.features.modmail_logging=false
|
||||
abstracto.features.modmail.enabled=false
|
||||
abstracto.features.modmail.defaultMode=log
|
||||
|
||||
abstracto.features.modmail_logging.enabled=false
|
||||
@@ -2,6 +2,7 @@ package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import dev.sheldan.abstracto.core.service.FeatureValidator;
|
||||
import dev.sheldan.abstracto.modmail.validator.ModMailFeatureValidator;
|
||||
@@ -44,4 +45,9 @@ public class ModMailFeature implements FeatureConfig {
|
||||
public List<String> getRequiredEmotes() {
|
||||
return Arrays.asList("readReaction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeatureMode> getAvailableModes() {
|
||||
return Arrays.asList(ModMailMode.LOGGING, ModMailMode.NO_LOG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ModMailMode implements FeatureMode {
|
||||
LOGGING("log"), NO_LOG("nolog");
|
||||
|
||||
private String key;
|
||||
|
||||
ModMailMode(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user