fix
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m2s

This commit is contained in:
Lee 2024-07-04 15:36:52 +01:00
parent 92a0c23b49
commit 7abdcd4d95

View File

@ -26,18 +26,21 @@ public abstract class BatCommand {
/**
* The info of this command.
*/
@NonNull private final InternalCommandInfo info;
@NonNull
private final InternalCommandInfo info;
/**
* The feature this command belongs to.
*/
@Setter private Feature feature;
@Setter
private Feature feature;
/**
* The snowflake of this command, set when
* this command is registered with Discord.
*/
@Setter private long snowflake;
@Setter
private long snowflake;
/**
* The sub commands of this command, if any.
@ -47,39 +50,41 @@ public abstract class BatCommand {
/**
* The internal data for this command.
*/
@Setter(AccessLevel.PRIVATE) private CommandDataImpl commandData;
@Setter(AccessLevel.PRIVATE)
private CommandDataImpl commandData;
/**
* The internal subcommand data for this command.
*/
@Setter(AccessLevel.PRIVATE) private SubcommandData subcommandData;
@Setter(AccessLevel.PRIVATE)
private SubcommandData subcommandData;
public BatCommand() {
if (!getClass().isAnnotationPresent(CommandInfo.class)) {
throw new IllegalStateException("Missing @CommandInfo annotation in " + getClass().getSimpleName());
}
info = new InternalCommandInfo(getClass().getAnnotation(CommandInfo.class));
List<IntegrationType> integrationTypes = new ArrayList<>(Collections.singletonList(IntegrationType.GUILD_INSTALL));
if (info.isUserInstall()) {
integrationTypes.add(IntegrationType.USER_INSTALL);
}
System.out.println(integrationTypes);
commandData = new CommandDataImpl(info.getName(), info.getDescription())
.setIntegrationTypes(integrationTypes)
.setGuildOnly(info.isGuildOnly());
.setIntegrationTypes(info.isUserInstall() ?
EnumSet.of(IntegrationType.USER_INSTALL) :
EnumSet.of(IntegrationType.GUILD_INSTALL)
).setContexts(info.isGuildOnly() ?
EnumSet.of(InteractionContextType.GUILD) :
EnumSet.of(InteractionContextType.GUILD, InteractionContextType.BOT_DM, InteractionContextType.PRIVATE_CHANNEL)
);
}
/**
* Fired when this command is executed.
*
* @param guild the guild the command was executed in, if any
* @param user the user who executed the command
* @param guild the guild the command was executed in, if any
* @param user the user who executed the command
* @param channel the channel the command was executed in
* @param member the member who executed the command, null if not a guild
* @param event the event that invoked this command
* @param member the member who executed the command, null if not a guild
* @param event the event that invoked this command
*/
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { }
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
}
/**
* Register the given sub commands.