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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Spring -->
|
<!-- Spring -->
|
||||||
@ -134,10 +140,15 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Dependencies -->
|
<!-- Dependencies -->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>net.dv8tion</groupId>-->
|
||||||
|
<!-- <artifactId>JDA</artifactId>-->
|
||||||
|
<!-- <version>5.0.0-beta.24</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>io.github.freya022</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>5.0.0-beta.24</version>
|
<version>2ed819ad15</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
@ -4,6 +4,8 @@ import cc.fascinated.bat.features.Feature;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
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.OptionMapping;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||||
@ -59,8 +61,12 @@ public abstract class BatCommand implements BatCommandExecutor {
|
|||||||
this.category = this.commandInfo.category();
|
this.category = this.commandInfo.category();
|
||||||
this.botOwnerOnly = this.commandInfo.botOwnerOnly();
|
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())
|
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;
|
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
|
* The required permissions for the command
|
||||||
*
|
*
|
||||||
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
|
|||||||
* @author Fascinated (fascinated7)
|
* @author Fascinated (fascinated7)
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@CommandInfo(name = "lookupuser", description = "Lookup a user")
|
@CommandInfo(name = "lookupuser", description = "Lookup a user", userInstall = true)
|
||||||
public class LookupUserCommand extends BatCommand {
|
public class LookupUserCommand extends BatCommand {
|
||||||
public LookupUserCommand() {
|
public LookupUserCommand() {
|
||||||
super.addOption(OptionType.STRING, "id", "The id of the user", true);
|
super.addOption(OptionType.STRING, "id", "The id of the user", true);
|
||||||
|
@ -46,7 +46,7 @@ public class SetTopicSubCommand extends BatSubCommand {
|
|||||||
.queue();
|
.queue();
|
||||||
return;
|
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))
|
.setDescription("Successfully set the topic of <#%s> to: \"%s\"".formatted(textChannel.getId(), topic))
|
||||||
.build()).queue()));
|
.build()).queue()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user