[AB-xxx] adding default permissions for commands

adding owner limitation for certain internal commands
This commit is contained in:
Sheldan
2025-02-15 15:33:56 +01:00
parent 210140b242
commit f99c5351e6
99 changed files with 516 additions and 184 deletions

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.ContextUtils;
import dev.sheldan.abstracto.customcommand.config.CustomCommandFeatureDefinition;
@@ -87,6 +88,7 @@ public class CreateCustomCommand extends AbstractConditionableCommand {
.enabled(true)
.userInstallable(true)
.userCommandConfig(UserCommandConfig.all())
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND)
.commandName("create")
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.ContextUtils;
import dev.sheldan.abstracto.customcommand.config.CustomCommandFeatureDefinition;
@@ -73,6 +74,7 @@ public class DeleteCustomCommand extends AbstractConditionableCommand {
.enabled(true)
.userInstallable(true)
.userCommandConfig(UserCommandConfig.all())
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND)
.commandName("delete")
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.database.AServer;
@@ -168,6 +169,7 @@ public class AddLevelAction extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("levelAction")
.commandName("add")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -97,6 +98,7 @@ public class DisableExpForRole extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(DISABLE_EXP_FOR_ROLE_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -87,6 +88,7 @@ public class DisableExpGain extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(DISABLE_EXP_GAIN_COMMAND)
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.exception.SlashCommandParameterMissingException;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -100,6 +101,7 @@ public class EnableExpForRole extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(ENABLE_EXP_FOR_ROLE_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -88,6 +89,7 @@ public class EnableExpGain extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(ENABLE_EXP_GAIN_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -80,6 +81,7 @@ public class ExpScale extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(EXP_SCALE_COMMAND)
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.FullRole;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.ChannelService;
@@ -112,6 +113,7 @@ public class ListDisabledExperienceRoles extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(LIST_DISABLED_EXPERIENCE_ROLES_COMMAND)
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.database.AServer;
@@ -142,6 +143,7 @@ public class RemoveLevelAction extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("levelAction")
.commandName("remove")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.experience.config.ExperienceFeatureDefinition;
import dev.sheldan.abstracto.experience.config.ExperienceFeatureMode;
import dev.sheldan.abstracto.experience.config.ExperienceSlashCommandNames;
@@ -51,6 +52,7 @@ public class ShowLevelActions extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ExperienceSlashCommandNames.EXPERIENCE_CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("levelAction")
.commandName("show")
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.giveaway.config.GiveawayFeatureDefinition;
import dev.sheldan.abstracto.giveaway.config.GiveawayMode;
@@ -106,6 +107,7 @@ public class AddGiveawayKey extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("keys")
.commandName("add")
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
import dev.sheldan.abstracto.giveaway.config.GiveawayFeatureDefinition;
@@ -80,6 +81,7 @@ public class CancelGiveaway extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("management")
.commandName("cancel")
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.ParseUtils;
import dev.sheldan.abstracto.giveaway.config.GiveawayFeatureDefinition;
@@ -169,6 +170,7 @@ public class GreateGiveaway extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("management")
.commandName("create")
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.service.ConfigService;
import dev.sheldan.abstracto.core.utils.ParseUtils;
@@ -131,6 +132,7 @@ public class GreateKeyGiveaway extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("key")
.commandName("creategiveaway")
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
import dev.sheldan.abstracto.giveaway.config.GiveawayFeatureDefinition;
@@ -80,6 +81,7 @@ public class ReRollGiveaway extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("management")
.commandName("reroll")
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.giveaway.config.GiveawayFeatureDefinition;
import dev.sheldan.abstracto.giveaway.config.GiveawayMode;
@@ -66,6 +67,7 @@ public class RemoveGiveawayKey extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("keys")
.commandName("remove")
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
import dev.sheldan.abstracto.core.service.PaginatorService;
@@ -110,6 +111,7 @@ public class ShowGiveawayKeys extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(GiveawaySlashCommandNames.GIVEAWAY)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.groupName("keys")
.commandName("show")
.build();

View File

@@ -5,6 +5,7 @@ import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.config.*;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -138,6 +139,7 @@ public class Ban extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MODERATION)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(BAN_COMMAND)
.build();

View File

@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -77,6 +78,7 @@ public class DeleteNote extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.USER_NOTES)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("delete")
.build();

View File

@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -76,6 +77,7 @@ public class DeleteWarning extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.WARNINGS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("delete")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.moderation.config.ModerationModuleDefinition;
import dev.sheldan.abstracto.moderation.config.ModerationSlashCommandNames;
@@ -71,6 +72,7 @@ public class EditInfraction extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.INFRACTIONS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("edit")
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
@@ -182,6 +183,7 @@ public class Infractions extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.INFRACTIONS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("list")
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.moderation.config.ModerationModuleDefinition;
@@ -100,6 +101,7 @@ public class Kick extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MODERATION)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(KICK_COMMAND)
.build();

View File

@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.command.config.*;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -168,6 +169,7 @@ public class Mute extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MUTE)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("create")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -155,6 +156,7 @@ public class Mutes extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MUTE)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("list")
.build();

View File

@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -104,6 +105,7 @@ public class Purge extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MODERATION)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(PURGE_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -123,6 +124,7 @@ public class SlowMode extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MODERATION)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(SLOWMODE_COMMAND)
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -83,6 +84,7 @@ public class UnBan extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MODERATION)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(UN_BAN_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -86,6 +87,7 @@ public class UnMute extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.MUTE)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("remove")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -97,6 +98,7 @@ public class UserNoteCommand extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.USER_NOTES)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("create")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -148,6 +149,7 @@ public class UserNotes extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.USER_NOTES)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("list")
.build();

