forked from Fascinated/Bat
MAYBE USER INSTALL COMMANDS PLEASE??~!?!?!?!?!?!?!!!?!?!!?!!?!?!?!!!?!??!??!?!?!?!?!?!?!?!?!?!?!?!?!
This commit is contained in:
parent
bf2e046718
commit
50796d00f0
15
pom.xml
15
pom.xml
@ -70,6 +70,12 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring -->
|
||||
@ -134,10 +140,15 @@
|
||||
</dependency>
|
||||
|
||||
<!-- Dependencies -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>net.dv8tion</groupId>-->
|
||||
<!-- <artifactId>JDA</artifactId>-->
|
||||
<!-- <version>5.0.0-beta.24</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<groupId>io.github.freya022</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>5.0.0-beta.24</version>
|
||||
<version>2ed819ad15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
|
@ -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<IntegrationType> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user