|
3 | 3 | import net.dv8tion.jda.api.EmbedBuilder; |
4 | 4 | import net.dv8tion.jda.api.JDA; |
5 | 5 | import net.dv8tion.jda.api.entities.Guild; |
| 6 | +import net.dv8tion.jda.api.entities.Member; |
6 | 7 | import net.dv8tion.jda.api.entities.MessageEmbed; |
7 | 8 | import net.dv8tion.jda.api.entities.channel.concrete.ForumChannel; |
8 | 9 | import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel; |
@@ -65,15 +66,16 @@ private void autoArchiveForGuild(Guild guild) { |
65 | 66 | logger.debug("Found {} active questions", activeThreads.size()); |
66 | 67 |
|
67 | 68 | Instant archiveAfterMoment = computeArchiveAfterMoment(); |
68 | | - activeThreads |
69 | | - .forEach(activeThread -> autoArchiveForThread(activeThread, archiveAfterMoment)); |
| 69 | + activeThreads.forEach(activeThread -> autoArchiveForThread(activeThread, archiveAfterMoment, |
| 70 | + activeThread.getOwner())); |
70 | 71 | } |
71 | 72 |
|
72 | 73 | private Instant computeArchiveAfterMoment() { |
73 | 74 | return Instant.now().minus(ARCHIVE_AFTER_INACTIVITY_OF); |
74 | 75 | } |
75 | 76 |
|
76 | | - private void autoArchiveForThread(ThreadChannel threadChannel, Instant archiveAfterMoment) { |
| 77 | + private void autoArchiveForThread(ThreadChannel threadChannel, Instant archiveAfterMoment, |
| 78 | + Member author) { |
77 | 79 | if (shouldBeArchived(threadChannel, archiveAfterMoment)) { |
78 | 80 | logger.debug("Auto archiving help thread {}", threadChannel.getId()); |
79 | 81 |
|
@@ -108,7 +110,8 @@ private void autoArchiveForThread(ThreadChannel threadChannel, Instant archiveAf |
108 | 110 | .setColor(HelpSystemHelper.AMBIENT_COLOR) |
109 | 111 | .build(); |
110 | 112 |
|
111 | | - threadChannel.sendMessageEmbeds(embed) |
| 113 | + threadChannel.sendMessage(author.getAsMention()) |
| 114 | + .addEmbeds(embed) |
112 | 115 | .flatMap(any -> threadChannel.getManager().setArchived(true)) |
113 | 116 | .queue(); |
114 | 117 | } |
|
0 commit comments