View File

@@ -6,6 +6,7 @@ import dev.sheldan.abstracto.core.command.config.*;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -123,6 +124,7 @@ public class Warn extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.WARNINGS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("create")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -160,6 +161,7 @@ public class Warnings extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModerationSlashCommandNames.WARNINGS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName("list")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -171,6 +172,7 @@ public class Close extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(CLOSE_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
@@ -137,6 +138,7 @@ public class Contact extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(COMMAND_NAME)
.build();

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.modmail.condition.ModMailContextCondition;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
@@ -92,6 +93,7 @@ public class DenyModmailAppeal extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(COMMAND_NAME)
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
import dev.sheldan.abstracto.modmail.condition.ModMailContextCondition;
import dev.sheldan.abstracto.modmail.config.ModMailFeatureDefinition;
@@ -72,6 +73,7 @@ public class Subscribe extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(SUBSCRIBE_COMMAND)
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
import dev.sheldan.abstracto.modmail.condition.ModMailContextCondition;
@@ -74,6 +75,7 @@ public class UnSubscribe extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(ModMailSlashCommandNames.MODMAIL)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(UN_SUBSCRIBE_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.ServerSpecificId;
@@ -91,6 +92,7 @@ public class DeleteTrackedEmote extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StatisticSlashCommandNames.STATISTIC_INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.groupName("manage")
.commandName("deletetrackedemote")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.ServerSpecificId;
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
@@ -99,6 +100,7 @@ public class DisableEmoteTracking extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StatisticSlashCommandNames.STATISTIC_INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.groupName("manage")
.commandName("disableemotetracking")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.ServerSpecificId;
@@ -111,6 +112,7 @@ public class PurgeEmoteStats extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StatisticSlashCommandNames.STATISTIC_INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.groupName("manage")
.commandName("purgeemotestats")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandService;
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
import dev.sheldan.abstracto.statistic.config.StatisticSlashCommandNames;
@@ -55,6 +56,7 @@ public class ResetEmoteStats extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StatisticSlashCommandNames.STATISTIC_INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.groupName("manage")
.commandName("resetemotestats")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.statistic.config.StatisticFeatureDefinition;
import dev.sheldan.abstracto.statistic.config.StatisticSlashCommandNames;
import dev.sheldan.abstracto.statistic.emote.config.EmoteTrackingModuleDefinition;
@@ -58,6 +59,7 @@ public class SyncTrackedEmotes extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StatisticSlashCommandNames.STATISTIC_INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.groupName("manage")
.commandName("synctrackedemotes")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.service.EmoteService;
import dev.sheldan.abstracto.core.service.FeatureModeService;
@@ -109,6 +110,7 @@ public class TrackEmote extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StatisticSlashCommandNames.STATISTIC_INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.groupName("manage")
.commandName("trackemote")
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.stickyroles.config.StickyRolesFeatureDefinition;
import dev.sheldan.abstracto.stickyroles.config.StickyRolesSlashCommandNames;
@@ -75,6 +76,7 @@ public class ConfigureStickyRole extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StickyRolesSlashCommandNames.STICKY_ROLES)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("configure")
.build();

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.template.display.RoleDisplay;
import dev.sheldan.abstracto.stickyroles.config.StickyRolesFeatureDefinition;
import dev.sheldan.abstracto.stickyroles.config.StickyRolesSlashCommandNames;
@@ -67,6 +68,7 @@ public class ShowStickyRoles extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StickyRolesSlashCommandNames.STICKY_ROLES)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("show")
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.service.UserService;
import dev.sheldan.abstracto.stickyroles.config.StickyRolesFeatureDefinition;
@@ -99,6 +100,7 @@ public class ToggleStickinessManagement extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(StickyRolesSlashCommandNames.STICKY_ROLES)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("manage")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -94,6 +95,7 @@ public class Accept extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(SuggestionSlashCommandNames.SUGGEST)
.commandName(ACCEPT_COMMAND)
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.suggestion.config.SuggestionFeatureDefinition;
import dev.sheldan.abstracto.suggestion.config.SuggestionSlashCommandNames;
@@ -83,6 +84,7 @@ public class ClosePoll extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(SuggestionSlashCommandNames.POLL)
.commandName("close")
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -93,6 +94,7 @@ public class Reject extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(SuggestionSlashCommandNames.SUGGEST)
.commandName(REJECT_COMMAND)
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.suggestion.config.SuggestionFeatureDefinition;
import dev.sheldan.abstracto.suggestion.config.SuggestionSlashCommandNames;
@@ -71,6 +72,7 @@ public class ShowPoll extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(SuggestionSlashCommandNames.POLL)
.commandName(COMMAND_NAME)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -85,6 +86,7 @@ public class ShowSuggestion extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(SuggestionSlashCommandNames.SUGGEST)
.commandName(SHOW_SUGGESTION_COMMAND)
.build();

View File

