|
1 | 1 | package net.javadiscord.javabot.systems.help.commands; |
2 | 2 |
|
3 | | -import net.dv8tion.jda.api.entities.Guild; |
4 | | -import net.dv8tion.jda.api.entities.Member; |
| 3 | +import net.dv8tion.jda.api.EmbedBuilder; |
| 4 | +import net.dv8tion.jda.api.entities.*; |
5 | 5 | import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; |
6 | 6 | import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction; |
7 | 7 | import net.javadiscord.javabot.Bot; |
|
10 | 10 | import net.javadiscord.javabot.command.interfaces.SlashCommand; |
11 | 11 | import net.javadiscord.javabot.systems.help.HelpChannelManager; |
12 | 12 |
|
| 13 | +import java.util.EnumSet; |
13 | 14 | import java.util.Map; |
14 | 15 | import java.util.concurrent.ConcurrentHashMap; |
15 | 16 | import java.util.concurrent.TimeUnit; |
@@ -52,11 +53,20 @@ public ReplyCallbackAction handleSlashCommandInteraction(SlashCommandInteraction |
52 | 53 | return Responses.warning(event, "Sorry, but you can only use this command occasionally. Please try again later."); |
53 | 54 | } |
54 | 55 | lastPingTimes.put(event.getMember(), System.currentTimeMillis()); |
55 | | - var role = channelManager.getConfig().getHelpPingRole(); |
56 | | - event.getChannel().sendMessage(role.getAsMention()).queue(); |
57 | | - return event.replyFormat("Done!").setEphemeral(true); |
| 56 | + Role role = channelManager.getConfig().getHelpPingRole(); |
| 57 | + event.getChannel().sendMessage(role.getAsMention()) |
| 58 | + .allowedMentions(EnumSet.of(Message.MentionType.ROLE)) |
| 59 | + .setEmbeds(this.buildAuthorEmbed(event.getUser())) |
| 60 | + .queue(); |
| 61 | + return event.replyFormat("Successfully pinged " + role.getAsMention()).setEphemeral(true); |
58 | 62 | } else { |
59 | 63 | return Responses.warning(event, WRONG_CHANNEL_MSG); |
60 | 64 | } |
61 | 65 | } |
| 66 | + |
| 67 | + private MessageEmbed buildAuthorEmbed(User author) { |
| 68 | + return new EmbedBuilder() |
| 69 | + .setTitle("Requested by " + author.getAsTag()) |
| 70 | + .build(); |
| 71 | + } |
62 | 72 | } |
0 commit comments