mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-16 04:21:49 +00:00
[AB-232] moving logging to separate module
refactoring leave and join listener
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.config.feature;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import dev.sheldan.abstracto.moderation.config.posttarget.LoggingPostTarget;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class LoggingFeatureConfig implements FeatureConfig {
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return ModerationFeatureDefinition.LOGGING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(LoggingPostTarget.DELETE_LOG, LoggingPostTarget.EDIT_LOG, LoggingPostTarget.JOIN_LOG, LoggingPostTarget.LEAVE_LOG);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import lombok.Getter;
|
||||
public enum ModerationFeatureDefinition implements FeatureDefinition {
|
||||
MODERATION("moderation"),
|
||||
WARNING("warnings"),
|
||||
LOGGING("logging"),
|
||||
MUTING("muting"),
|
||||
AUTOMATIC_WARN_DECAY("warnDecay"),
|
||||
USER_NOTES("userNotes"),
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.config.posttarget;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum LoggingPostTarget implements PostTargetEnum {
|
||||
LEAVE_LOG("leaveLog"), JOIN_LOG("joinLog"), DELETE_LOG("deleteLog"), EDIT_LOG("editLog");
|
||||
|
||||
private String key;
|
||||
|
||||
LoggingPostTarget(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.model.template.listener;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.context.SlimUserInitiatedServerContext;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* Used when rendering the attachment message, when the message contained multiple attachments.
|
||||
* The template is: "message_deleted_attachment_embed"
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class MessageDeletedAttachmentLog extends SlimUserInitiatedServerContext {
|
||||
/**
|
||||
* The proxy URL to the attachment which was deleted.
|
||||
*/
|
||||
private String imageUrl;
|
||||
/**
|
||||
* The index of this attachment in the deleted message.
|
||||
*/
|
||||
private Integer counter;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.model.template.listener;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.cache.CachedMessage;
|
||||
import dev.sheldan.abstracto.core.models.context.SlimUserInitiatedServerContext;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* Used when rendering the log message when a message was deleted. The template is: "message_deleted_embed"
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class MessageDeletedLog extends SlimUserInitiatedServerContext {
|
||||
/**
|
||||
* A {@link CachedMessage} representing the deleted message
|
||||
*/
|
||||
private CachedMessage cachedMessage;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package dev.sheldan.abstracto.moderation.model.template.listener;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.cache.CachedMessage;
|
||||
import dev.sheldan.abstracto.core.models.context.UserInitiatedServerContext;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
|
||||
/**
|
||||
* Used when rendering the log message when a message was edited. The template is: "message_edited_embed"
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
public class MessageEditedLog extends UserInitiatedServerContext {
|
||||
/**
|
||||
* The {@link CachedMessage} instance which contains the new content of the message
|
||||
*/
|
||||
private Message messageAfter;
|
||||
|
||||
/**
|
||||
* The {@link CachedMessage} which contains the message before the edit was made
|
||||
*/
|
||||
private CachedMessage messageBefore;
|
||||
}
|
||||
Reference in New Issue
Block a user