diff --git a/pom.xml b/pom.xml index 2a6c854..19bd24b 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ cc.fascinated Bat - 0.1 + 0.0.1-SNAPSHOT Bat Bat Bot for Discord @@ -67,37 +67,6 @@ - - - - pl.project13.maven - git-commit-id-plugin - 4.9.10 - - - - revision - - - - - git - $PROJECT.BASEDIR$/.git - true - true - src/main/resources/git.properties - full - $USER.TIMEZONE$ - MM-dd-yyyy@HH:mm:ss - - ^git.branch$ - ^git.build.(time|version)$ - ^git.commit.id.(abbrev|full)$ - ^git.build.user.name$ - - - - diff --git a/src/main/java/cc/fascinated/bat/BatApplication.java b/src/main/java/cc/fascinated/bat/BatApplication.java index 17c1220..da73e4c 100644 --- a/src/main/java/cc/fascinated/bat/BatApplication.java +++ b/src/main/java/cc/fascinated/bat/BatApplication.java @@ -1,6 +1,5 @@ package cc.fascinated.bat; -import cc.fascinated.bat.common.BuildData; import cc.fascinated.bat.config.Config; import cc.fascinated.bat.event.EventListener; import cc.fascinated.bat.service.EventService; @@ -26,7 +25,6 @@ import java.util.Objects; @Log4j2(topic = "Bat") public class BatApplication { public static Gson GSON = new GsonBuilder().create(); - public static BuildData BUILD_DATA = new BuildData(); @SneakyThrows public static void main(@NonNull String[] args) { diff --git a/src/main/java/cc/fascinated/bat/common/BuildData.java b/src/main/java/cc/fascinated/bat/common/BuildData.java deleted file mode 100644 index 4b2cbfc..0000000 --- a/src/main/java/cc/fascinated/bat/common/BuildData.java +++ /dev/null @@ -1,52 +0,0 @@ -package cc.fascinated.bat.common; - -import lombok.Getter; -import lombok.extern.log4j.Log4j2; - -import java.io.IOException; -import java.util.Properties; - -/** - * @author Fascinated (fascinated7) - */ -@Getter -@Log4j2(topic = "Build Data") -public class BuildData { - /** - * The commit hash of the build - */ - private final String buildId; - - /** - * The version of the build - */ - private final String buildVersion; - - /** - * The date of the build - */ - private final String buildDate; - - public BuildData() { - // get git.properties from resources - Properties properties = new Properties(); - try { - properties.load(getClass().getClassLoader().getResourceAsStream("git.properties")); - } catch (IOException ex) { - log.error("Failed to load git.properties", ex); - } - - this.buildId = properties.getProperty("git.commit.id.abbrev"); - this.buildVersion = properties.getProperty("git.build.version"); - this.buildDate = properties.getProperty("git.build.time"); - } - - /** - * Gets the version of the bot - * - * @return the version - */ - public String getVersion() { - return "Bat - v%s-%s".formatted(buildVersion, buildId); - } -} diff --git a/src/main/java/cc/fascinated/bat/common/EmbedUtils.java b/src/main/java/cc/fascinated/bat/common/EmbedUtils.java index b611747..09b5bfa 100644 --- a/src/main/java/cc/fascinated/bat/common/EmbedUtils.java +++ b/src/main/java/cc/fascinated/bat/common/EmbedUtils.java @@ -1,6 +1,5 @@ package cc.fascinated.bat.common; -import cc.fascinated.bat.BatApplication; import cc.fascinated.bat.config.Config; import lombok.experimental.UtilityClass; import net.dv8tion.jda.api.EmbedBuilder; @@ -21,7 +20,6 @@ public class EmbedUtils { public static EmbedBuilder genericEmbed() { return new EmbedBuilder() .setTimestamp(LocalDateTime.now()) - .setFooter(BatApplication.BUILD_DATA.getVersion()) .setColor(Colors.DEFAULT); } @@ -33,7 +31,6 @@ public class EmbedUtils { public static EmbedBuilder errorEmbed() { return new EmbedBuilder() .setTimestamp(LocalDateTime.now()) - .setFooter(BatApplication.BUILD_DATA.getVersion()) .setColor(Colors.ERROR); } @@ -45,7 +42,6 @@ public class EmbedUtils { public static EmbedBuilder successEmbed() { return new EmbedBuilder() .setTimestamp(LocalDateTime.now()) - .setFooter(BatApplication.BUILD_DATA.getVersion()) .setColor(Colors.SUCCESS); } diff --git a/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java b/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java index 7a80195..fbf2c76 100644 --- a/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java +++ b/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java @@ -27,7 +27,7 @@ public class MessageSnipeFeature extends Feature implements EventListener { /** * The sniped messages for each guild */ - private static final Map> SNIPED_MESSAGES = new HashMap<>(); + private static final Map> snipedMessages = new HashMap<>(); private static final long SNIPED_MESSAGE_EXPIRATION = TimeUnit.HOURS.toMillis(1); @Autowired @@ -44,8 +44,8 @@ public class MessageSnipeFeature extends Feature implements EventListener { * @return if the sniped messages were cleared */ public static boolean clearSnipedMessages(BatGuild guild) { - if (SNIPED_MESSAGES.containsKey(guild)) { - SNIPED_MESSAGES.remove(guild); + if (snipedMessages.containsKey(guild)) { + snipedMessages.remove(guild); return true; } return false; @@ -58,7 +58,7 @@ public class MessageSnipeFeature extends Feature implements EventListener { * @return the sniped messages for the given guild */ public static SnipedMessage getDeletedMessage(BatGuild guild, String channelId) { - List messages = SNIPED_MESSAGES.getOrDefault(guild, new ArrayList<>()).stream() + List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()).stream() .filter(message -> message.getDeletedDate() != null && message.getDeletedDate().getTime() + SNIPED_MESSAGE_EXPIRATION > System.currentTimeMillis()) .sorted(Comparator.comparing(SnipedMessage::getDeletedDate).reversed()).toList(); @@ -79,7 +79,7 @@ public class MessageSnipeFeature extends Feature implements EventListener { * @return the sniped message with the given id */ private SnipedMessage getSnipedMessage(BatGuild guild, String messageId) { - List messages = SNIPED_MESSAGES.getOrDefault(guild, new ArrayList<>()); + List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); for (SnipedMessage message : messages) { if (message.getMessage().getId().equals(messageId)) { return message; @@ -94,12 +94,12 @@ public class MessageSnipeFeature extends Feature implements EventListener { return; } - List messages = SNIPED_MESSAGES.getOrDefault(guild, new ArrayList<>()); + List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); if (messages.size() >= 10) { // Only store the last 10 messages messages.remove(0); } messages.add(new SnipedMessage(event.getMessage(), null)); - SNIPED_MESSAGES.put(guild, messages); + snipedMessages.put(guild, messages); } @Override @@ -107,7 +107,7 @@ public class MessageSnipeFeature extends Feature implements EventListener { if (guild.getFeatureProfile().isFeatureDisabled(this)) { return; } - List messages = SNIPED_MESSAGES.getOrDefault(guild, new ArrayList<>()); + List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); if (messages.size() >= 10) { messages.remove(0); } @@ -124,7 +124,7 @@ public class MessageSnipeFeature extends Feature implements EventListener { if (guild.getFeatureProfile().isFeatureDisabled(this)) { return; } - List messages = SNIPED_MESSAGES.getOrDefault(guild, new ArrayList<>()); + List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); if (messages.size() >= 10) { messages.remove(0); }