Skip to content

Commit 19b7d5d

Browse files
Added an 'Author Embed' to /help-ping
1 parent 0a10bee commit 19b7d5d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/main/java/net/javadiscord/javabot/systems/help/commands/HelpPingCommand.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package net.javadiscord.javabot.systems.help.commands;
22

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.*;
55
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
66
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction;
77
import net.javadiscord.javabot.Bot;
@@ -52,11 +52,19 @@ public ReplyCallbackAction handleSlashCommandInteraction(SlashCommandInteraction
5252
return Responses.warning(event, "Sorry, but you can only use this command occasionally. Please try again later.");
5353
}
5454
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);
55+
Role role = channelManager.getConfig().getHelpPingRole();
56+
event.getChannel().sendMessage(role.getAsMention())
57+
.setEmbeds(this.buildAuthorEmbed(event.getUser()))
58+
.queue();
59+
return event.replyFormat("Successfully pinged " + role.getAsMention()).setEphemeral(true);
5860
} else {
5961
return Responses.warning(event, WRONG_CHANNEL_MSG);
6062
}
6163
}
64+
65+
private MessageEmbed buildAuthorEmbed(User author) {
66+
return new EmbedBuilder()
67+
.setTitle("Requested by " + author.getAsTag())
68+
.build();
69+
}
6270
}

0 commit comments

Comments
 (0)