diff --git a/pom.xml b/pom.xml index 184c9ef..106b6a4 100644 --- a/pom.xml +++ b/pom.xml @@ -70,6 +70,12 @@ + + + jitpack.io + https://jitpack.io + + @@ -134,10 +140,15 @@ + + + + + - net.dv8tion + io.github.freya022 JDA - 5.0.0-beta.24 + 2ed819ad15 com.google.code.gson diff --git a/src/main/java/cc/fascinated/bat/command/BatCommand.java b/src/main/java/cc/fascinated/bat/command/BatCommand.java index e5842c5..165bb40 100644 --- a/src/main/java/cc/fascinated/bat/command/BatCommand.java +++ b/src/main/java/cc/fascinated/bat/command/BatCommand.java @@ -4,6 +4,8 @@ import cc.fascinated.bat.features.Feature; import lombok.Getter; import lombok.NonNull; import lombok.Setter; +import net.dv8tion.jda.api.interactions.IntegrationType; +import net.dv8tion.jda.api.interactions.InteractionContextType; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; @@ -59,8 +61,12 @@ public abstract class BatCommand implements BatCommandExecutor { this.category = this.commandInfo.category(); this.botOwnerOnly = this.commandInfo.botOwnerOnly(); + List integrationTypes = this.commandInfo.userInstall() ? List.of(IntegrationType.GUILD_INSTALL, IntegrationType.USER_INSTALL) : + List.of(IntegrationType.GUILD_INSTALL); this.commandData = new CommandDataImpl(this.commandInfo.name(), this.commandInfo.description()) - .setGuildOnly(this.commandInfo.guildOnly()); + .setGuildOnly(this.commandInfo.guildOnly()) + .setContexts(InteractionContextType.ALL) + .setIntegrationTypes(integrationTypes); } /** diff --git a/src/main/java/cc/fascinated/bat/command/CommandInfo.java b/src/main/java/cc/fascinated/bat/command/CommandInfo.java index 312e8f9..37b87d1 100644 --- a/src/main/java/cc/fascinated/bat/command/CommandInfo.java +++ b/src/main/java/cc/fascinated/bat/command/CommandInfo.java @@ -34,6 +34,13 @@ public @interface CommandInfo { */ boolean guildOnly() default true; + /** + * If the command can be user installed + * + * @return if the command is user installable + */ + boolean userInstall() default false; + /** * The required permissions for the command * diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/discord/LookupUserCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/discord/LookupUserCommand.java index 1472c28..67d17d6 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/discord/LookupUserCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/discord/LookupUserCommand.java @@ -21,7 +21,7 @@ import org.springframework.stereotype.Component; * @author Fascinated (fascinated7) */ @Component -@CommandInfo(name = "lookupuser", description = "Lookup a user") +@CommandInfo(name = "lookupuser", description = "Lookup a user", userInstall = true) public class LookupUserCommand extends BatCommand { public LookupUserCommand() { super.addOption(OptionType.STRING, "id", "The id of the user", true); diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java index e458b85..ead16eb 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/server/channel/SetTopicSubCommand.java @@ -46,7 +46,7 @@ public class SetTopicSubCommand extends BatSubCommand { .queue(); return; } - event.deferReply().queue(hook -> textChannel.getManager().setTopic(topic).queue((voiddd) -> hook.editOriginalEmbeds(EmbedUtils.successEmbed() + event.deferReply().queue(hook -> textChannel.getManager().setTopic(topic).queue((voidd) -> hook.editOriginalEmbeds(EmbedUtils.successEmbed() .setDescription("Successfully set the topic of <#%s> to: \"%s\"".formatted(textChannel.getId(), topic)) .build()).queue())); }