mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-15 20:16:34 +00:00
[AB-243] when loading messages we ignore embed links part of a channel/guild which are not available anymore
This commit is contained in:
@@ -126,14 +126,20 @@ public class MessageServiceBean implements MessageService {
|
|||||||
.collect(Collectors.groupingBy(ServerChannelMessage::getServerId));
|
.collect(Collectors.groupingBy(ServerChannelMessage::getServerId));
|
||||||
serverMessages.forEach((serverId, channelMessagesNonGrouped) -> {
|
serverMessages.forEach((serverId, channelMessagesNonGrouped) -> {
|
||||||
Guild guild = guildService.getGuildById(serverId);
|
Guild guild = guildService.getGuildById(serverId);
|
||||||
Map<Long, List<ServerChannelMessage>> channelMessages = channelMessagesNonGrouped
|
// in case the gild is not available anymore, this would cause the job to fail
|
||||||
.stream()
|
if(guild != null) {
|
||||||
.collect(Collectors.groupingBy(ServerChannelMessage::getChannelId));
|
Map<Long, List<ServerChannelMessage>> channelMessages = channelMessagesNonGrouped
|
||||||
channelMessages.forEach((channelId, serverChannelMessages) -> {
|
.stream()
|
||||||
MessageChannel channel = guild.getTextChannelById(channelId);
|
.collect(Collectors.groupingBy(ServerChannelMessage::getChannelId));
|
||||||
serverChannelMessages.forEach(serverChannelMessage ->
|
channelMessages.forEach((channelId, serverChannelMessages) -> {
|
||||||
messageFutures.add(channelService.retrieveMessageInChannel(channel, serverChannelMessage.getMessageId())));
|
MessageChannel channel = guild.getTextChannelById(channelId);
|
||||||
});
|
// in case the channel was deleted, this would cause the job to fail
|
||||||
|
if(channel != null) {
|
||||||
|
serverChannelMessages.forEach(serverChannelMessage ->
|
||||||
|
messageFutures.add(channelService.retrieveMessageInChannel(channel, serverChannelMessage.getMessageId())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return messageFutures;
|
return messageFutures;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user