From a8d720eeb511fdfe165c454f54deaf5f847a17cd Mon Sep 17 00:00:00 2001 From: duncte123 Date: Mon, 11 Mar 2024 07:51:46 +0100 Subject: [PATCH] Remove nonce supplyer --- build.gradle.kts | 6 ++--- .../botcommons/messaging/MessageConfig.java | 27 +++---------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 37178e8..cf1c842 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ plugins { } group = "me.duncte123" -version = "${getVersionPrefix()}3.0.${getBuildNum()}" +version = "${getVersionPrefix()}3.1.${getBuildNum()}" val archivesBaseName = "botCommons" repositories { @@ -36,10 +36,10 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 } -val jdaVersion = "5.0.0-beta.13" +val jdaVersion = "5.0.0-beta.21" dependencies { - api(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.13.2.2") + api(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.16.1") api(group = "org.jsoup", name = "jsoup", version = "1.15.3") api(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.3") api(group = "me.duncte123", name = "reliqua", version = "2.6.5") { diff --git a/src/main/java/me/duncte123/botcommons/messaging/MessageConfig.java b/src/main/java/me/duncte123/botcommons/messaging/MessageConfig.java index 71242aa..e353b2a 100644 --- a/src/main/java/me/duncte123/botcommons/messaging/MessageConfig.java +++ b/src/main/java/me/duncte123/botcommons/messaging/MessageConfig.java @@ -19,7 +19,9 @@ import me.duncte123.botcommons.StringUtils; import me.duncte123.botcommons.commands.ICommandContext; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.*; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.entities.MessageType; import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel; import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion; @@ -37,12 +39,9 @@ import java.util.Collection; import java.util.List; import java.util.function.Consumer; -import java.util.function.Function; import java.util.stream.Collectors; public class MessageConfig { - private static Function nonceSupplier = (c) -> c.getId() + System.currentTimeMillis(); - private final MessageChannel channel; private final MessageCreateBuilder messageBuilder; private final List embeds; @@ -168,20 +167,6 @@ public Consumer getActionConfig() { return this.actionConfig; } - /** - * Sets the supplier for the nonce.
- * A nonce can be used to verify if the message you recieve is the message you want - * - * @param nonceSupplier - * A function that returns the nonce, by default this is the {@link MessageChannel#getId() channel id} combined - * with the {@link System#currentTimeMillis() current time in milliseconds} - */ - public static void setNonceSupplier(Function nonceSupplier) { - Checks.notNull(nonceSupplier, "nonceSupplier"); - - MessageConfig.nonceSupplier = nonceSupplier; - } - /** * Builder class for the message config */ @@ -656,11 +641,7 @@ public MessageConfig build() { this.mentionRepliedUser, this.failureAction, this.successAction, - (config) -> { - // Set the nonce for the message - config.setNonce(nonceSupplier.apply(this.channel)); - this.actionConfig.accept(config); - } + this.actionConfig ); }