Skip to content

Commit 60644f6

Browse files
committed
add timestamp to acknowledging help notifications
1 parent f868f2a commit 60644f6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
1515
import net.dv8tion.jda.api.interactions.components.buttons.Button;
1616
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle;
17+
import net.dv8tion.jda.api.utils.TimeFormat;
1718
import net.javadiscord.javabot.annotations.AutoDetectableComponentHandler;
1819
import net.javadiscord.javabot.data.config.BotConfig;
1920
import net.javadiscord.javabot.data.config.GuildConfig;
@@ -26,6 +27,7 @@
2627
import xyz.dynxsty.dih4jda.util.ComponentIdBuilder;
2728

2829
import java.awt.Color;
30+
import java.time.Instant;
2931
import java.time.OffsetDateTime;
3032
import java.util.List;
3133
import java.util.Map;
@@ -214,14 +216,18 @@ private void acknowledgeChangeAction(ButtonInteractionEvent event, boolean ackno
214216
.stream()
215217
.map(e->new EmbedBuilder(e)
216218
.setColor(acknowledged ? Color.GRAY : Color.YELLOW)
217-
.addField("marked as " + (acknowledged?"acknowledged":"needs help") + " by",
218-
event.getUser().getAsMention(), false))
219+
.addField("marked as " + (acknowledged?"acknowledged":"needs help"),
220+
"by " + event.getUser().getAsMention()+" at "+getCurrentFormattedTimestamp(), false))
219221
.map(this::removeOldField)
220222
.map(EmbedBuilder::build)
221223
.toList())
222224
.setActionRow(acknowledged?createUndoAcknowledgementButton():createAcknowledgementButton())
223225
.queue();
224226
}
227+
228+
private String getCurrentFormattedTimestamp() {
229+
return TimeFormat.DATE_TIME_SHORT.format(Instant.now().toEpochMilli());
230+
}
225231

226232
private String getForumTagText(ForumTag tag) {
227233
EmojiUnion emoji = tag.getEmoji();

0 commit comments

Comments
 (0)