[AB-120] adding jump link to modmail notification

This commit is contained in:
Sheldan
2021-02-14 19:56:05 +01:00
parent cb7e904d29
commit 876fbc01d9
3 changed files with 10 additions and 5 deletions

View File

@@ -14,7 +14,6 @@ import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@@ -57,7 +56,7 @@ public class ModMailMessageListener implements PrivateMessageReceivedListener {
return null;
});
} else {
log.info("User {} does not have an open modmail thread. Crating prompt.", user.getId());
log.info("User {} does not have an open modmail thread. Creating prompt.", user.getId());
modMailThreadService.createModMailPrompt(user, message);
}
}

View File

@@ -169,7 +169,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
/**
* The emoji used when the user can decide for a server to open a mod mail thread in.
*/
private List<String> NUMBER_EMOJI = Arrays.asList("\u0031\u20e3", "\u0032\u20e3", "\u0033\u20e3",
private static List<String> NUMBER_EMOJI = Arrays.asList("\u0031\u20e3", "\u0032\u20e3", "\u0033\u20e3",
"\u0034\u20e3", "\u0035\u20e3", "\u0036\u20e3",
"\u0037\u20e3", "\u0038\u20e3", "\u0039\u20e3",
"\u0040\u20e3");
@@ -213,7 +213,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
}
CompletableFuture notificationFuture;
if (userInitiated) {
notificationFuture = self.sendModMailNotification(member);
notificationFuture = self.sendModMailNotification(member, channel);
} else {
notificationFuture = CompletableFuture.completedFuture(null);
}
@@ -239,7 +239,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
* @param member The {@link FullUserInServer} which opened the thread
*/
@Transactional
public CompletableFuture<Void> sendModMailNotification(Member member) {
public CompletableFuture<Void> sendModMailNotification(Member member, TextChannel channel) {
Long serverId = member.getGuild().getIdLong();
log.info("Sending modmail notification for new modmail thread about user {} in server {}.", member.getId(), serverId);
AServer server = serverManagementService.loadServer(serverId);
@@ -249,6 +249,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
.builder()
.member(member)
.roles(rolesToPing)
.channel(channel)
.build();
MessageToSend messageToSend = templateService.renderEmbedTemplate("modmail_notification_message", modMailNotificationModel);
List<CompletableFuture<Message>> modmailping = postTargetService.sendEmbedInPostTarget(messageToSend, ModMailPostTargets.MOD_MAIL_PING, serverId);

View File

@@ -8,6 +8,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.TextChannel;
import java.util.List;
@@ -31,4 +32,8 @@ public class ModMailNotificationModel extends ServerContext {
* A list of roles which will be notified upon creation of the mod mail thread.
*/
private List<ModMailRole> roles;
/**
* The {@link TextChannel} in which the mod mail thread is handled
*/
private TextChannel channel;
}