Skip to content

Commit

Permalink
Send a one-time prompt about slash commands when using legacy commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Vauff committed Aug 26, 2022
1 parent ea2a886 commit 2bde36d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@
<version>4.7.1</version>
</dependency>
</dependencies>
<version>r48</version>
<version>r49</version>
</project>
2 changes: 1 addition & 1 deletion src/com/vauff/maunzdiscord/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
13 changes: 13 additions & 0 deletions src/com/vauff/maunzdiscord/threads/MessageCreateThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Snowflake> slashCmdNotifiedUsers = new ArrayList();

public MessageCreateThread(MessageCreateEvent passedEvent, String passedName)
{
name = passedName;
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 2bde36d

Please sign in to comment.