@@ -7,6 +7,7 @@ import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValida
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
@@ -93,6 +94,7 @@ public class Veto extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(SuggestionSlashCommandNames.SUGGEST)
.commandName(VETO_COMMAND)
.build();

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.FutureUtils;
import dev.sheldan.abstracto.twitch.config.TwitchFeatureDefinition;
@@ -106,6 +107,7 @@ public class AddTwitchStreamer extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(TwitchSlashCommandNames.TWITCH)
.groupName("streamer")
.commandName("add")

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
@@ -139,6 +140,7 @@ public class ChangeTwitchStreamer extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(TwitchSlashCommandNames.TWITCH)
.groupName("streamer")
.commandName("edit")

View File

@@ -8,6 +8,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.twitch.config.TwitchFeatureDefinition;
import dev.sheldan.abstracto.twitch.config.TwitchSlashCommandNames;
import dev.sheldan.abstracto.twitch.model.template.ListTwitchStreamerResponseModel;
@@ -48,6 +49,7 @@ public class ListTwitchStreamer extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(TwitchSlashCommandNames.TWITCH)
.groupName("streamer")
.commandName("list")

View File

@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.twitch.config.TwitchFeatureDefinition;
import dev.sheldan.abstracto.twitch.config.TwitchSlashCommandNames;
@@ -64,6 +65,7 @@ public class RemoveTwitchStreamer extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(TwitchSlashCommandNames.TWITCH)
.groupName("streamer")
.commandName("remove")

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
@@ -90,6 +91,7 @@ public class AddToChannelGroup extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(ADD_TO_CHANNEL_GROUP_COMMAND)
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.ChannelGroupType;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
@@ -82,6 +83,7 @@ public class CreateChannelGroup extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(CREATE_CHANNEL_GROUP_COMMAND)
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -70,6 +71,7 @@ public class DeleteChannelGroup extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(DELETE_CHANNEL_GROUP_COMMAND)
.build();

View File

