add scoresaber score summary
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m59s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m59s
This commit is contained in:
parent
f5c31195da
commit
8526036044
5
pom.xml
5
pom.xml
@ -191,5 +191,10 @@
|
||||
<artifactId>mcutils-java-library</artifactId>
|
||||
<version>1.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.Steppschuh</groupId>
|
||||
<artifactId>Java-Markdown-Generator</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -4,21 +4,20 @@ import cc.fascinated.bat.features.Feature;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.*;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.IntegrationType;
|
||||
import net.dv8tion.jda.api.interactions.InteractionContextType;
|
||||
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
|
||||
import net.dv8tion.jda.api.requests.restaction.MessageCreateAction;
|
||||
import net.dv8tion.jda.internal.interactions.CommandDataImpl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Braydon
|
||||
@ -80,13 +79,16 @@ public abstract class BatCommand {
|
||||
/**
|
||||
* 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 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 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 commandMessage the message that invoked this command, if any
|
||||
* @param arguments the arguments of the command, if any
|
||||
* @param event the event that invoked this command, if any
|
||||
*/
|
||||
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,
|
||||
Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,25 +147,51 @@ public abstract class BatCommand {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an argument from the command.
|
||||
* Reply to the message or interaction with the given contents.
|
||||
*
|
||||
* @param argumentIndex the index of the argument in the command
|
||||
* @param option the option to get from the slash command
|
||||
* @param arguments the arguments of the invoked command
|
||||
* @param event the event that invoked the command
|
||||
* @param message the message to reply to, null if interaction
|
||||
* @param interaction the interaction to reply to, null if message
|
||||
* @param contents the contents to reply with
|
||||
*/
|
||||
public void replyMessage(Message message, SlashCommandInteraction interaction, String contents) {
|
||||
if (message != null) {
|
||||
message.reply(contents).queue();
|
||||
} else {
|
||||
interaction.reply(contents).queue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reply to the message or interaction with the given embed.
|
||||
*
|
||||
* @param message the message to reply to, null if interaction
|
||||
* @param interaction the interaction to reply to, null if message
|
||||
* @param builder the embed builder to reply with
|
||||
*/
|
||||
public void replyEmbed(Message message, SlashCommandInteraction interaction, EmbedBuilder builder) {
|
||||
if (message != null) {
|
||||
message.replyEmbeds(builder.build()).queue();
|
||||
} else {
|
||||
interaction.replyEmbeds(builder.build()).queue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the argument from the command.
|
||||
*
|
||||
* @param option the option to get from the slash command
|
||||
* @param arguments the arguments of the invoked command
|
||||
* @param argumentIndex the index of the argument in the command
|
||||
* @param concatenateLeftover whether to concatenate the leftover arguments
|
||||
* @param event the event that invoked the command
|
||||
* @return the argument
|
||||
*/
|
||||
public Argument getArgument(int argumentIndex, String option, String[] arguments, SlashCommandInteraction event) {
|
||||
return new Argument(argumentIndex, option, arguments, event);
|
||||
public Argument getArgument(String option, String[] arguments, int argumentIndex, boolean concatenateLeftover, SlashCommandInteraction event) {
|
||||
return new Argument(option, arguments, argumentIndex, concatenateLeftover, event);
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
public static class Argument {
|
||||
/**
|
||||
* The index of the argument in the command.
|
||||
*/
|
||||
private final int argumentIndex;
|
||||
|
||||
/**
|
||||
* The option to get from the slash command.
|
||||
*/
|
||||
@ -174,6 +202,16 @@ public abstract class BatCommand {
|
||||
*/
|
||||
private final String[] arguments;
|
||||
|
||||
/**
|
||||
* The index of the argument in the command.
|
||||
*/
|
||||
private final int argumentIndex;
|
||||
|
||||
/**
|
||||
* Whether to concatenate the leftover arguments.
|
||||
*/
|
||||
private final boolean concatenateLeftover;
|
||||
|
||||
/**
|
||||
* The event that invoked the command.
|
||||
*/
|
||||
@ -185,14 +223,24 @@ public abstract class BatCommand {
|
||||
* @return the argument
|
||||
*/
|
||||
public String getAsString() {
|
||||
if (event != null) {
|
||||
if (event != null) { // Get the option from the event
|
||||
OptionMapping option = event.getOption(this.option);
|
||||
if (option == null) {
|
||||
return null;
|
||||
}
|
||||
return option.getAsString();
|
||||
}
|
||||
return arguments[argumentIndex];
|
||||
if (arguments.length < argumentIndex) { // Check if the argument index is out of bounds
|
||||
return null;
|
||||
}
|
||||
if (concatenateLeftover) { // Concatenate the leftover arguments
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = argumentIndex; i < arguments.length; i++) {
|
||||
builder.append(arguments[i]).append(" ");
|
||||
}
|
||||
return builder.toString().trim();
|
||||
}
|
||||
return arguments[argumentIndex]; // Get the argument at the index
|
||||
}
|
||||
}
|
||||
}
|
@ -44,6 +44,13 @@ public @interface CommandInfo {
|
||||
*/
|
||||
boolean userInstall() default false;
|
||||
|
||||
/**
|
||||
* If the command can be executed with a prefix
|
||||
*
|
||||
* @return if the command can be executed with a prefix
|
||||
*/
|
||||
boolean prefixAllowed() default false;
|
||||
|
||||
/**
|
||||
* The required permissions for the command
|
||||
*
|
||||
|
@ -48,6 +48,11 @@ public class InternalCommandInfo {
|
||||
*/
|
||||
private boolean botOwnerOnly;
|
||||
|
||||
/**
|
||||
* Whether the command can be ran with a prefix.
|
||||
*/
|
||||
private boolean prefixAllowed;
|
||||
|
||||
protected InternalCommandInfo(@NonNull CommandInfo annotation) {
|
||||
name = annotation.name();
|
||||
description = annotation.description();
|
||||
@ -56,5 +61,6 @@ public class InternalCommandInfo {
|
||||
guildOnly = annotation.guildOnly() && !annotation.userInstall();
|
||||
userInstall = annotation.userInstall();
|
||||
botOwnerOnly = annotation.botOwnerOnly();
|
||||
prefixAllowed = annotation.prefixAllowed();
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -29,14 +30,16 @@ public class AfkCommand extends BatCommand {
|
||||
/**
|
||||
* 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 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 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 commandMessage
|
||||
* @param arguments
|
||||
* @param event the event that invoked this command
|
||||
*/
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
AfkProfile profile = guild.getProfile(AfkProfile.class);
|
||||
String reason = null;
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -30,7 +31,7 @@ public class AddSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
||||
// Check if the guild has reached the maximum auto roles count
|
||||
int maxRoleSlots = AutoRoleProfile.getMaxRoleSlots(guild);
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "clear", description = "Clears all auto roles")
|
||||
public class ClearSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
||||
|
||||
profile.reset();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "list", description = "Lists all auto roles")
|
||||
public class ListSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
||||
if (profile.getRoles().isEmpty()) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -29,7 +30,7 @@ public class RemoveSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
||||
OptionMapping option = event.getOption("role");
|
||||
assert option != null;
|
||||
|
@ -11,6 +11,7 @@ import lombok.NonNull;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
@ -29,7 +30,7 @@ import java.util.Map;
|
||||
@CommandInfo(name = "sync", description = "Gives everyone their missing auto roles")
|
||||
public class SyncSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
AutoRoleProfile profile = guild.getProfile(AutoRoleProfile.class);
|
||||
if (profile.getRoles().isEmpty()) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
3
src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumRemoveSubCommand.java
3
src/main/java/cc/fascinated/bat/features/base/commands/botadmin/premium/PremiumRemoveSubCommand.java
@ -8,6 +8,7 @@ import cc.fascinated.bat.premium.PremiumProfile;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -31,7 +32,7 @@ public class PremiumRemoveSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping guildOption = event.getOption("guild");
|
||||
if (guildOption == null) {
|
||||
event.reply("Please provide a guild id").queue();
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.premium.PremiumProfile;
|
||||
import cc.fascinated.bat.service.GuildService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -34,7 +35,7 @@ public class PremiumSetSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping guildOption = event.getOption("guild");
|
||||
if (guildOption == null) {
|
||||
event.reply("Please provide a guild id").queue();
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
@ -18,7 +19,13 @@ import org.springframework.stereotype.Component;
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@Component
|
||||
@CommandInfo(name = "8ball", description = "Ask the magic 8ball a question", guildOnly = false, userInstall = true, category = Category.FUN)
|
||||
@CommandInfo(
|
||||
name = "8ball", description = "Ask the magic 8ball a question",
|
||||
guildOnly = false,
|
||||
userInstall = true,
|
||||
prefixAllowed = true,
|
||||
category = Category.FUN
|
||||
)
|
||||
public class EightBallCommand extends BatCommand {
|
||||
private final String[] responses = new String[]{
|
||||
"It is certain",
|
||||
@ -48,17 +55,18 @@ public class EightBallCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) {
|
||||
String question = super.getArgument(0, "question", null, event).getAsString();
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
String question = super.getArgument("question", arguments, 0, true, event).getAsString();
|
||||
if (question == null) {
|
||||
// todo: reply
|
||||
super.replyEmbed(commandMessage, event, EmbedUtils.errorEmbed()
|
||||
.setDescription("You need to provide a question to ask the 8ball")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
String response = responses[(int) (Math.random() * responses.length)];
|
||||
event.replyEmbeds(EmbedUtils.successEmbed()
|
||||
.setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
|
||||
.build())
|
||||
.queue();
|
||||
super.replyEmbed(commandMessage, event, EmbedUtils.successEmbed()
|
||||
.setDescription("You asked: `%s`\n\n:8ball: The magic 8ball says: `%s`".formatted(question, response))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -34,7 +35,7 @@ public class PPSizeCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
assert userOption != null; // This should never be null
|
||||
User target = userOption.getAsUser();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.thecatapi.CatImageToken;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "cat", description = "Get a random cat image")
|
||||
public class CatSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
CatImageToken[] responseEntity = WebRequest.getAsEntity("https://api.thecatapi.com/v1/images/search", CatImageToken[].class);
|
||||
if (responseEntity == null || responseEntity.length == 0) {
|
||||
event.reply("Failed to get a cat image!").queue();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.dogceo.RandomImage;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "dog", description = "Get a random dog image")
|
||||
public class DogSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
RandomImage responseEntity = WebRequest.getAsEntity("https://dog.ceo/api/breeds/image/random", RandomImage.class);
|
||||
if (responseEntity == null) {
|
||||
event.reply("Failed to get a dog image!").queue();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.randomd.RandomDuck;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "duck", description = "Get a random duck image")
|
||||
public class DuckSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
RandomDuck responseEntity = WebRequest.getAsEntity("https://random-d.uk/api/v2/random", RandomDuck.class);
|
||||
if (responseEntity == null) {
|
||||
event.reply("Failed to get a duck image!").queue();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.randomfox.RandomFoxToken;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "fox", description = "Get a random fox image")
|
||||
public class FoxSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
RandomFoxToken responseEntity = WebRequest.getAsEntity("https://randomfox.ca/floof/", RandomFoxToken.class);
|
||||
if (responseEntity == null) {
|
||||
event.reply("Failed to get a fox image!").queue();
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -38,7 +39,7 @@ public class BotStatsCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
JDA jda = DiscordService.JDA;
|
||||
long memoryUsed = (runtime.totalMemory() - runtime.freeMemory());
|
||||
|
||||
|
@ -14,13 +14,13 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.CommandService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ public class HelpCommand extends BatCommand implements EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
InteractionBuilder interactionBuilder = new InteractionBuilder();
|
||||
interactionBuilder.addUrlButton("Invite Me", Consts.INVITE_URL, null);
|
||||
interactionBuilder.addUrlButton("Support Server", Consts.SUPPORT_INVITE_URL, null);
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "invite", description = "Invite the bot to your server!", guildOnly = false, category = Category.GENERAL)
|
||||
public class InviteCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
event.replyEmbeds(EmbedUtils.genericEmbed()
|
||||
.setDescription("You can invite the bot to your server by clicking [here](%s)".formatted(Consts.INVITE_URL))
|
||||
.build())
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.DiscordService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -16,10 +17,16 @@ import org.springframework.stereotype.Component;
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@Component
|
||||
@CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false, userInstall = true, category = Category.GENERAL)
|
||||
@CommandInfo(
|
||||
name = "ping",
|
||||
description = "Gets the ping of the bot",
|
||||
guildOnly = false,
|
||||
userInstall = true,
|
||||
category = Category.GENERAL
|
||||
)
|
||||
public class PingCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
long time = System.currentTimeMillis();
|
||||
event.reply("Pinging...").queue(response -> {
|
||||
response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted(
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -25,7 +26,7 @@ public class VoteCommand extends BatCommand {
|
||||
};
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
DescriptionBuilder description = new DescriptionBuilder("Vote Links");
|
||||
description.appendLine("Vote for the bot on the following websites to support us!", false);
|
||||
for (String link : VOTE_LINKS) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import net.dv8tion.jda.api.utils.ImageProxy;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "guild", description = "View the avatar of the guild", category = Category.GENERAL)
|
||||
public class GuildSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ImageProxy icon = guild.getDiscordGuild().getIcon();
|
||||
if (icon == null) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -27,7 +28,7 @@ public class UserSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
assert userOption != null;
|
||||
User target = userOption.getAsUser();
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import net.dv8tion.jda.api.utils.ImageProxy;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "guild", description = "View the banner of the guild", category = Category.GENERAL)
|
||||
public class GuildSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ImageProxy banner = guild.getDiscordGuild().getBanner();
|
||||
if (banner == null) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -28,7 +29,7 @@ public class UserSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
assert userOption != null;
|
||||
User target = userOption.getAsUser();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "membercount", description = "View the member count of the server!")
|
||||
public class MemberCountCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
Guild discordGuild = guild.getDiscordGuild();
|
||||
int totalMembers = 0, totalUsers = 0, totalBots = 0;
|
||||
for (Member guildMember : discordGuild.getMembers()) {
|
||||
|
@ -10,6 +10,7 @@ import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -21,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "premium", description = "View the premium information for the guild", requiredPermissions = Permission.ADMINISTRATOR)
|
||||
public class PremiumCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
PremiumProfile premium = guild.getPremiumProfile();
|
||||
EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information");
|
||||
if (premium.hasPremium()) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.Channel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -27,7 +28,7 @@ public class RemoveTopicSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
|
||||
if (!(target instanceof TextChannel textChannel)) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.Channel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -32,7 +33,7 @@ public class SetTopicSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
Channel target = event.getOption("channel") == null ? channel : Objects.requireNonNull(event.getOption("channel")).getAsChannel();
|
||||
if (!(target instanceof TextChannel textChannel)) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -7,6 +7,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.Channel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -26,7 +27,7 @@ public class ViewTopicSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
Channel target = event.getOption("channel") == null ? channel : event.getOption("channel").getAsChannel();
|
||||
if (!(target instanceof TextChannel textChannel)) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.FeatureService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -30,7 +31,7 @@ public class DisableSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
FeatureProfile featureProfile = guild.getFeatureProfile();
|
||||
OptionMapping featureOption = event.getOption("feature");
|
||||
if (featureOption == null) {
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.FeatureService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -30,7 +31,7 @@ public class EnableSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
FeatureProfile featureProfile = guild.getFeatureProfile();
|
||||
OptionMapping featureOption = event.getOption("feature");
|
||||
if (featureOption == null) {
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.FeatureService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -21,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "list", description = "Lists the features and their states")
|
||||
public class ListSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
StringBuilder featureStates = new StringBuilder();
|
||||
for (Feature feature : FeatureService.INSTANCE.getFeaturesSorted()) {
|
||||
FeatureProfile featureProfile = guild.getFeatureProfile();
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -35,7 +36,7 @@ public class PastebinCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping textOption = event.getOption("text");
|
||||
assert textOption != null;
|
||||
String text = textOption.getAsString();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -33,7 +34,7 @@ public class UserSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping idOption = event.getOption("id");
|
||||
if (idOption == null) {
|
||||
return;
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||
@ -32,7 +33,7 @@ public class ChannelSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||
OptionMapping option = event.getOption("channel");
|
||||
if (option == null) {
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -30,7 +31,7 @@ public class MessageSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||
OptionMapping messageOption = event.getOption("message");
|
||||
assert messageOption != null;
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -30,7 +31,7 @@ public class PrivateSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||
OptionMapping enabledOption = event.getOption("enabled");
|
||||
assert enabledOption != null;
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "remove", description = "Remove your birthday from this guild")
|
||||
public class RemoveSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||
|
||||
profile.removeBirthday(user.getId());
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -36,7 +37,7 @@ public class SetSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||
if (!profile.hasChannelSetup()) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -34,7 +35,7 @@ public class ViewSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
BirthdayProfile profile = guild.getBirthdayProfile();
|
||||
if (!profile.hasChannelSetup()) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -32,7 +33,7 @@ public class RemoveSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
assert channelOption != null;
|
||||
GuildChannelUnion targetChannel = channelOption.getAsChannel();
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -32,7 +33,7 @@ public class SetBreakingSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
assert channelOption != null;
|
||||
OptionMapping breakableOption = event.getOption("breakable");
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -32,7 +33,7 @@ public class SetSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
assert channelOption != null;
|
||||
OptionMapping countOption = event.getOption("count");
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -31,7 +32,7 @@ public class SetupSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
assert channelOption != null;
|
||||
OptionMapping breakableOption = event.getOption("breakable");
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.GuildVoiceState;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -64,7 +65,7 @@ public class RequestSubCommand extends BatCommand implements EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
GuildVoiceState voiceState = member.getVoiceState();
|
||||
// Check if the user is in a voice channel
|
||||
if (voiceState == null || voiceState.getChannel() == null) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||
@ -35,7 +36,7 @@ public class ChannelSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
assert channelOption != null;
|
||||
|
||||
|
@ -13,6 +13,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -41,7 +42,7 @@ public class CurrentSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
|
||||
LevelingProfile profile = guild.getLevelingProfile();
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -35,7 +36,7 @@ public class ResetSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
assert userOption != null;
|
||||
|
||||
|
@ -6,7 +6,6 @@ import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.DescriptionBuilder;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.common.InteractionBuilder;
|
||||
import cc.fascinated.bat.common.StringUtils;
|
||||
import cc.fascinated.bat.event.EventListener;
|
||||
import cc.fascinated.bat.features.logging.LogCategory;
|
||||
import cc.fascinated.bat.features.logging.LogProfile;
|
||||
@ -15,18 +14,13 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import net.dv8tion.jda.api.interactions.components.ActionRow;
|
||||
import net.dv8tion.jda.api.interactions.components.selections.SelectOption;
|
||||
import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -36,7 +30,7 @@ import java.util.List;
|
||||
@CommandInfo(name = "list", description = "See all the log types and their channels")
|
||||
public class ListSubCommand extends BatCommand implements EventListener {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
LogProfile profile = guild.getLogProfile();
|
||||
|
||||
InteractionBuilder interactionBuilder = new InteractionBuilder();
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -32,7 +33,7 @@ public class RemoveSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping typeOption = event.getOption("type");
|
||||
assert typeOption != null;
|
||||
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -36,7 +37,7 @@ public class SetSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping typeOption = event.getOption("type");
|
||||
assert typeOption != null;
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "clear", description = "Clears the known sniped messages for this guild", requiredPermissions = Permission.MESSAGE_MANAGE)
|
||||
public class ClearSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
boolean cleared = MessageSnipeFeature.clearSnipedMessages(guild);
|
||||
if (!cleared) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
@ -23,7 +24,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "deleted", description = "Snipe the last deleted message in this channel")
|
||||
public class DeletedSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
SnipedMessage message = MessageSnipeFeature.getDeletedMessage(guild, channel.getId());
|
||||
if (message == null) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -34,7 +35,7 @@ public class LookupPlayerSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping playerOption = event.getOption("player");
|
||||
assert playerOption != null;
|
||||
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -38,7 +39,7 @@ public class LookupServerSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping platformOption = event.getOption("platform");
|
||||
assert platformOption != null;
|
||||
OptionMapping hostOption = event.getOption("host");
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||
@ -41,7 +42,7 @@ public class AddSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping platformOption = event.getOption("platform");
|
||||
assert platformOption != null;
|
||||
OptionMapping hostOption = event.getOption("host");
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -31,7 +32,7 @@ import java.util.Map;
|
||||
)
|
||||
public class ListSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
MinecraftProfile profile = guild.getMinecraftProfile();
|
||||
|
||||
Map<ServerPlatform, List<ServerWatcher>> watchers = new HashMap<>();
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -36,7 +37,7 @@ public class RemoveSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping platformOption = event.getOption("platform");
|
||||
assert platformOption != null;
|
||||
OptionMapping hostOption = event.getOption("host");
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -43,7 +44,7 @@ public class BanCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
OptionMapping lengthOption = event.getOption("length");
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -41,7 +42,7 @@ public class KickCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
assert event.getGuild() != null;
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -43,7 +44,7 @@ public class MuteCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
OptionMapping lengthOption = event.getOption("length");
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -44,7 +45,7 @@ public class PunishHistoryCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
assert memberOption != null;
|
||||
BatUser targetUser = userService.getUser(memberOption.getAsUser().getId());
|
||||
|
@ -42,7 +42,7 @@ public class PurgeCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping amountOption = event.getOption("amount");
|
||||
assert amountOption != null;
|
||||
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -42,7 +43,7 @@ public class UnbanCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
assert memberOption != null;
|
||||
|
@ -12,6 +12,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -42,7 +43,7 @@ public class UnmuteCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
assert memberOption != null;
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -41,7 +42,7 @@ public class WarnCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping memberOption = event.getOption("member");
|
||||
OptionMapping reasonOption = event.getOption("reason");
|
||||
assert memberOption != null;
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -33,7 +34,7 @@ public class GuildSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
|
||||
if (target == null) {
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -33,7 +34,7 @@ public class UserSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
BatUser target = userOption == null ? user : userService.getUser(userOption.getAsUser().getId());
|
||||
if (target == null) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "clear", description = "Clear all your active reminders.")
|
||||
public class ClearSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ReminderProfile profile = guild.getReminderProfile();
|
||||
if (!profile.hasReminders(user.getDiscordUser())) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -21,7 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "list", description = "View your active reminders.")
|
||||
public class ListSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ReminderProfile profile = guild.getReminderProfile();
|
||||
if (!profile.hasReminders(user.getDiscordUser())) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -35,7 +36,7 @@ public class SetSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ReminderProfile profile = guild.getReminderProfile();
|
||||
if (profile.getReminderCount(user.getDiscordUser()) >= ReminderFeature.MAX_REMINDERS) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||
@ -31,7 +32,7 @@ public class ChannelSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
|
||||
OptionMapping option = event.getOption("channel");
|
||||
if (option == null) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "reset", description = "Resets the settings")
|
||||
public class ResetSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
NumberOneScoreFeedProfile profile = guild.getProfile(NumberOneScoreFeedProfile.class);
|
||||
profile.reset();
|
||||
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberAccountToken
|
||||
import cc.fascinated.bat.service.ScoreSaberService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -32,7 +33,7 @@ public class LinkSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping linkOption = event.getOption("link");
|
||||
assert linkOption != null;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.ScoreSaberService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -26,7 +27,7 @@ public class MeSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ScoreSaberCommand.sendProfileEmbed(true, user, scoreSaberService, event);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "reset", description = "Reset your settings")
|
||||
public class ResetSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ScoreSaberProfile profile = user.getScoreSaberProfile();
|
||||
profile.reset();
|
||||
|
||||
|
@ -26,7 +26,8 @@ public class ScoreSaberCommand extends BatCommand {
|
||||
context.getBean(LinkSubCommand.class),
|
||||
context.getBean(UserSubCommand.class),
|
||||
context.getBean(MeSubCommand.class),
|
||||
context.getBean(ResetSubCommand.class)
|
||||
context.getBean(ResetSubCommand.class),
|
||||
context.getBean(ScoresSummarySubCommand.class)
|
||||
);
|
||||
}
|
||||
|
||||
|
122
src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoresSummarySubCommand.java
Normal file
122
src/main/java/cc/fascinated/bat/features/scoresaber/command/scoresaber/ScoresSummarySubCommand.java
Normal file
@ -0,0 +1,122 @@
|
||||
package cc.fascinated.bat.features.scoresaber.command.scoresaber;
|
||||
|
||||
import cc.fascinated.bat.command.BatCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.common.NumberFormatter;
|
||||
import cc.fascinated.bat.features.scoresaber.profile.user.ScoreSaberProfile;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberLeaderboardToken;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberPlayerScoreToken;
|
||||
import cc.fascinated.bat.model.token.beatsaber.scoresaber.ScoreSaberScoreToken;
|
||||
import cc.fascinated.bat.service.ScoreSaberService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import net.dv8tion.jda.api.utils.FileUpload;
|
||||
import net.steppschuh.markdowngenerator.table.Table;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@Component("scoresaber:scores-summary.sub")
|
||||
@CommandInfo(name = "scores-summary", description = "Generate a summary of your scores")
|
||||
public class ScoresSummarySubCommand extends BatCommand {
|
||||
private final ScoreSaberService scoreSaberService;
|
||||
|
||||
@Autowired
|
||||
public ScoresSummarySubCommand(@NonNull ScoreSaberService scoreSaberService) {
|
||||
this.scoreSaberService = scoreSaberService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
ScoreSaberProfile profile = user.getScoreSaberProfile();
|
||||
|
||||
event.replyEmbeds(EmbedUtils.genericEmbed()
|
||||
.setDescription("Loading profile for %s...".formatted(user.getDiscordUser().getAsMention()))
|
||||
.build())
|
||||
.queue(message -> {
|
||||
List<ScoreSaberService.CachedPage> pages = scoreSaberService.getScores(profile, (currentPage -> {
|
||||
// Only update every 5 pages, but show the first page
|
||||
if (currentPage.getCurrentPage() % 5 != 0 && currentPage.getCurrentPage() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
message.editOriginalEmbeds(EmbedUtils.genericEmbed()
|
||||
.setDescription("Loading profile for %s... (Page %s/%s)".formatted(
|
||||
user.getDiscordUser().getAsMention(),
|
||||
currentPage.getCurrentPage(),
|
||||
currentPage.getTotalPages()
|
||||
))
|
||||
.build()).queue();
|
||||
}));
|
||||
|
||||
Table.Builder tableBuilder = new Table.Builder()
|
||||
.withAlignments(Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT, Table.ALIGN_LEFT)
|
||||
.addRow("Song", "PP", "Accuracy", "Rank");
|
||||
|
||||
int totalRankedScores = 0;
|
||||
List<ScoreSaberPlayerScoreToken> scores = new ArrayList<>();
|
||||
for (ScoreSaberService.CachedPage page : pages) {
|
||||
Collections.addAll(scores, page.getPage().getPlayerScores());
|
||||
}
|
||||
|
||||
// Sort by highest PP first
|
||||
scores.sort((score1, score2) -> {
|
||||
if (score1.getScore().getPp() > score2.getScore().getPp()) {
|
||||
return -1;
|
||||
} else if (score1.getScore().getPp() < score2.getScore().getPp()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
// Add the scores to the table
|
||||
for (ScoreSaberPlayerScoreToken scoreToken : scores) {
|
||||
ScoreSaberScoreToken score = scoreToken.getScore();
|
||||
ScoreSaberLeaderboardToken leaderboard = scoreToken.getLeaderboard();
|
||||
double acc = leaderboard.getMaxScore() == 0 ? 0 : ((double) score.getBaseScore() / leaderboard.getMaxScore()) * 100;
|
||||
|
||||
tableBuilder.addRow(
|
||||
"[%s](https://scoresaber.com/leaderboard/%s)".formatted(
|
||||
leaderboard.getSongName(),
|
||||
leaderboard.getId()
|
||||
),
|
||||
NumberFormatter.simpleFormat(score.getPp()) + "pp",
|
||||
NumberFormatter.simpleFormat(acc) + "%",
|
||||
"#" + NumberFormatter.simpleFormat(score.getRank())
|
||||
);
|
||||
|
||||
if (score.getPp() != 0) {
|
||||
totalRankedScores++;
|
||||
}
|
||||
}
|
||||
|
||||
message.editOriginalEmbeds(EmbedUtils.genericEmbed()
|
||||
.setDescription("""
|
||||
**Scores Summary**
|
||||
Here is a summary of score for %s
|
||||
\s
|
||||
Total Scores: %s
|
||||
Total Ranked Scores: %s
|
||||
""".formatted(
|
||||
user.getDiscordUser().getAsMention(),
|
||||
NumberFormatter.simpleFormat(scores.size()),
|
||||
NumberFormatter.simpleFormat(totalRankedScores)
|
||||
))
|
||||
.build())
|
||||
.queue();
|
||||
channel.sendFiles(FileUpload.fromData(tableBuilder.build().toString().getBytes(), "scores-summary.txt")).queue();
|
||||
});
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.service.ScoreSaberService;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -34,7 +35,7 @@ public class UserSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping userOption = event.getOption("user");
|
||||
assert userOption != null;
|
||||
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||
@ -31,7 +32,7 @@ public class ChannelSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
|
||||
OptionMapping option = event.getOption("channel");
|
||||
if (option == null) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "reset", description = "Resets the settings")
|
||||
public class ResetSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
|
||||
profile.reset();
|
||||
event.replyEmbeds(EmbedUtils.successEmbed()
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.UserService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -34,7 +35,7 @@ public class UserSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
UserScoreFeedProfile profile = guild.getProfile(UserScoreFeedProfile.class);
|
||||
OptionMapping option = event.getOption("user");
|
||||
if (option == null) {
|
||||
|
@ -10,6 +10,7 @@ import cc.fascinated.bat.service.SpotifyService;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -30,7 +31,7 @@ public class CurrentSubCommand extends BatCommand implements EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
event.replyEmbeds(SpotifyFeature.currentSong(spotifyService, user).build()).queue();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.service.SpotifyService;
|
||||
import lombok.NonNull;
|
||||
import lombok.SneakyThrows;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
|
||||
@ -38,7 +39,7 @@ public class LinkSubCommand extends BatCommand implements EventListener {
|
||||
}
|
||||
|
||||
@Override @SneakyThrows
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
// if (!user.getId().equals(Consts.BOT_OWNER)) {
|
||||
// event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
// .setDescription("""
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.SpotifyService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -27,7 +28,7 @@ public class PauseSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
event.replyEmbeds(SpotifyFeature.pauseSong(spotifyService, user).build()).queue();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.SpotifyService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -27,7 +28,7 @@ public class ResumeSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
event.replyEmbeds(SpotifyFeature.resumeSong(spotifyService, user).build()).queue();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.service.SpotifyService;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.slf4j.Logger;
|
||||
@ -30,7 +31,7 @@ public class SkipSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
event.replyEmbeds(SpotifyFeature.skipSong(spotifyService, user).build()).queue();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import cc.fascinated.bat.service.SpotifyService;
|
||||
import lombok.NonNull;
|
||||
import lombok.SneakyThrows;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -32,7 +33,7 @@ public class UnlinkSubCommand extends BatCommand implements EventListener {
|
||||
}
|
||||
|
||||
@Override @SneakyThrows
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
SpotifyProfile profile = user.getProfile(SpotifyProfile.class);
|
||||
if (!profile.hasLinkedAccount() || !spotifyService.hasTrackPlaying(user)) {
|
||||
event.replyEmbeds(SpotifyFeature.checkSpotify(spotifyService, user).build()).queue();
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -34,7 +35,7 @@ public class AddSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping displayOption = event.getOption("display");
|
||||
assert displayOption != null;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
@ -28,7 +29,7 @@ import java.util.Map;
|
||||
)
|
||||
public class CurrentSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
StatsChannelProfile profile = guild.getStatsChannelProfile();
|
||||
DescriptionBuilder builder = new DescriptionBuilder("Stats Channels");
|
||||
if (profile.getChannels().isEmpty()) {
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@ -33,7 +34,7 @@ public class RemoveSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
assert channelOption != null;
|
||||
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
@ -27,7 +28,7 @@ public class ChannelSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
WelcomerProfile profile = guild.getWelcomerProfile();
|
||||
OptionMapping channelOption = event.getOption("channel");
|
||||
if (channelOption == null) {
|
||||
|
@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "current", description = "View the current welcomer configuration")
|
||||
public class CurrentSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
WelcomerProfile profile = guild.getWelcomerProfile();
|
||||
if (!profile.isEmbed() && !profile.isMessage()) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -34,7 +35,7 @@ public class EmbedSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
WelcomerProfile profile = guild.getWelcomerProfile();
|
||||
OptionMapping titleOption = event.getOption("title");
|
||||
OptionMapping descriptionOption = event.getOption("description");
|
||||
|
@ -11,6 +11,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||
@ -29,7 +30,7 @@ public class MessageSubCommand extends BatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
WelcomerProfile profile = guild.getWelcomerProfile();
|
||||
OptionMapping messageOption = event.getOption("message");
|
||||
if (messageOption == null) {
|
||||
|
@ -8,6 +8,7 @@ import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
@CommandInfo(name = "reset", description = "Clear the welcomer configuration")
|
||||
public class ResetSubCommand extends BatCommand {
|
||||
@Override
|
||||
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, Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
WelcomerProfile profile = guild.getWelcomerProfile();
|
||||
if (!profile.isEmbed() && !profile.isMessage()) {
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
|
@ -21,6 +21,7 @@ import com.mongodb.client.model.ReplaceOptions;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -35,8 +36,10 @@ import java.util.Map;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Log4j2
|
||||
public class BatGuild extends ProfileHolder {
|
||||
private static final Logger log = LoggerFactory.getLogger(BatGuild.class);
|
||||
private static final String DEFAULT_PREFIX = "!";
|
||||
|
||||
/**
|
||||
* The document that belongs to this guild
|
||||
*/
|
||||
@ -49,6 +52,11 @@ public class BatGuild extends ProfileHolder {
|
||||
@Id
|
||||
private final String id;
|
||||
|
||||
/**
|
||||
* The prefix of the guild
|
||||
*/
|
||||
private final String prefix;
|
||||
|
||||
/**
|
||||
* The time this guild was joined
|
||||
*/
|
||||
@ -63,6 +71,7 @@ public class BatGuild extends ProfileHolder {
|
||||
this.id = id;
|
||||
this.document = document;
|
||||
boolean newAccount = this.document.isEmpty();
|
||||
this.prefix = newAccount ? DEFAULT_PREFIX : (String) document.getOrDefault("prefix", DEFAULT_PREFIX);
|
||||
this.createdAt = newAccount ? new Date() : document.getDate("createdAt");
|
||||
|
||||
Guild guild = DiscordService.JDA.getGuildById(id);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user