mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-15 04:02:53 +00:00
[AB-120] adding jump link to modmail notification
This commit is contained in:
@@ -14,7 +14,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.dv8tion.jda.api.entities.Message;
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Isolation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -57,7 +56,7 @@ public class ModMailMessageListener implements PrivateMessageReceivedListener {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
} else {
|
} 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);
|
modMailThreadService.createModMailPrompt(user, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
* 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",
|
"\u0034\u20e3", "\u0035\u20e3", "\u0036\u20e3",
|
||||||
"\u0037\u20e3", "\u0038\u20e3", "\u0039\u20e3",
|
"\u0037\u20e3", "\u0038\u20e3", "\u0039\u20e3",
|
||||||
"\u0040\u20e3");
|
"\u0040\u20e3");
|
||||||
@@ -213,7 +213,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
|
|||||||
}
|
}
|
||||||
CompletableFuture notificationFuture;
|
CompletableFuture notificationFuture;
|
||||||
if (userInitiated) {
|
if (userInitiated) {
|
||||||
notificationFuture = self.sendModMailNotification(member);
|
notificationFuture = self.sendModMailNotification(member, channel);
|
||||||
} else {
|
} else {
|
||||||
notificationFuture = CompletableFuture.completedFuture(null);
|
notificationFuture = CompletableFuture.completedFuture(null);
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
|
|||||||
* @param member The {@link FullUserInServer} which opened the thread
|
* @param member The {@link FullUserInServer} which opened the thread
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public CompletableFuture<Void> sendModMailNotification(Member member) {
|
public CompletableFuture<Void> sendModMailNotification(Member member, TextChannel channel) {
|
||||||
Long serverId = member.getGuild().getIdLong();
|
Long serverId = member.getGuild().getIdLong();
|
||||||
log.info("Sending modmail notification for new modmail thread about user {} in server {}.", member.getId(), serverId);
|
log.info("Sending modmail notification for new modmail thread about user {} in server {}.", member.getId(), serverId);
|
||||||
AServer server = serverManagementService.loadServer(serverId);
|
AServer server = serverManagementService.loadServer(serverId);
|
||||||
@@ -249,6 +249,7 @@ public class ModMailThreadServiceBean implements ModMailThreadService {
|
|||||||
.builder()
|
.builder()
|
||||||
.member(member)
|
.member(member)
|
||||||
.roles(rolesToPing)
|
.roles(rolesToPing)
|
||||||
|
.channel(channel)
|
||||||
.build();
|
.build();
|
||||||
MessageToSend messageToSend = templateService.renderEmbedTemplate("modmail_notification_message", modMailNotificationModel);
|
MessageToSend messageToSend = templateService.renderEmbedTemplate("modmail_notification_message", modMailNotificationModel);
|
||||||
List<CompletableFuture<Message>> modmailping = postTargetService.sendEmbedInPostTarget(messageToSend, ModMailPostTargets.MOD_MAIL_PING, serverId);
|
List<CompletableFuture<Message>> modmailping = postTargetService.sendEmbedInPostTarget(messageToSend, ModMailPostTargets.MOD_MAIL_PING, serverId);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
|
||||||
import java.util.List;
|
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.
|
* A list of roles which will be notified upon creation of the mod mail thread.
|
||||||
*/
|
*/
|
||||||
private List<ModMailRole> roles;
|
private List<ModMailRole> roles;
|
||||||
|
/**
|
||||||
|
* The {@link TextChannel} in which the mod mail thread is handled
|
||||||
|
*/
|
||||||
|
private TextChannel channel;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user