This commit is contained in:
Lee
2024-12-27 13:48:53 +00:00
parent b3a6284e40
commit 9089767dc5
117 changed files with 1235 additions and 666 deletions

View File

@ -1,5 +1,5 @@
# Stage 1: Build the application
FROM maven:3.9.9-eclipse-temurin-17-alpine AS builder
FROM 3.9.9-eclipse-temurin-21-alpine AS builder
# Set the working directory
WORKDIR /home/container

50
pom.xml
View File

@ -16,57 +16,31 @@
<description>Bat Bot for Discord</description>
<properties>
<java.version>17</java.version>
<java.version>21</java.version>
</properties>
<!-- Build Config -->
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- Used for compiling the source code with the proper Java version -->
<!-- Spring -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- Enable incremental builds, this is reversed due to -->
<!-- a bug as seen in https://issues.apache.org/jira/browse/MCOMPILER-209 -->
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<!-- Handles shading of dependencies in the final output jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<id>build-info</id>
<goals>
<goal>shade</goal>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<description>${project.description}</description>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
<!-- Specify the apps main class -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>cc.fascinated.bat.BatApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.afk;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.afk.command.AfkCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
*/
@Component
public class AfkFeature extends Feature {
public AfkFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public AfkFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("AFK", FeatureProfile.FeatureState.DISABLED, true);
registerCommand(commandService, context.getBean(AfkCommand.class));

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.afk.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.MemberUtils;
import cc.fascinated.bat.afk.profile.AfkProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.autorole;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.autorole.command.AutoRoleCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
@Component
public class AutoRoleFeature extends Feature {
@Autowired
public AutoRoleFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public AutoRoleFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Auto Role", FeatureProfile.FeatureState.DISABLED, true);
registerCommand(commandService, context.getBean(AutoRoleCommand.class));

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.autorole.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.RoleUtils;
import cc.fascinated.bat.autorole.profile.AutoRoleProfile;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.autorole.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import org.springframework.context.ApplicationContext;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.autorole.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.autorole.profile.AutoRoleProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.autorole.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.autorole.profile.AutoRoleProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.autorole.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.autorole.profile.AutoRoleProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.autorole.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.autorole.profile.AutoRoleProfile;

View File

@ -16,7 +16,7 @@ import cc.fascinated.bat.base.commands.server.channel.ChannelCommand;
import cc.fascinated.bat.base.commands.server.feature.FeatureCommand;
import cc.fascinated.bat.base.commands.utility.PastebinCommand;
import cc.fascinated.bat.base.commands.utility.lookup.LookupCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -28,7 +28,7 @@ import org.springframework.stereotype.Component;
@Component
public class BaseFeature extends Feature {
@Autowired
public BaseFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public BaseFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Base", FeatureProfile.FeatureState.ENABLED, false);
super.registerCommand(commandService, context.getBean(PremiumCommand.class));
@ -38,7 +38,6 @@ public class BaseFeature extends Feature {
super.registerCommand(commandService, context.getBean(VoteCommand.class));
super.registerCommand(commandService, context.getBean(PingCommand.class));
super.registerCommand(commandService, context.getBean(InviteCommand.class));
super.registerCommand(commandService, context.getBean(HelpCommand.class));
super.registerCommand(commandService, context.getBean(BotStatsCommand.class));
super.registerCommand(commandService, context.getBean(BannerCommand.class));
super.registerCommand(commandService, context.getBean(AvatarCommand.class));

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.botadmin;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.base.commands.botadmin.premium.PremiumRemoveSubCommand;
import cc.fascinated.bat.base.commands.botadmin.premium.PremiumSetSubCommand;
import lombok.NonNull;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.botadmin.premium;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;
import cc.fascinated.bat.premium.PremiumProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.botadmin.premium;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;
import cc.fascinated.bat.premium.PremiumProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.fun;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;
import lombok.NonNull;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.fun;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.fun;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.MathUtils;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.fun.image;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.WebRequest;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.fun.image;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.WebRequest;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.fun.image;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.WebRequest;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.fun.image;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.WebRequest;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.fun.image;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.*;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,127 +0,0 @@
package cc.fascinated.bat.base.commands.general;
import cc.fascinated.bat.Consts;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.InteractionBuilder;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.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.List;
/**
* @author Fascinated (fascinated7)
*/
@Component
@CommandInfo(
name = "help",
description = "View the bots command categories",
userInstall = true,
category = Category.GENERAL
)
public class HelpCommand extends BatCommand implements EventListener {
private final CommandService commandService;
@Autowired
public HelpCommand(@NonNull CommandService commandService) {
this.commandService = commandService;
}
@Override
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);
interactionBuilder.addStringSelect("Home", "Return Home", Emojis.HOME_EMOJI, (buttonEvent) -> {
buttonEvent.editMessageEmbeds(createHomeEmbed(event.isFromGuild())).queue();
});
for (Category category : Category.getSortedByName()) {
List<BatCommand> categoryCommands = commandService.getCommandsByCategory(category, event.isFromGuild());
if (categoryCommands.isEmpty()) {
continue;
}
interactionBuilder.addStringSelect(
category.getName(),
"View commands in the %s category".formatted(category.getName()),
category.getEmoji(),
(buttonEvent) -> {
DescriptionBuilder description = new DescriptionBuilder(null);
description.appendLine("Commands in the **%s** Category".formatted(category.getName()), false);
description.emptyLine();
for (BatCommand command : categoryCommands) {
if (!command.getSubCommands().isEmpty()) {
for (BatCommand subCommand : command.getSubCommands().values()) {
description.appendLine("`%s %s` - %s".formatted(
command.getInfo().getName(),
subCommand.getInfo().getName(),
subCommand.getInfo().getDescription()
), true);
}
continue;
}
description.appendLine("`%s` - %s".formatted(
command.getInfo().getName(),
command.getInfo().getDescription()
), true);
}
buttonEvent.editMessageEmbeds(EmbedUtils.genericEmbed()
.setDescription(description.build())
.build()).queue();
});
}
event.replyEmbeds(createHomeEmbed(event.isFromGuild())).addComponents(interactionBuilder.build()).queue();
}
/**
* Creates the home embed for the help command
*
* @return The home embed
*/
private MessageEmbed createHomeEmbed(boolean ranInsideGuild) {
StringBuilder categories = new StringBuilder();
for (Category category : Category.values()) {
if (commandService.getCommandsByCategory(category, ranInsideGuild).isEmpty()) {
continue;
}
long commandCount = commandService.getCommandsByCategory(category, ranInsideGuild).size();
categories.append("➜ %s - **%s Command%s**\n".formatted(
category.getName(),
commandCount,
commandCount == 1 ? "" : "s"
));
}
return EmbedUtils.genericEmbed()
.setDescription("""
**Welcome to the Bat Help Menu!**%s
%s
*View our [TOS](%s) and [Privacy Policy](%s) for more information.*
""".formatted(
!ranInsideGuild ? "\n*guild only commands won't be shown here*" : "",
categories.toString(),
Consts.TERMS_OF_SERVICE_URL,
Consts.PRIVACY_POLICY_URL
))
.build();
}
}

View File

@ -1,9 +1,9 @@
package cc.fascinated.bat.base.commands.general;
import cc.fascinated.bat.Consts;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;
import cc.fascinated.bat.service.DiscordService;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general.avatar;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general.avatar;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general.avatar;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general.banner;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general.banner;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.general.banner;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.NumberFormatter;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.server.channel;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server.channel;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server.channel;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server.channel;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server.feature;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server.feature;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.server.feature;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.server.feature;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.utility;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.PasteUtils;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.base.commands.utility.lookup;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.base.commands.utility.lookup;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -6,7 +6,7 @@ import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.birthday.command.BirthdayCommand;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import cc.fascinated.bat.service.DiscordService;
import cc.fascinated.bat.service.GuildService;
import lombok.NonNull;
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
public class BirthdayFeature extends Feature implements EventListener {
private final GuildService guildService;
public BirthdayFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) {
public BirthdayFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService, @NonNull GuildService guildService) {
super("Birthday", FeatureProfile.FeatureState.DISABLED, true);
this.guildService = guildService;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.TextChannelUtils;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.birthday.UserBirthday;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.birthday.UserBirthday;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.birthday.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.birthday.UserBirthday;
import cc.fascinated.bat.birthday.profile.BirthdayProfile;

View File

@ -0,0 +1,44 @@
package cc.fascinated.bat.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
/**
* Emojis used by Rufus.
*
* @author Braydon
*/
@AllArgsConstructor @RequiredArgsConstructor @Getter
public enum BatEmoji {
RUFUS("rufus", "1319317309608689674"),
LOADING("loading", "1319483685787013212", true),
SUCCESS("success", "1319483459781132410"),
CROSS("cross", "1319483437928677446");
/**
* The name of this emoji.
*/
@NonNull private final String name;
/**
* The ID of this emoji.
*/
@NonNull private final String id;
/**
* Whether this emoji is animated.
*/
private boolean animated;
/**
* Get the formatted emoji.
*
* @return the formatted emoji
*/
@Override @NonNull
public String toString() {
return (animated ? "<a:" : "<:") + name + ":" + id + ">";
}
}

View File

@ -0,0 +1,294 @@
package cc.fascinated.bat.common;
import cc.fascinated.bat.Consts;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.interactions.InteractionHook;
import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback;
import net.dv8tion.jda.api.interactions.components.LayoutComponent;
import net.dv8tion.jda.api.requests.RestAction;
import net.dv8tion.jda.api.requests.restaction.WebhookMessageCreateAction;
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
import java.awt.*;
/**
* A simple utility class to make
* responding to interactions easier.
*
* @author Braydon
*/
@AllArgsConstructor
public final class InteractionResponder {
/**
* The interaction event to respond to.
*/
@NonNull private final IReplyCallback event;
/**
* Respond to the interaction with a generic embed.
*
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @return the reply action
*/
@NonNull
public RestAction<Message> replyGenericEmbed(@NonNull String content, Object... args) {
return replyGenericEmbed(content, args, (LayoutComponent[]) null);
}
/**
* Respond to the interaction with a generic embed.
*
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> replyGenericEmbed(@NonNull String content, Object[] args, LayoutComponent... components) {
return replyGenericEmbed(false, content, args, components);
}
/**
* Respond to the interaction with a generic embed.
*
* @param ephemeral whether the message should be ephemeral
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @return the reply action
*/
@NonNull
public RestAction<Message> replyGenericEmbed(boolean ephemeral, @NonNull String content, Object... args) {
return replyGenericEmbed(ephemeral, content, args, (LayoutComponent[]) null);
}
/**
* Respond to the interaction with a generic embed.
*
* @param ephemeral whether the message should be ephemeral
* @param content the content to respond with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> replyGenericEmbed(boolean ephemeral, @NonNull String content, LayoutComponent... components) {
return replyGenericEmbed(ephemeral, content, null, components);
}
/**
* Respond to the interaction with a generic embed.
*
* @param ephemeral whether the message should be ephemeral
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> replyGenericEmbed(boolean ephemeral, @NonNull String content, Object[] args, LayoutComponent... components) {
content = format(content, args);
return reply(ephemeral, buildGenericEmbed(content, args), components);
}
/**
* Build a generic embed.
*
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @return the embed
*/
@NonNull
public MessageEmbed buildGenericEmbed(@NonNull String content, Object... args) {
content = format(content, args);
return new EmbedBuilder()
.setColor(Colors.DEFAULT)
.setDescription(format(content, args))
.build();
}
/**
* Respond to the interaction with a success embed.
*
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @return the reply action
*/
@NonNull
public RestAction<Message> replySuccess(@NonNull String content, Object... args) {
return replySuccess(false, content, args);
}
/**
* Respond to the interaction with a success embed.
*
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> replySuccess(@NonNull String content, Object[] args, LayoutComponent... components) {
return replySuccess(false, content, args, components);
}
/**
* Respond to the interaction with a success embed.
*
* @param ephemeral whether the message should be ephemeral
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @return the reply action
*/
@NonNull
public RestAction<Message> replySuccess(boolean ephemeral, @NonNull String content, Object... args) {
return replySuccess(ephemeral, content, args, (LayoutComponent[]) null);
}
/**
* Respond to the interaction with a success embed.
*
* @param ephemeral whether the message should be ephemeral
* @param content the content to respond with
* @param args the optional arguments to format the content with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> replySuccess(boolean ephemeral, @NonNull String content, Object[] args, LayoutComponent... components) {
content = format(content, args);
return reply(ephemeral, new EmbedBuilder()
.setColor(Color.GREEN)
.setDescription(BatEmoji.SUCCESS + " " + content)
.build(), components);
}
/**
* Respond to the interaction with an error embed.
*
* @param error the error to respond with
* @param args the optional arguments to format the error with
* @return the reply action
*/
@NonNull
public RestAction<Message> replyError(@NonNull String error, Object... args) {
return replyError(false, error, args);
}
/**
* Respond to the interaction with an error embed.
*
* @param ephemeral whether the message should be ephemeral
* @param error the error to respond with
* @param args the optional arguments to format the error with
* @return the reply action
*/
@NonNull
public RestAction<Message> replyError(boolean ephemeral, @NonNull String error, Object... args) {
error = format(error, args);
return reply(ephemeral, new EmbedBuilder()
.setColor(Color.RED)
.setDescription(BatEmoji.CROSS + " " + error)
.build());
}
/**
* Respond to the interaction with an embed.
*
* @param embed the embed to respond with
* @return the reply action
*/
@NonNull
public RestAction<Message> reply(@NonNull MessageEmbed embed) {
return reply(false, embed);
}
/**
* Respond to the interaction with an embed.
*
* @param embed the embed to respond with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> reply(@NonNull MessageEmbed embed, LayoutComponent... components) {
return reply(false, embed, components);
}
/**
* Respond to the interaction with an embed.
*
* @param ephemeral whether the message should be ephemeral
* @param embed the embed to respond with
* @return the reply action
*/
@NonNull
public RestAction<Message> reply(boolean ephemeral, @NonNull MessageEmbed embed) {
return reply(ephemeral, embed, (LayoutComponent[]) null);
}
/**
* Respond to the interaction with an embed.
*
* @param ephemeral whether the message should be ephemeral
* @param embed the embed to respond with
* @param components the optional components to add to the message
* @return the reply action
*/
@NonNull
public RestAction<Message> reply(boolean ephemeral, @NonNull MessageEmbed embed, LayoutComponent... components) {
boolean hasComponents = components != null && (components.length > 0);
if (event.isAcknowledged()) {
WebhookMessageCreateAction<Message> action = event.getHook()
.setEphemeral(ephemeral)
.sendMessageEmbeds(embed);
return hasComponents ? action.setComponents(components) : action;
}
ReplyCallbackAction action = event.replyEmbeds(embed).setEphemeral(ephemeral);
return (hasComponents ? action.setComponents(components) : action).flatMap(InteractionHook::retrieveOriginal);
}
/**
* Respond to the interaction with a message.
*
* @param content the message to respond with
* @param args the optional arguments to format the message with
* @return the reply action
*/
@NonNull
public RestAction<Message> reply(@NonNull String content, Object... args) {
return reply(false, content, args);
}
/**
* Respond to the interaction with a message.
*
* @param ephemeral whether the message should be ephemeral
* @param content the message to respond with
* @param args the optional arguments to format the message with
* @return the reply action
*/
@NonNull
public RestAction<Message> reply(boolean ephemeral, @NonNull String content, Object... args) {
content = format(content, args);
if (event.isAcknowledged()) {
return event.getHook().setEphemeral(ephemeral).sendMessage(content);
}
return event.reply(content).setEphemeral(ephemeral).flatMap(InteractionHook::retrieveOriginal);
}
/**
* Format the given content with the given arguments.
*
* @param content the content to format
* @param args the arguments to format with
* @return the formatted content
*/
@NonNull
private String format(@NonNull String content, Object... args) {
return args != null && (args.length > 0) ? content.formatted(args) : content;
}
}

View File

@ -0,0 +1,96 @@
package cc.fascinated.bat.common;
import lombok.NonNull;
import lombok.experimental.UtilityClass;
import net.dv8tion.jda.api.JDA;
import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;
@UtilityClass
public final class MiscUtils {
/**
* Get the invite url for the bot.
*
* @param jda the JDA instance
* @return the invite url
*/
@NonNull
public static String getInviteUrl(@NonNull JDA jda) {
return "https://discord.com/oauth2/authorize?client_id=" + jda.getSelfUser().getId();
}
/**
* Convert an array of strings to a single string.
*
* @param lines the lines to convert
* @return the string
*/
@NonNull
public static String arrayToString(String... lines) {
return Arrays.stream(lines)
.filter(Objects::nonNull)
.collect(Collectors.joining("\n"));
}
/**
* Capitalize the first letter of
* every word in the given string.
*
* @param input the input to capitalize
* @return the capitalized string
*/
@NonNull
public static String capitalize(@NonNull String input) {
input = input.toLowerCase().replace('_', ' ');
StringBuilder result = new StringBuilder();
boolean capitalizeNext = true;
for (char character : input.toCharArray()) {
if (Character.isSpaceChar(character)) {
capitalizeNext = true;
result.append(character);
} else if (capitalizeNext) {
result.append(Character.toUpperCase(character));
capitalizeNext = false;
} else {
result.append(character);
}
}
return result.toString();
}
/**
* Get the enum constant with the given
* name from the given enum class.
*
* @param enumClass the enum class
* @param enumName the enum name
* @param <T> the enum type
* @return the enum constant, null if not found
*/
public static <T extends Enum<T>> T getEnum(@NonNull Class<T> enumClass, String enumName) {
return getEnum(enumClass, enumName, null);
}
/**
* Get the enum constant with the given
* name from the given enum class.
*
* @param enumClass the enum class
* @param enumName the enum name
* @param defaultValue the default value
* @param <T> the enum type
* @return the enum constant, default value if not found
*/
public static <T extends Enum<T>> T getEnum(@NonNull Class<T> enumClass, String enumName, T defaultValue) {
if (enumName == null) {
return defaultValue;
}
try {
return Enum.valueOf(enumClass, enumName);
} catch (IllegalArgumentException ex) {
return defaultValue;
}
}
}

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.common.feature;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.service.OldCommandService;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
@ -35,7 +35,7 @@ public abstract class Feature {
* @param commandService The command service
* @param command The command to register
*/
public void registerCommand(@NonNull CommandService commandService, @NonNull BatCommand command) {
public void registerCommand(@NonNull OldCommandService commandService, @NonNull BatCommand command) {
command.setFeature(this);
for (BatCommand subCommand : command.getSubCommands().values()) {
subCommand.setFeature(this);

View File

@ -1,4 +1,4 @@
package cc.fascinated.bat.common.command;
package cc.fascinated.bat.common.oldcommand;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,4 +1,4 @@
package cc.fascinated.bat.common.command;
package cc.fascinated.bat.common.oldcommand;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@ -1,4 +1,4 @@
package cc.fascinated.bat.common.command;
package cc.fascinated.bat.common.oldcommand;
import net.dv8tion.jda.api.Permission;

View File

@ -1,4 +1,4 @@
package cc.fascinated.bat.common.command;
package cc.fascinated.bat.common.oldcommand;
import lombok.AccessLevel;
import lombok.Getter;

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.counter;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.counter.command.CounterCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
@Component
public class CounterFeature extends Feature {
@Autowired
public CounterFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public CounterFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Counter", FeatureProfile.FeatureState.DISABLED, true);
super.registerCommand(commandService, context.getBean(CounterCommand.class));

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.counter.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.counter.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.NumberFormatter;
import cc.fascinated.bat.counter.CounterChannel;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.counter.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.counter.CounterChannel;
import cc.fascinated.bat.counter.CounterProfile;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.counter.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.counter.CounterChannel;
import cc.fascinated.bat.counter.CounterProfile;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.counter.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.counter.CounterProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.leveling;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.leveling.command.LevelingCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -23,7 +23,7 @@ public class LevelingFeature extends Feature {
public static final Map<Integer, Double> xpRequiredCache = new HashMap<>();
@Autowired
public LevelingFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public LevelingFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Leveling", FeatureProfile.FeatureState.DISABLED, true);
super.registerCommand(commandService, context.getBean(LevelingCommand.class));

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.leveling.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.leveling.LevelingProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.leveling.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.NumberFormatter;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.leveling.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.leveling.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.leveling.LevelingProfile;
import cc.fascinated.bat.leveling.UserLevel;

View File

@ -7,7 +7,7 @@ import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.logging.command.LogsCommand;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.DiscordMessage;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
@ -27,7 +27,7 @@ public class LogFeature extends Feature {
public static LogFeature INSTANCE;
@Autowired
public LogFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public LogFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Logging", FeatureProfile.FeatureState.DISABLED, true);
INSTANCE = this;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.logging.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.InteractionBuilder;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.logging.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import net.dv8tion.jda.api.Permission;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.logging.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.logging.LogCategory;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.logging.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.logging.LogCategory;

View File

@ -7,7 +7,7 @@ import cc.fascinated.bat.messagesnipe.command.MessageSnipeCommand;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;
import cc.fascinated.bat.common.model.DiscordMessage;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import net.dv8tion.jda.api.events.message.MessageDeleteEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@ -31,7 +31,7 @@ public class MessageSnipeFeature extends Feature implements EventListener {
private static final long SNIPED_MESSAGE_EXPIRATION = TimeUnit.HOURS.toMillis(1);
@Autowired
public MessageSnipeFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public MessageSnipeFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Message Snipe", FeatureProfile.FeatureState.DISABLED, true);
super.registerCommand(commandService, context.getBean(MessageSnipeCommand.class));

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.messagesnipe.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.messagesnipe.MessageSnipeFeature;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.messagesnipe.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.PasteUtils;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.messagesnipe.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

View File

@ -8,7 +8,7 @@ import cc.fascinated.bat.moderation.punish.Punishment;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.common.model.BatUser;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import cc.fascinated.bat.service.DiscordService;
import cc.fascinated.bat.service.GuildService;
import cc.fascinated.bat.service.UserService;
@ -37,7 +37,7 @@ public class ModerationFeature extends Feature implements EventListener {
private final UserService userService;
@Autowired
public ModerationFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService,
public ModerationFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService, @NonNull GuildService guildService,
@NonNull UserService userService) {
super("Moderation", FeatureProfile.FeatureState.DISABLED, true);
this.guildService = guildService;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.TimeUtils;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;
import cc.fascinated.bat.moderation.punish.PunishmentType;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.TimeUtils;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.moderation.punish.Punishment;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.NumberFormatter;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.moderation.punish.Punishment;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.moderation.punish.Punishment;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.moderation.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.moderation.punish.PunishmentProfile;
import cc.fascinated.bat.moderation.punish.PunishmentType;

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.namehistory;
import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.namehistory.command.NameHistoryCommand;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -17,7 +17,7 @@ public class NameHistoryFeature extends Feature {
public static final int NAME_HISTORY_SIZE = 25;
@Autowired
public NameHistoryFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
public NameHistoryFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService) {
super("Name History", FeatureProfile.FeatureState.DISABLED, true);
super.registerCommand(commandService, context.getBean(NameHistoryCommand.class));

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.namehistory.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.namehistory.TrackedName;
import cc.fascinated.bat.namehistory.profile.guild.NameHistoryProfile;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.namehistory.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.namehistory.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.namehistory.TrackedName;
import cc.fascinated.bat.namehistory.profile.user.NameHistoryProfile;

View File

@ -4,7 +4,7 @@ import cc.fascinated.bat.common.feature.Feature;
import cc.fascinated.bat.common.feature.FeatureProfile;
import cc.fascinated.bat.reminder.command.ReminderCommand;
import cc.fascinated.bat.common.model.BatGuild;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.OldCommandService;
import cc.fascinated.bat.service.DiscordService;
import cc.fascinated.bat.service.GuildService;
import lombok.NonNull;
@ -36,7 +36,7 @@ public class ReminderFeature extends Feature {
private final GuildService guildService;
@Autowired
public ReminderFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) {
public ReminderFeature(@NonNull ApplicationContext context, @NonNull OldCommandService commandService, @NonNull GuildService guildService) {
super("Reminder", FeatureProfile.FeatureState.DISABLED, true);
this.guildService = guildService;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.reminder.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.reminder.ReminderProfile;
import cc.fascinated.bat.common.model.BatGuild;

View File

@ -1,7 +1,7 @@
package cc.fascinated.bat.reminder.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.reminder.Reminder;

View File

@ -1,8 +1,8 @@
package cc.fascinated.bat.reminder.command;
import cc.fascinated.bat.common.command.BatCommand;
import cc.fascinated.bat.common.command.Category;
import cc.fascinated.bat.common.command.CommandInfo;
import cc.fascinated.bat.common.oldcommand.BatCommand;
import cc.fascinated.bat.common.oldcommand.Category;
import cc.fascinated.bat.common.oldcommand.CommandInfo;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;

Some files were not shown because too many files have changed in this diff Show More