From 2bde36d7ca04553583ccdf5408dbc0486bd56daf Mon Sep 17 00:00:00 2001 From: Vauff Date: Fri, 26 Aug 2022 00:35:21 -0400 Subject: [PATCH] Send a one-time prompt about slash commands when using legacy commands --- pom.xml | 2 +- src/com/vauff/maunzdiscord/core/Main.java | 2 +- .../maunzdiscord/threads/MessageCreateThread.java | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5d872373..39ad4dd8 100644 --- a/pom.xml +++ b/pom.xml @@ -67,5 +67,5 @@ 4.7.1 - r48 + r49 \ No newline at end of file diff --git a/src/com/vauff/maunzdiscord/core/Main.java b/src/com/vauff/maunzdiscord/core/Main.java index cc94203a..e9837198 100644 --- a/src/com/vauff/maunzdiscord/core/Main.java +++ b/src/com/vauff/maunzdiscord/core/Main.java @@ -38,7 +38,7 @@ public class Main { public static GatewayDiscordClient gateway; public static MongoDatabase mongoDatabase; - public static String version = "r48"; + public static String version = "r49"; public static Config cfg; /** diff --git a/src/com/vauff/maunzdiscord/threads/MessageCreateThread.java b/src/com/vauff/maunzdiscord/threads/MessageCreateThread.java index 3357f2ad..6005ee24 100644 --- a/src/com/vauff/maunzdiscord/threads/MessageCreateThread.java +++ b/src/com/vauff/maunzdiscord/threads/MessageCreateThread.java @@ -6,11 +6,14 @@ import com.vauff.maunzdiscord.core.Main; import com.vauff.maunzdiscord.core.MainListener; import com.vauff.maunzdiscord.core.Util; +import discord4j.common.util.Snowflake; import discord4j.core.event.domain.message.MessageCreateEvent; import discord4j.core.object.entity.User; import discord4j.core.object.entity.channel.MessageChannel; import discord4j.rest.http.client.ClientException; +import java.util.ArrayList; +import java.util.List; import java.util.Random; public class MessageCreateThread implements Runnable @@ -19,6 +22,10 @@ public class MessageCreateThread implements Runnable private Thread thread; private String name; + // These users have already been notified of the upcoming slash command migration + // There's a week left so I'm not bothering to store this in the database, sue me + private static List slashCmdNotifiedUsers = new ArrayList(); + public MessageCreateThread(MessageCreateEvent passedEvent, String passedName) { name = passedName; @@ -92,6 +99,12 @@ public void run() } cmd.exe(event, channel, author); + + if (!slashCmdNotifiedUsers.contains(author.getId())) + { + Util.msg(channel, false, true, "Hey " + author.getMention() + "!" + System.lineSeparator() + System.lineSeparator() + "In case you were unaware, Discord will be enforcing slash command usage starting from **September 1st**. This means from that date onwards prefixing Maunz commands with ***** will stop working, and you will have to use the **/** prefix for all commands instead." + System.lineSeparator() + System.lineSeparator() + "While not every command is ready just yet (including the one you just ran), you can type **/** into your chat window right now, and see all the commands that have already been moved into this system.", null); + slashCmdNotifiedUsers.add(author.getId()); + } } catch (ClientException e) {