mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-24 13:44:33 +00:00
[AB-233] adding feature to handle removed attachments in message edited events
now cloning the cached message for the listeners, in order to not influence the objects when updating it
This commit is contained in:
@@ -6,11 +6,13 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@EqualsAndHashCode
|
||||
public class ServerUser {
|
||||
public class ServerUser implements Serializable {
|
||||
private Long serverId;
|
||||
private Long userId;
|
||||
|
||||
|
||||
@@ -4,11 +4,14 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedAttachment {
|
||||
public class CachedAttachment implements Serializable {
|
||||
private String url;
|
||||
private Long id;
|
||||
private String proxyUrl;
|
||||
private String fileName;
|
||||
private Integer size;
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedAuthor {
|
||||
public class CachedAuthor implements Serializable {
|
||||
private Long authorId;
|
||||
private Boolean isBot;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,14 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.dv8tion.jda.api.entities.EmbedType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedEmbed {
|
||||
public class CachedEmbed implements Serializable {
|
||||
private CachedEmbedAuthor author;
|
||||
private CachedEmbedTitle title;
|
||||
private CachedEmbedColor color;
|
||||
|
||||
@@ -5,10 +5,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedEmbedAuthor {
|
||||
public class CachedEmbedAuthor implements Serializable {
|
||||
private String name;
|
||||
private String url;
|
||||
private String avatar;
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Builder
|
||||
public class CachedEmbedColor {
|
||||
public class CachedEmbedColor implements Serializable {
|
||||
private Integer r;
|
||||
private Integer g;
|
||||
private Integer b;
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedEmbedField {
|
||||
public class CachedEmbedField implements Serializable {
|
||||
private String name;
|
||||
private String value;
|
||||
private Boolean inline;
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedEmbedFooter {
|
||||
public class CachedEmbedFooter implements Serializable {
|
||||
private String text;
|
||||
private String icon;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package dev.sheldan.abstracto.core.models.cache;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter @Setter
|
||||
public class CachedEmbedTitle {
|
||||
public class CachedEmbedTitle implements Serializable {
|
||||
private String title;
|
||||
private String url;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,13 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@EqualsAndHashCode
|
||||
public class CachedEmote {
|
||||
public class CachedEmote implements Serializable {
|
||||
private String emoteName;
|
||||
private Long emoteId;
|
||||
private Boolean external;
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedImageInfo {
|
||||
public class CachedImageInfo implements Serializable {
|
||||
protected String url;
|
||||
protected String proxyUrl;
|
||||
protected Integer width;
|
||||
|
||||
@@ -6,13 +6,14 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedMessage {
|
||||
public class CachedMessage implements Serializable {
|
||||
private Long serverId;
|
||||
private Long channelId;
|
||||
private Long messageId;
|
||||
|
||||
@@ -6,12 +6,13 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedReactions {
|
||||
public class CachedReactions implements Serializable {
|
||||
private CachedEmote emote;
|
||||
private Boolean self;
|
||||
private List<ServerUser> users;
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class CachedThumbnail {
|
||||
public class CachedThumbnail implements Serializable {
|
||||
protected String url;
|
||||
protected String proxyUrl;
|
||||
protected Integer width;
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.sheldan.abstracto.core.service;
|
||||
import dev.sheldan.abstracto.core.models.cache.*;
|
||||
import net.dv8tion.jda.api.entities.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface CacheEntityService {
|
||||
@@ -10,6 +11,7 @@ public interface CacheEntityService {
|
||||
CachedEmote getCachedEmoteFromEmote(MessageReaction.ReactionEmote emote, Guild guild);
|
||||
CachedAttachment getCachedAttachment(Message.Attachment attachment);
|
||||
CachedEmbed getCachedEmbedFromEmbed(MessageEmbed embed);
|
||||
List<CachedAttachment> getCachedAttachments(List<Message.Attachment> attachments);
|
||||
CachedThumbnail buildCachedThumbnail(MessageEmbed.Thumbnail thumbnail);
|
||||
CachedImageInfo buildCachedImage(MessageEmbed.ImageInfo image);
|
||||
CompletableFuture<CachedReactions> getCachedReactionFromReaction(MessageReaction reaction);
|
||||
|
||||
Reference in New Issue
Block a user