Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package net.javadiscord.javabot.listener;

import lombok.RequiredArgsConstructor;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Webhook;
import net.dv8tion.jda.api.entities.channel.ChannelType;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildChannel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
import net.dv8tion.jda.api.interactions.components.buttons.Button;
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle;
import net.dv8tion.jda.api.utils.TimeFormat;
import net.javadiscord.javabot.annotations.AutoDetectableComponentHandler;
import net.javadiscord.javabot.data.config.BotConfig;
import net.javadiscord.javabot.data.config.GuildConfig;
Expand All @@ -26,6 +27,7 @@
import xyz.dynxsty.dih4jda.util.ComponentIdBuilder;

import java.awt.Color;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -53,7 +55,7 @@ public class HelpPingSubcommand extends SlashCommand.Subcommand implements Butto
* @param botConfig The main configuration of the bot
*/
public HelpPingSubcommand(BotConfig botConfig, ScheduledExecutorService asyncPool) {
setCommandData(new SubcommandData("ping", "Notify those with the help-ping role that your question is urgent."));
setCommandData(new SubcommandData("ping", "Notify potential helpers that your question is urgent."));
lastPingTimes = new ConcurrentHashMap<>();
this.botConfig = botConfig;
asyncPool.scheduleWithFixedDelay(this::cleanTimeoutCache, CACHE_CLEANUP_DELAY, CACHE_CLEANUP_DELAY, TimeUnit.SECONDS);
Expand Down Expand Up @@ -214,14 +216,18 @@ private void acknowledgeChangeAction(ButtonInteractionEvent event, boolean ackno
.stream()
.map(e->new EmbedBuilder(e)
.setColor(acknowledged ? Color.GRAY : Color.YELLOW)
.addField("marked as " + (acknowledged?"acknowledged":"needs help") + " by",
event.getUser().getAsMention(), false))
.addField("marked as " + (acknowledged?"acknowledged":"needs help"),
"by " + event.getUser().getAsMention()+" "+getCurrentFormattedTimestamp(), false))
.map(this::removeOldField)
.map(EmbedBuilder::build)
.toList())
.setActionRow(acknowledged?createUndoAcknowledgementButton():createAcknowledgementButton())
.queue();
}

private String getCurrentFormattedTimestamp() {
return TimeFormat.RELATIVE.format(Instant.now().toEpochMilli());
}

private String getForumTagText(ForumTag tag) {
EmojiUnion emoji = tag.getEmoji();
Expand Down