Skip to content

Commit 54987e8

Browse files
committed
allow deletion of close suggestion
1 parent a1af405 commit 54987e8

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/main/java/net/javadiscord/javabot/systems/help/HelpListener.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
import net.dv8tion.jda.api.interactions.components.ActionComponent;
1717
import net.dv8tion.jda.api.interactions.components.ActionRow;
1818
import net.dv8tion.jda.api.interactions.components.buttons.Button;
19-
import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
2019
import net.javadiscord.javabot.annotations.AutoDetectableComponentHandler;
2120
import net.javadiscord.javabot.data.config.BotConfig;
2221
import net.javadiscord.javabot.data.config.guild.HelpConfig;
2322
import net.javadiscord.javabot.data.h2db.DbActions;
2423
import net.javadiscord.javabot.systems.help.dao.HelpAccountRepository;
2524
import net.javadiscord.javabot.systems.help.dao.HelpTransactionRepository;
2625
import net.javadiscord.javabot.util.ExceptionLogger;
26+
import net.javadiscord.javabot.util.InteractionUtils;
2727
import net.javadiscord.javabot.util.Responses;
2828
import org.jetbrains.annotations.NotNull;
2929
import org.springframework.dao.DataAccessException;
@@ -112,15 +112,14 @@ private void replyCloseSuggestionIfPatternMatches(Message msg) {
112112
if(msg.getChannel().asThreadChannel().getOwnerIdLong() == msg.getAuthor().getIdLong()) {
113113
for (String[] detector : closeSuggestionDetectors) {
114114
if (doesMatchDetector(content, detector)) {
115-
msg.reply(new MessageCreateBuilder()
116-
.addContent("""
117-
If you are finished with your post, please close your post.
118-
If you are not, please ignore this message.
119-
Note that you will not be able to send further messages after this post have been closed.
120-
""")
121-
.addActionRow(createCloseSuggestionButton(msg.getChannel().asThreadChannel()))
122-
.build())
123-
.queue();
115+
msg.reply("""
116+
If you are finished with your post, please close your post.
117+
If you are not, please ignore this message.
118+
Note that you will not be able to send further messages after this post have been closed.
119+
""")
120+
.addActionRow(createCloseSuggestionButton(msg.getChannel().asThreadChannel()),
121+
Button.secondary(InteractionUtils.DELETE_ORIGINAL_TEMPLATE, "\uD83D\uDDD1️"))
122+
.queue();
124123
}
125124
}
126125
}

0 commit comments

Comments
 (0)