mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-24 05:39:44 +00:00
[AB-298] fixing various issues related to modmail:
fixing editing a message without messages but only embeds not possible in channel service refactoring closing parameters to use an object instead of parameters always adding a progress indicator to closing a modmail thread adding a notification to contact in order to show where the thread was created fixing configuration for category (this caused the setup to fail, because there was no default value) and threadMessage feature modes not being correct refactored model for closing header and added additional information refactored modmail message logging to use the message history instead of individually loading the messages adding nicer exception in case the mod mail message update failed adding creation of AUserInAServer in case the user did not interact on the server yet changed ID of modmail thread to be identical to the channel it was created in, this is so we can load the channel easier
This commit is contained in:
@@ -281,7 +281,7 @@ public class ChannelServiceBean implements ChannelService {
|
||||
@Override
|
||||
public CompletableFuture<Message> editMessageInAChannelFuture(MessageToSend messageToSend, MessageChannel channel, Long messageId) {
|
||||
MessageAction messageAction;
|
||||
if(!StringUtils.isBlank(messageToSend.getMessages().get(0))) {
|
||||
if(!messageToSend.getMessages().isEmpty() && !StringUtils.isBlank(messageToSend.getMessages().get(0))) {
|
||||
log.debug("Editing message {} with new text content.", messageId);
|
||||
messageAction = channel.editMessageById(messageId, messageToSend.getMessages().get(0));
|
||||
if(messageToSend.getEmbeds() != null && !messageToSend.getEmbeds().isEmpty()) {
|
||||
|
||||
@@ -205,6 +205,12 @@ public class MessageServiceBean implements MessageService {
|
||||
return loadMessage(message.getGuild().getIdLong(), message.getChannel().getIdLong(), message.getIdLong());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Message> editMessageWithNewTemplate(Message message, String templateKey, Object model) {
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(templateKey, model, message.getGuild().getIdLong());
|
||||
return channelService.editMessageInAChannelFuture(messageToSend, message.getChannel(), message.getIdLong());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageAction editMessage(Message message, MessageEmbed messageEmbed) {
|
||||
metricService.incrementCounter(MESSAGE_EDIT_METRIC);
|
||||
|
||||
Reference in New Issue
Block a user