@@ -1,25 +1,25 @@
package dev.sheldan.abstracto.core.commands.channels;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
import dev.sheldan.abstracto.core.command.config.HelpInfo;
import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureDefinition;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class DisableChannelGroup extends AbstractConditionableCommand {
@@ -49,40 +49,41 @@ public class DisableChannelGroup extends AbstractConditionableCommand {
String channelGroupName = slashCommandParameterService.getCommandOption(CHANNEL_GROUP_NAME_PARAMETER, event, String.class);
channelGroupService.disableChannelGroup(channelGroupName, event.getGuild().getIdLong());
return interactionService.replyEmbed(DISABLE_CHANNEL_GROUP_RESPONSE, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter
.builder()
.name(CHANNEL_GROUP_NAME_PARAMETER)
.type(String.class)
.templated(true)
.build();
.builder()
.name(CHANNEL_GROUP_NAME_PARAMETER)
.type(String.class)
.templated(true)
.build();
List<Parameter> parameters = Arrays.asList(channelGroupName);
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
.builder()
.templated(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(DISABLE_CHANNEL_GROUP_COMMAND)
.build();
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(DISABLE_CHANNEL_GROUP_COMMAND)
.build();
return CommandConfiguration.builder()
.name(DISABLE_CHANNEL_GROUP_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
.name(DISABLE_CHANNEL_GROUP_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
}
@Override

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.PostTargetNotValidException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.PostTargetService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -77,6 +78,7 @@ public class DisablePostTarget extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.POST_TARGET)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("disable")
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -49,40 +50,41 @@ public class EnableChannelGroup extends AbstractConditionableCommand {
String channelGroupName = slashCommandParameterService.getCommandOption(CHANNEL_GROUP_NAME_PARAMETER, event, String.class);
channelGroupService.enableChannelGroup(channelGroupName, event.getGuild().getIdLong());
return interactionService.replyEmbed(ENABLE_CHANNEL_GROUP_RESPONSE, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter
.builder()
.name(CHANNEL_GROUP_NAME_PARAMETER)
.type(String.class)
.templated(true)
.build();
.builder()
.name(CHANNEL_GROUP_NAME_PARAMETER)
.type(String.class)
.templated(true)
.build();
List<Parameter> parameters = Arrays.asList(channelGroupName);
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
.builder()
.templated(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(ENABLE_CHANNEL_GROUP_COMMAND)
.build();
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(ENABLE_CHANNEL_GROUP_COMMAND)
.build();
return CommandConfiguration.builder()
.name(ENABLE_CHANNEL_GROUP_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
.name(ENABLE_CHANNEL_GROUP_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
}
@Override

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.PostTargetNotValidException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.PostTargetService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -41,7 +42,7 @@ public class EnablePostTarget extends AbstractConditionableCommand {
@Override
public CommandResult execute(CommandContext commandContext) {
String targetName = (String) commandContext.getParameters().getParameters().get(0);
if(!postTargetService.validPostTarget(targetName)) {
if (!postTargetService.validPostTarget(targetName)) {
throw new PostTargetNotValidException(targetName, postTargetService.getAvailablePostTargets());
}
postTargetService.enablePostTarget(targetName, commandContext.getGuild().getIdLong());
@@ -51,45 +52,46 @@ public class EnablePostTarget extends AbstractConditionableCommand {
@Override
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
String postTargetName = slashCommandParameterService.getCommandOption(NAME_PARAMETER, event, String.class);
if(!postTargetService.validPostTarget(postTargetName)) {
if (!postTargetService.validPostTarget(postTargetName)) {
throw new PostTargetNotValidException(postTargetName, postTargetService.getAvailablePostTargets());
}
postTargetService.enablePostTarget(postTargetName, event.getGuild().getIdLong());
return interactionService.replyEmbed(ENABLE_POSTTARGET_RESPONSE, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
Parameter postTargetName = Parameter
.builder()
.name(NAME_PARAMETER)
.type(String.class)
.templated(true)
.build();
.builder()
.name(NAME_PARAMETER)
.type(String.class)
.templated(true)
.build();
List<Parameter> parameters = Arrays.asList(postTargetName);
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
.builder()
.templated(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.POST_TARGET)
.commandName("enable")
.build();
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.POST_TARGET)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("enable")
.build();
return CommandConfiguration.builder()
.name(ENABLE_POSTTARGET_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
.name(ENABLE_POSTTARGET_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
}
@Override

View File

@@ -10,6 +10,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.template.commands.ListChannelGroupsModel;
@@ -61,9 +62,9 @@ public class ListChannelGroups extends AbstractConditionableCommand {
AServer server = serverManagementService.loadServer(guild);
List<AChannelGroup> channelGroups = channelGroupManagementService.findAllInServer(server);
ListChannelGroupsModel template = ListChannelGroupsModel
.builder()
.groups(channelGroupService.convertAChannelGroupToChannelGroupChannel(channelGroups))
.build();
.builder()
.groups(channelGroupService.convertAChannelGroupToChannelGroupChannel(channelGroups))
.build();
return templateService.renderEmbedTemplate("listChannelGroups_response", template, guild.getIdLong());
}
@@ -71,34 +72,35 @@ public class ListChannelGroups extends AbstractConditionableCommand {
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
MessageToSend response = getMessageToSend(event.getGuild());
return interactionService.replyMessageToSend(response, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
List<String> aliases = Arrays.asList("lsChGrp");
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
.builder()
.templated(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(LIST_CHANNEL_GROUPS_COMMAND)
.build();
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(LIST_CHANNEL_GROUPS_COMMAND)
.build();
return CommandConfiguration.builder()
.name(LIST_CHANNEL_GROUPS_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.slashCommandConfig(slashCommandConfig)
.aliases(aliases)
.templated(true)
.help(helpInfo)
.supportsEmbedException(true)
.causesReaction(true)
.build();
.name(LIST_CHANNEL_GROUPS_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.slashCommandConfig(slashCommandConfig)
.aliases(aliases)
.templated(true)
.help(helpInfo)
.supportsEmbedException(true)
.causesReaction(true)
.build();
}
@Override

View File

@@ -1,11 +1,9 @@
package dev.sheldan.abstracto.core.commands.channels;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
import dev.sheldan.abstracto.core.command.config.HelpInfo;
import dev.sheldan.abstracto.core.command.config.Parameter;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.command.config.features.CoreFeatureDefinition;
import dev.sheldan.abstracto.core.command.exception.SlashCommandParameterMissingException;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
@@ -14,20 +12,28 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.exception.PostTargetNotValidException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.PostTarget;
import dev.sheldan.abstracto.core.models.template.commands.PostTargetDisplayModel;
import dev.sheldan.abstracto.core.models.template.commands.PostTargetModelEntry;
import dev.sheldan.abstracto.core.service.ChannelService;
import dev.sheldan.abstracto.core.service.PostTargetService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.service.management.PostTargetManagement;
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.core.utils.FutureUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
@@ -35,12 +41,6 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@Service
@Slf4j
public class PostTargetCommand extends AbstractConditionableCommand {
@@ -75,11 +75,11 @@ public class PostTargetCommand extends AbstractConditionableCommand {
@Override
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
Guild guild = commandContext.getGuild();
if(commandContext.getParameters().getParameters().isEmpty()) {
if (commandContext.getParameters().getParameters().isEmpty()) {
log.debug("Displaying existing post targets for guild {}.", guild.getId());
MessageToSend messageToSend = getMessageToSendForPosttargetDisplay(guild);
return FutureUtils.toSingleFutureGeneric(channelService.sendMessageToSendToChannel(messageToSend, commandContext.getChannel()))
.thenApply(aVoid -> CommandResult.fromSuccess());
.thenApply(aVoid -> CommandResult.fromSuccess());
}
String targetName = (String) commandContext.getParameters().getParameters().get(0);
GuildChannel channel = (GuildChannel) commandContext.getParameters().getParameters().get(1);
@@ -88,10 +88,10 @@ public class PostTargetCommand extends AbstractConditionableCommand {
}
private void validateAndCreatePosttarget(Guild guild, String targetName, GuildChannel channel) {
if(!postTargetService.validPostTarget(targetName)) {
if (!postTargetService.validPostTarget(targetName)) {
throw new PostTargetNotValidException(targetName, postTargetService.getAvailablePostTargets());
}
if(!channel.getGuild().equals(guild)) {
if (!channel.getGuild().equals(guild)) {
throw new EntityGuildMismatchException();
}
postTargetManagement.createOrUpdate(targetName, guild.getIdLong(), channel.getIdLong());
@@ -135,15 +135,15 @@ public class PostTargetCommand extends AbstractConditionableCommand {
@Override
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
if(!slashCommandParameterService.hasCommandOption(CHANNEL_PARAMETER, event) && !slashCommandParameterService.hasCommandOption(NAME_PARAMETER, event)) {
if (!slashCommandParameterService.hasCommandOption(CHANNEL_PARAMETER, event) && !slashCommandParameterService.hasCommandOption(NAME_PARAMETER, event)) {
MessageToSend messageToSend = getMessageToSendForPosttargetDisplay(event.getGuild());
return interactionService.replyMessageToSend(messageToSend, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
} else {
if(!slashCommandParameterService.hasCommandOption(NAME_PARAMETER, event)) {
if (!slashCommandParameterService.hasCommandOption(NAME_PARAMETER, event)) {
throw new SlashCommandParameterMissingException(NAME_PARAMETER);
}
if(!slashCommandParameterService.hasCommandOption(CHANNEL_PARAMETER, event)) {
if (!slashCommandParameterService.hasCommandOption(CHANNEL_PARAMETER, event)) {
throw new SlashCommandParameterMissingException(CHANNEL_PARAMETER);
}
String postTargetName = slashCommandParameterService.getCommandOption(NAME_PARAMETER, event, String.class);
@@ -157,44 +157,45 @@ public class PostTargetCommand extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter postTargetName = Parameter
.builder()
.name(NAME_PARAMETER)
.type(String.class)
.optional(true)
.templated(true)
.build();
.builder()
.name(NAME_PARAMETER)
.type(String.class)
.optional(true)
.templated(true)
.build();
Parameter channel = Parameter
.builder()
.name(CHANNEL_PARAMETER)
.type(TextChannel.class)
.optional(true)
.templated(true)
.build();
.builder()
.name(CHANNEL_PARAMETER)
.type(TextChannel.class)
.optional(true)
.templated(true)
.build();
List<Parameter> parameters = Arrays.asList(postTargetName, channel);
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.hasExample(true)
.build();
.builder()
.templated(true)
.hasExample(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.POST_TARGET)
.commandName(POSTTARGET_COMMAND)
.build();
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.POST_TARGET)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName(POSTTARGET_COMMAND)
.build();
return CommandConfiguration.builder()
.name(POSTTARGET_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.async(true)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
.name(POSTTARGET_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.parameters(parameters)
.async(true)
.slashCommandConfig(slashCommandConfig)
.supportsEmbedException(true)
.help(helpInfo)
.templated(true)
.causesReaction(true)
.build();
}
@Override

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AChannel;
import dev.sheldan.abstracto.core.service.ChannelGroupService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
@@ -51,7 +52,7 @@ public class RemoveFromChannelGroup extends AbstractConditionableCommand {
String name = (String) commandContext.getParameters().getParameters().get(0);
AChannel fakeChannel = (AChannel) commandContext.getParameters().getParameters().get(1);
AChannel actualChannel = channelManagementService.loadChannel(fakeChannel.getId());
if(!actualChannel.getServer().getId().equals(commandContext.getGuild().getIdLong())) {
if (!actualChannel.getServer().getId().equals(commandContext.getGuild().getIdLong())) {
throw new EntityGuildMismatchException();
}
channelGroupService.removeChannelFromChannelGroup(name, actualChannel);
@@ -62,10 +63,11 @@ public class RemoveFromChannelGroup extends AbstractConditionableCommand {
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
String channelGroupName = slashCommandParameterService.getCommandOption(NAME_PARAMETER, event, String.class);
AChannel actualChannel;
if(slashCommandParameterService.hasCommandOptionWithFullType(CHANNEL_PARAMETER, event, OptionType.CHANNEL)) {
GuildMessageChannel guildChannel = slashCommandParameterService.getCommandOption(CHANNEL_PARAMETER, event, AChannel.class, GuildMessageChannel.class);
if (slashCommandParameterService.hasCommandOptionWithFullType(CHANNEL_PARAMETER, event, OptionType.CHANNEL)) {
GuildMessageChannel guildChannel =
slashCommandParameterService.getCommandOption(CHANNEL_PARAMETER, event, AChannel.class, GuildMessageChannel.class);
actualChannel = channelManagementService.loadChannel(guildChannel.getIdLong());
} else if(slashCommandParameterService.hasCommandOptionWithFullType(CHANNEL_PARAMETER, event, OptionType.STRING)) {
} else if (slashCommandParameterService.hasCommandOptionWithFullType(CHANNEL_PARAMETER, event, OptionType.STRING)) {
String channelId = slashCommandParameterService.getCommandOption(CHANNEL_PARAMETER, event, AChannel.class, String.class);
actualChannel = channelManagementService.loadChannel(Long.parseLong(channelId));
} else {
@@ -73,47 +75,48 @@ public class RemoveFromChannelGroup extends AbstractConditionableCommand {
}
channelGroupService.removeChannelFromChannelGroup(channelGroupName, actualChannel);
return interactionService.replyEmbed(REMOVE_FROM_CHANNEL_GROUP_RESPONSE, event)
.thenApply(interactionHook -> CommandResult.fromSuccess());
.thenApply(interactionHook -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter
.builder()
.name(NAME_PARAMETER)
.type(String.class)
.build();
.builder()
.name(NAME_PARAMETER)
.type(String.class)
.build();
Parameter channelToAdd = Parameter
.builder()
.name(CHANNEL_PARAMETER)
.type(AChannel.class)
.build();
.builder()
.name(CHANNEL_PARAMETER)
.type(AChannel.class)
.build();
List<Parameter> parameters = Arrays.asList(channelGroupName, channelToAdd);
List<String> aliases = Arrays.asList("rmChChgrp", "chGrpCh-");
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.hasExample(true)
.build();
.builder()
.templated(true)
.hasExample(true)
.build();
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.commandName(REMOVE_FROM_CHANNEL_GROUP_COMMAND)
.build();
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CHANNELS)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(REMOVE_FROM_CHANNEL_GROUP_COMMAND)
.build();
return CommandConfiguration.builder()
.name(REMOVE_FROM_CHANNEL_GROUP_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.aliases(aliases)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.templated(true)
.help(helpInfo)
.supportsEmbedException(true)
.causesReaction(true)
.build();
.name(REMOVE_FROM_CHANNEL_GROUP_COMMAND)
.module(ChannelsModuleDefinition.CHANNELS)
.aliases(aliases)
.parameters(parameters)
.slashCommandConfig(slashCommandConfig)
.templated(true)
.help(helpInfo)
.supportsEmbedException(true)
.causesReaction(true)
.build();
}
@Override

View File

@@ -1,5 +1,7 @@
package dev.sheldan.abstracto.core.commands.config;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.condition.BotOwnerOnlyCondition;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
@@ -11,6 +13,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.CacheServiceBean;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +35,9 @@ public class ClearCache extends AbstractConditionableCommand {
@Autowired
private InteractionService interactionService;
@Autowired
private BotOwnerOnlyCondition botOwnerOnlyCondition;
@Override
public CommandResult execute(CommandContext commandContext) {
@@ -53,6 +59,7 @@ public class ClearCache extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.INTERNAL)
.commandName(CLEAR_CACHE_COMMAND)
.build();
@@ -77,4 +84,11 @@ public class ClearCache extends AbstractConditionableCommand {
public FeatureDefinition getFeature() {
return CoreFeatureDefinition.CORE_FEATURE;
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(botOwnerOnlyCondition);
return conditions;
}
}

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.command.service.management.FeatureManagementSe
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.ConfigurationKeyNotFoundException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ConfigService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.service.management.DefaultConfigManagementService;
@@ -97,6 +98,7 @@ public class ResetConfig extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.CONFIG)
.commandName("reset")
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ConfigService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -80,6 +81,7 @@ public class SetConfig extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.CONFIG)
.commandName("set")
.build();

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,6 +63,7 @@ public class RemoveCommandMemberCooldown extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.COOLDOWN)
.groupName("commandMember")
.commandName("remove")

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.utils.ParseUtils;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -73,6 +74,7 @@ public class SetCommandMemberCooldown extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.COOLDOWN)
.groupName("commandMember")
.commandName("set")

View File

@@ -14,6 +14,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureConfig;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.template.commands.FeatureSwitchModel;
import dev.sheldan.abstracto.core.service.ChannelService;
@@ -148,6 +149,7 @@ public class DisableFeature extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.FEATURE)
.commandName("disable")
.build();

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.FeatureConfigService;
import dev.sheldan.abstracto.core.service.FeatureModeService;
@@ -97,6 +98,7 @@ public class DisableMode extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.FEATURE)
.commandName(DISABLE_MODE_COMMAND)
.build();

View File

@@ -14,6 +14,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureConfig;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.FeatureValidationResult;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.template.commands.FeatureSwitchModel;
@@ -172,6 +173,7 @@ public class EnableFeature extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.FEATURE)
.commandName("enable")
.build();

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.FeatureMode;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.FeatureConfigService;
import dev.sheldan.abstracto.core.service.FeatureModeService;
@@ -95,6 +96,7 @@ public class EnableMode extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.FEATURE)
.commandName(ENABLE_MODE_COMMAND)
.build();

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.command.service.management.FeatureManagementSe
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AFeature;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.template.commands.FeatureModeDisplay;
@@ -116,6 +117,7 @@ public class FeatureModes extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.FEATURE)
.commandName(FEATURE_MODES_COMMAND)
.build();

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.converter.FeatureFlagConverter;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AFeatureFlag;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.property.FeatureFlagProperty;
@@ -104,6 +105,7 @@ public class Features extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.FEATURE)
.commandName("list")
.build();

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.ARole;
import dev.sheldan.abstracto.core.service.RoleImmunityService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
@@ -96,6 +97,7 @@ public class MakeAffected extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.CONFIG)
.commandName(MAKE_AFFECTED_COMMAND_NAME)
.build();

View File

@@ -13,6 +13,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.RoleImmunityService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.entities.Role;
@@ -89,6 +90,7 @@ public class MakeImmune extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.CONFIG)
.commandName(MAKE_IMMUNE_COMMAND)
.build();

View File

@@ -16,7 +16,6 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.models.database.AFeature;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,9 +36,6 @@ public class Restrict extends AbstractConditionableCommand {
@Autowired
private CommandService commandService;
@Autowired
private RoleManagementService roleManagementService;
@Autowired
private TemplateService templateService;

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.EffectType;
import dev.sheldan.abstracto.core.models.template.commands.ShowEffectsModel;
import dev.sheldan.abstracto.core.service.ChannelService;
@@ -73,6 +74,7 @@ public class ShowEffects extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.rootCommandName(CoreSlashCommandNames.CONFIG)
.commandName(SHOW_EFFECTS_COMMAND)
.build();

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ProfanityService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -109,6 +110,7 @@ public class AddProfanityRegex extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.PROFANITY)
.commandName(ADD_PROFANITY_REGEX_COMMAND)
.build();

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ProfanityService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -70,6 +71,7 @@ public class CreateProfanityGroup extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.PROFANITY)
.commandName(CREATE_PROFANITY_GROUP_COMMAND)
.build();

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ProfanityService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -70,6 +71,7 @@ public class DeleteProfanityGroup extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.PROFANITY)
.commandName(DELETE_PROFANITY_GROUP_COMMAND)
.build();

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.service.ProfanityService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -79,6 +80,7 @@ public class RemoveProfanityRegex extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.PROFANITY)
.commandName(REMOVE_PROFANITY_REGEX_COMMAND)
.build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.ProfanityGroup;
import dev.sheldan.abstracto.core.models.template.commands.ProfanityConfigModel;
import dev.sheldan.abstracto.core.service.ChannelService;
@@ -77,6 +78,7 @@ public class ShowProfanityConfig extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.PROFANITY)
.commandName(SHOW_PROFANITY_CONFIG_COMMAND)
.build();

View File

@@ -1,5 +1,7 @@
package dev.sheldan.abstracto.core.commands.config.template;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.condition.BotOwnerOnlyCondition;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
@@ -13,6 +15,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.CustomTemplateNotFoundException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.template.commands.GetCustomTemplateModel;
import dev.sheldan.abstracto.core.service.ChannelService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
@@ -59,6 +62,9 @@ public class GetCustomTemplate extends AbstractConditionableCommand {
@Autowired
private TemplateService templateService;
@Autowired
private BotOwnerOnlyCondition botOwnerOnlyCondition;
@Override
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
String templateKey = (String) commandContext.getParameters().getParameters().get(0);
@@ -110,6 +116,7 @@ public class GetCustomTemplate extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.INTERNAL)
.commandName(GET_CUSTOM_TEMPLATE_COMMAND)
.build();
@@ -131,4 +138,11 @@ public class GetCustomTemplate extends AbstractConditionableCommand {
public FeatureDefinition getFeature() {
return CoreFeatureDefinition.CORE_FEATURE;
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(botOwnerOnlyCondition);
return conditions;
}
}

View File

@@ -1,5 +1,7 @@
package dev.sheldan.abstracto.core.commands.config.template;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.condition.BotOwnerOnlyCondition;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
@@ -13,6 +15,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.TemplateNotFoundException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.template.commands.GetTemplateModel;
import dev.sheldan.abstracto.core.service.ChannelService;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
@@ -56,6 +59,9 @@ public class GetTemplate extends AbstractConditionableCommand {
@Autowired
private FileService fileService;
@Autowired
private BotOwnerOnlyCondition botOwnerOnlyCondition;
@Override
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
String templateKey = (String) commandContext.getParameters().getParameters().get(0);
@@ -105,6 +111,7 @@ public class GetTemplate extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(GET_TEMPLATE_COMMAND)
.build();
@@ -125,4 +132,11 @@ public class GetTemplate extends AbstractConditionableCommand {
public FeatureDefinition getFeature() {
return CoreFeatureDefinition.CORE_FEATURE;
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(botOwnerOnlyCondition);
return conditions;
}
}

View File

@@ -1,5 +1,7 @@
package dev.sheldan.abstracto.core.commands.config.template;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.condition.BotOwnerOnlyCondition;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
@@ -13,6 +15,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.exception.CustomTemplateNotFoundException;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.templating.model.database.CustomTemplate;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
@@ -45,6 +48,9 @@ public class ResetTemplate extends AbstractConditionableCommand {
@Autowired
private InteractionService interactionService;
@Autowired
private BotOwnerOnlyCondition botOwnerOnlyCondition;
@Override
public CommandResult execute(CommandContext commandContext) {
String templateKey = (String) commandContext.getParameters().getParameters().get(0);
@@ -89,6 +95,7 @@ public class ResetTemplate extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.INTERNAL)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.commandName(RESET_TEMPLATE_COMMAND)
.build();
@@ -108,4 +115,11 @@ public class ResetTemplate extends AbstractConditionableCommand {
public FeatureDefinition getFeature() {
return CoreFeatureDefinition.CORE_FEATURE;
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(botOwnerOnlyCondition);
return conditions;
}
}

View File

@@ -1,5 +1,7 @@
package dev.sheldan.abstracto.core.commands.config.template;
import dev.sheldan.abstracto.core.command.condition.CommandCondition;
import dev.sheldan.abstracto.core.command.condition.BotOwnerOnlyCondition;
import dev.sheldan.abstracto.core.interaction.slash.CoreSlashCommandNames;
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
@@ -13,6 +15,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.core.templating.service.management.CustomTemplateManagementService;
@@ -55,6 +58,9 @@ public class SetTemplate extends AbstractConditionableCommand {
@Autowired
private InteractionService interactionService;
@Autowired
private BotOwnerOnlyCondition botOwnerOnlyCondition;
@Override
public CommandResult execute(CommandContext commandContext) {
List<Object> parameter = commandContext.getParameters().getParameters();
@@ -136,6 +142,7 @@ public class SetTemplate extends AbstractConditionableCommand {
SlashCommandConfig slashCommandConfig = SlashCommandConfig
.builder()
.enabled(true)
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(CoreSlashCommandNames.INTERNAL)
.commandName(SET_TEMPLATE_COMMAND)
.build();
@@ -151,4 +158,11 @@ public class SetTemplate extends AbstractConditionableCommand {
.causesReaction(true)
.build();
}
@Override
public List<CommandCondition> getConditions() {
List<CommandCondition> conditions = super.getConditions();
conditions.add(botOwnerOnlyCondition);
return conditions;
}
}

View File

@@ -12,6 +12,7 @@ import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.models.template.commands.EchoModel;
import dev.sheldan.abstracto.core.models.template.commands.EchoRedirectResponseModel;
@@ -122,6 +123,7 @@ public class Echo extends AbstractConditionableCommand {
.enabled(true)
.userInstallable(true)
.userCommandConfig(UserCommandConfig.all())
.defaultPrivilege(SlashCommandPrivilegeLevels.ADMIN)
.rootCommandName(ECHO_COMMAND)
.build();
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();

View File

@@ -11,6 +11,7 @@ import dev.sheldan.abstracto.core.commands.config.ConfigModuleDefinition;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.interaction.InteractionService;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandPrivilegeLevels;
import dev.sheldan.abstracto.core.models.database.AEmote;
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
import dev.sheldan.abstracto.core.service.management.EmoteManagementService;
@@ -82,6 +83,7 @@ public class SetEmote extends AbstractConditionableCommand {
.builder()
.enabled(true)
.rootCommandName(CoreSlashCommandNames.CONFIG)
.defaultPrivilege(SlashCommandPrivilegeLevels.INVITER)
.commandName("setEmote")
.build();
return CommandConfiguration.builder()

View File

@@ -15,11 +15,13 @@ import dev.sheldan.abstracto.core.service.FeatureConfigService;
import dev.sheldan.abstracto.core.service.FeatureFlagService;
import dev.sheldan.abstracto.core.templating.service.TemplateService;
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.interactions.IntegrationType;
import net.dv8tion.jda.api.interactions.InteractionContextType;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.Command;
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
import net.dv8tion.jda.api.interactions.commands.OptionType;
import net.dv8tion.jda.api.interactions.commands.build.*;
import org.apache.commons.lang3.StringUtils;
@@ -92,7 +94,17 @@ public class SlashCommandServiceBean implements SlashCommandService {
.filter(commandData -> commandData.getSecond().getName().equals(rootName))
.map(Pair::getSecond)
.findAny();
SlashCommandData rootCommand = existingRootCommand.orElseGet(() -> Commands.slash(rootName, description));
DefaultMemberPermissions defaultPermissions;
if(slashConfig.getDefaultPrivilege() != null) {
defaultPermissions = switch (slashConfig.getDefaultPrivilege()) {
case ADMIN -> DefaultMemberPermissions.enabledFor(Permission.ADMINISTRATOR);
case INVITER -> DefaultMemberPermissions.enabledFor(Permission.MANAGE_SERVER);
case NONE -> DefaultMemberPermissions.ENABLED;
};
} else {
defaultPermissions = DefaultMemberPermissions.ENABLED;
}
SlashCommandData rootCommand = existingRootCommand.orElseGet(() -> Commands.slash(rootName, description).setDefaultPermissions(defaultPermissions));
if(commandConfiguration.isUserInstallable() && userCommandsOnly) {
rootCommand.setIntegrationTypes(IntegrationType.USER_INSTALL);
if(commandConfiguration.getSlashCommandConfig().getUserCommandConfig() != null) {

View File

@@ -0,0 +1,50 @@
package dev.sheldan.abstracto.core.command.condition;
import dev.sheldan.abstracto.core.command.Command;
import dev.sheldan.abstracto.core.command.condition.detail.NotBotOwnerConditionDetail;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import java.util.concurrent.CompletableFuture;
import net.dv8tion.jda.api.entities.ApplicationTeam;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import org.springframework.stereotype.Component;
@Component
public class BotOwnerOnlyCondition implements CommandCondition {
@Override
public CompletableFuture<ConditionResult> shouldExecuteAsync(CommandContext commandContext, Command command) {
return commandContext.getJda().retrieveApplicationInfo().submit()
.thenApply(applicationInfo -> {
ApplicationTeam team = applicationInfo.getTeam();
boolean hasTeam = team != null;
if(hasTeam && team.isMember(commandContext.getAuthor().getUser())) {
return ConditionResult.fromSuccess();
} else if(!hasTeam && applicationInfo.getOwner().getId().equals(commandContext.getAuthor().getUser().getId())) {
return ConditionResult.fromSuccess();
} else {
return ConditionResult.fromFailure(new NotBotOwnerConditionDetail());
}
});
}
@Override
public CompletableFuture<ConditionResult> shouldExecuteAsync(SlashCommandInteractionEvent slashCommandInteractionEvent, Command command) {
return slashCommandInteractionEvent.getJDA().retrieveApplicationInfo().submit()
.thenApply(applicationInfo -> {
ApplicationTeam team = applicationInfo.getTeam();
boolean hasTeam = team != null;
if(hasTeam && team.isMember(slashCommandInteractionEvent.getUser())) {
return ConditionResult.fromSuccess();
} else if(!hasTeam && applicationInfo.getOwner().getId().equals(slashCommandInteractionEvent.getInteraction().getUser().getId())) {
return ConditionResult.fromSuccess();
} else {
return ConditionResult.fromFailure(new NotBotOwnerConditionDetail());
}
});
}
@Override
public boolean isAsync() {
return true;
}
}

View File

@@ -0,0 +1,20 @@
package dev.sheldan.abstracto.core.command.condition.detail;
import dev.sheldan.abstracto.core.command.condition.ConditionDetail;
public class NotBotOwnerConditionDetail implements ConditionDetail {
public NotBotOwnerConditionDetail() {
}
@Override
public String getTemplateName() {
return "is_bot_owner_condition";
}
@Override
public Object getTemplateModel() {
return new Object();
}
}

View File

@@ -21,6 +21,8 @@ public class SlashCommandConfig {
private String userGroupName;
private String commandName;
private String userCommandName;
@Builder.Default
private SlashCommandPrivilegeLevels defaultPrivilege = SlashCommandPrivilegeLevels.NONE;
@Builder.Default
private boolean userInstallable = false;

View File

@@ -0,0 +1,7 @@
package dev.sheldan.abstracto.core.interaction.slash;
public enum SlashCommandPrivilegeLevels {
ADMIN,
INVITER,
NONE
}