mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-08 02:17:41 +00:00
[SIS-5] enabling and customizing moderation
This commit is contained in:
@@ -75,6 +75,13 @@
|
|||||||
<artifactId>starboard-impl</artifactId>
|
<artifactId>starboard-impl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>moderation-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- sissi modules -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.sheldan.sissi.application.module</groupId>
|
<groupId>dev.sheldan.sissi.application.module</groupId>
|
||||||
<artifactId>quotes</artifactId>
|
<artifactId>quotes</artifactId>
|
||||||
@@ -87,6 +94,14 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- sissi customizations -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||||
|
<artifactId>moderation-custom</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -26,8 +26,9 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>executable</module>
|
|
||||||
<module>sissi-modules</module>
|
<module>sissi-modules</module>
|
||||||
|
<module>sissi-customizations</module>
|
||||||
|
<module>executable</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
44
application/sissi-customizations/moderation-custom/pom.xml
Normal file
44
application/sissi-customizations/moderation-custom/pom.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||||
|
<artifactId>sissi-customizations</artifactId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>moderation-custom</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>moderation-int</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/liquibase.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
||||||
|
<id>liquibase</id>
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<outputDirectory>.</outputDirectory>
|
||||||
|
<directory>${project.basedir}/src/main/resources/migrations</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*</include>
|
||||||
|
</includes>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</assembly>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package dev.sheldan.sissi.module.costum.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.moderation.config.feature.ReportReactionFeatureConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static dev.sheldan.sissi.module.costum.listener.ReactionReportReactionListener.REACTION_REPORT_REACTION_AMOUNT_CONFIG_KEY;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ModerationCustomFeature implements FeatureConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReportReactionFeatureConfig reportReactionFeatureConfig;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return ModerationCustomFeatureDefinition.MODERATION_CUSTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FeatureConfig> getRequiredFeatures() {
|
||||||
|
return Arrays.asList(reportReactionFeatureConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getRequiredSystemConfigKeys() {
|
||||||
|
return Arrays.asList(REACTION_REPORT_REACTION_AMOUNT_CONFIG_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.sissi.module.costum.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ModerationCustomFeatureDefinition implements FeatureDefinition {
|
||||||
|
MODERATION_CUSTOM("moderationCustom");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
ModerationCustomFeatureDefinition(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.sheldan.sissi.module.costum.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@PropertySource("classpath:moderation-custom.properties")
|
||||||
|
public class ModerationCustomProperties {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package dev.sheldan.sissi.module.costum.listener;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
|
import dev.sheldan.abstracto.core.service.ConfigService;
|
||||||
|
import dev.sheldan.abstracto.core.service.ReactionService;
|
||||||
|
import dev.sheldan.abstracto.moderation.listener.ReportMessageCreatedListener;
|
||||||
|
import dev.sheldan.abstracto.moderation.model.listener.ReportMessageCreatedModel;
|
||||||
|
import dev.sheldan.sissi.module.costum.config.ModerationCustomFeatureDefinition;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ReactionReportReactionListener implements ReportMessageCreatedListener {
|
||||||
|
|
||||||
|
public static final String REACTION_REPORT_REACTION_AMOUNT_CONFIG_KEY = "reportReactionAmount";
|
||||||
|
public static final String REACTION_REPORT_EMOTE_PREFIX = "reactionReport";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReactionService reactionService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultListenerResult execute(ReportMessageCreatedModel model) {
|
||||||
|
Long reactionAmount = configService.getLongValueOrConfigDefault(REACTION_REPORT_REACTION_AMOUNT_CONFIG_KEY, model.getServerId());
|
||||||
|
for (int i = 0; i < reactionAmount; i++) {
|
||||||
|
String emoteKey = buildReactionEmoteName(i + 1);
|
||||||
|
reactionService.addReactionToMessageAsync(emoteKey,
|
||||||
|
model.getServerId(), model.getReportMessage().getChannelId(), model.getReportMessage().getMessageId())
|
||||||
|
.thenAccept(unused -> log.info("Added reaction emote {} on report message {} in channel {} in server {}",
|
||||||
|
emoteKey, model.getReportMessage().getMessageId(), model.getReportMessage().getChannelId(), model.getServerId()))
|
||||||
|
.exceptionally(throwable -> {
|
||||||
|
log.info("Failed to add reaction emote {} on report message {} in channel {} in server {}",
|
||||||
|
emoteKey, model.getReportMessage().getMessageId(), model.getReportMessage().getChannelId(), model.getServerId());
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefaultListenerResult.PROCESSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return ModerationCustomFeatureDefinition.MODERATION_CUSTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildReactionEmoteName(Integer position) {
|
||||||
|
return REACTION_REPORT_EMOTE_PREFIX + position;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
|
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
|
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="default_emote.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
|
<changeSet author="Sheldan" id="moderation_custom_reaction_message_default_emote-insert">
|
||||||
|
<insert tableName="default_emote">
|
||||||
|
<column name="emote_key" value="reactionReport1"/>
|
||||||
|
<column name="name" value="♂️"/>
|
||||||
|
</insert>
|
||||||
|
<insert tableName="default_emote">
|
||||||
|
<column name="emote_key" value="reactionReport2"/>
|
||||||
|
<column name="name" value="📣"/>
|
||||||
|
</insert>
|
||||||
|
<insert tableName="default_emote">
|
||||||
|
<column name="emote_key" value="reactionReport3"/>
|
||||||
|
<column name="name" value="🤫"/>
|
||||||
|
</insert>
|
||||||
|
<insert tableName="default_emote">
|
||||||
|
<column name="emote_key" value="reactionReport4"/>
|
||||||
|
<column name="name" value="🔨"/>
|
||||||
|
</insert>
|
||||||
|
<insert tableName="default_emote">
|
||||||
|
<column name="emote_key" value="reactionReport5"/>
|
||||||
|
<column name="name" value="⚠️"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
|
<changeSet author="Sheldan" id="moderation_custom_feature-insertion">
|
||||||
|
<insert tableName="feature">
|
||||||
|
<column name="key" value="moderationCustom"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
|
<include file="1.1.0/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
abstracto.featureFlags.moderationCustom.featureName=moderationCustom
|
||||||
|
abstracto.featureFlags.moderationCustom.enabled=false
|
||||||
|
|
||||||
|
abstracto.systemConfigs.reportReactionAmount.name=reportReactionAmount
|
||||||
|
abstracto.systemConfigs.reportReactionAmount.longValue=5
|
||||||
|
|
||||||
21
application/sissi-customizations/pom.xml
Normal file
21
application/sissi-customizations/pom.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>application</artifactId>
|
||||||
|
<groupId>dev.sheldan.sissi.application</groupId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||||
|
<artifactId>sissi-customizations</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>moderation-custom</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -5,12 +5,12 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||||
import dev.sheldan.sissi.module.meetup.config.MeetupFeatureDefinition;
|
import dev.sheldan.sissi.module.meetup.config.MeetupFeatureDefinition;
|
||||||
import dev.sheldan.sissi.module.meetup.config.MeetupSlashCommandNames;
|
import dev.sheldan.sissi.module.meetup.config.MeetupSlashCommandNames;
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.ComponentService;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.service.ComponentService;
|
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.ComponentService;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.service.ComponentService;
|
|
||||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.sissi.module.meetup.config.MeetupFeatureDefinition;
|
import dev.sheldan.sissi.module.meetup.config.MeetupFeatureDefinition;
|
||||||
import dev.sheldan.sissi.module.meetup.config.MeetupSlashCommandNames;
|
import dev.sheldan.sissi.module.meetup.config.MeetupSlashCommandNames;
|
||||||
import dev.sheldan.sissi.module.meetup.exception.NotMeetupOrganizerException;
|
import dev.sheldan.sissi.module.meetup.exception.NotMeetupOrganizerException;
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package dev.sheldan.sissi.module.meetup.listener;
|
|||||||
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||||
import dev.sheldan.abstracto.core.listener.ButtonClickedListenerResult;
|
import dev.sheldan.abstracto.core.interaction.ComponentPayloadManagementService;
|
||||||
import dev.sheldan.abstracto.core.listener.async.jda.ButtonClickedListener;
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListener;
|
||||||
import dev.sheldan.abstracto.core.models.listener.ButtonClickedListenerModel;
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerModel;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerResult;
|
||||||
import dev.sheldan.abstracto.core.service.MessageService;
|
import dev.sheldan.abstracto.core.service.MessageService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ComponentPayloadManagementService;
|
|
||||||
import dev.sheldan.sissi.module.meetup.config.MeetupFeatureDefinition;
|
import dev.sheldan.sissi.module.meetup.config.MeetupFeatureDefinition;
|
||||||
import dev.sheldan.sissi.module.meetup.model.database.Meetup;
|
import dev.sheldan.sissi.module.meetup.model.database.Meetup;
|
||||||
import dev.sheldan.sissi.module.meetup.model.payload.MeetupChangeTimeConfirmationPayload;
|
import dev.sheldan.sissi.module.meetup.model.payload.MeetupChangeTimeConfirmationPayload;
|
||||||
|
|||||||
@@ -2,18 +2,18 @@ package dev.sheldan.sissi.module.meetup.listener;
|
|||||||
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||||
import dev.sheldan.abstracto.core.listener.ButtonClickedListenerResult;
|
import dev.sheldan.abstracto.core.interaction.ComponentPayloadManagementService;
|
||||||
import dev.sheldan.abstracto.core.listener.async.jda.ButtonClickedListener;
|
import dev.sheldan.abstracto.core.interaction.ComponentPayloadService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.ComponentService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListener;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerModel;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerResult;
|
||||||
import dev.sheldan.abstracto.core.models.database.AChannel;
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.models.database.ComponentPayload;
|
import dev.sheldan.abstracto.core.models.database.ComponentPayload;
|
||||||
import dev.sheldan.abstracto.core.models.listener.ButtonClickedListenerModel;
|
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.service.ComponentPayloadService;
|
|
||||||
import dev.sheldan.abstracto.core.service.ComponentService;
|
|
||||||
import dev.sheldan.abstracto.core.service.MessageService;
|
import dev.sheldan.abstracto.core.service.MessageService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
import dev.sheldan.abstracto.core.service.management.ChannelManagementService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ComponentPayloadManagementService;
|
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package dev.sheldan.sissi.module.meetup.listener;
|
|||||||
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
import dev.sheldan.abstracto.core.config.ListenerPriority;
|
||||||
import dev.sheldan.abstracto.core.listener.ButtonClickedListenerResult;
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListener;
|
||||||
import dev.sheldan.abstracto.core.listener.async.jda.ButtonClickedListener;
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerModel;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListenerResult;
|
||||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
import dev.sheldan.abstracto.core.models.listener.ButtonClickedListenerModel;
|
|
||||||
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.sheldan.sissi.module.meetup.model.payload;
|
package dev.sheldan.sissi.module.meetup.model.payload;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.models.template.button.ButtonPayload;
|
import dev.sheldan.abstracto.core.interaction.button.ButtonPayload;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.sheldan.sissi.module.meetup.model.payload;
|
package dev.sheldan.sissi.module.meetup.model.payload;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.models.template.button.ButtonPayload;
|
import dev.sheldan.abstracto.core.interaction.button.ButtonPayload;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.sheldan.sissi.module.meetup.model.payload;
|
package dev.sheldan.sissi.module.meetup.model.payload;
|
||||||
|
|
||||||
import dev.sheldan.abstracto.core.models.template.button.ButtonPayload;
|
import dev.sheldan.abstracto.core.interaction.button.ButtonPayload;
|
||||||
import dev.sheldan.sissi.module.meetup.model.database.MeetupDecision;
|
import dev.sheldan.sissi.module.meetup.model.database.MeetupDecision;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package dev.sheldan.sissi.module.meetup.service;
|
package dev.sheldan.sissi.module.meetup.service;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.interaction.ComponentPayloadManagementService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.ComponentPayloadService;
|
||||||
import dev.sheldan.abstracto.core.models.ServerChannelMessage;
|
import dev.sheldan.abstracto.core.models.ServerChannelMessage;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
||||||
import dev.sheldan.abstracto.core.service.*;
|
import dev.sheldan.abstracto.core.service.*;
|
||||||
import dev.sheldan.abstracto.core.service.management.ComponentPayloadManagementService;
|
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
@@ -291,15 +292,24 @@ public class MeetupServiceBean {
|
|||||||
public void cleanupMeetups() {
|
public void cleanupMeetups() {
|
||||||
Instant time = Instant.now().minus(1, ChronoUnit.DAYS);
|
Instant time = Instant.now().minus(1, ChronoUnit.DAYS);
|
||||||
List<Meetup> oldMeetups = meetupManagementServiceBean.getMeetupsOlderThan(time);
|
List<Meetup> oldMeetups = meetupManagementServiceBean.getMeetupsOlderThan(time);
|
||||||
|
log.info("Deleting {} old meetup.s", oldMeetups.size());
|
||||||
deleteMeetups(oldMeetups);
|
deleteMeetups(oldMeetups);
|
||||||
List<Meetup> cancelledMeetups = meetupManagementServiceBean.findCancelledMeetups();
|
List<Meetup> cancelledMeetups = meetupManagementServiceBean.findCancelledMeetups();
|
||||||
|
log.info("Deleting {} cancelled meetups.", cancelledMeetups.size());
|
||||||
deleteMeetups(cancelledMeetups);
|
deleteMeetups(cancelledMeetups);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteMeetups(List<Meetup> oldMeetups) {
|
private void deleteMeetups(List<Meetup> oldMeetups) {
|
||||||
oldMeetups.forEach(meetup -> {
|
oldMeetups.forEach(meetup -> {
|
||||||
if(meetup.getMessageId() != null) {
|
if(meetup.getMessageId() != null) {
|
||||||
messageService.deleteMessageInChannelInServer(meetup.getServer().getId(), meetup.getMeetupChannel().getId(), meetup.getMessageId());
|
Long messageId = meetup.getMessageId();
|
||||||
|
Long meetupId = meetup.getId().getId();
|
||||||
|
Long serverId = meetup.getServer().getId();
|
||||||
|
messageService.deleteMessageInChannelInServer(meetup.getServer().getId(), meetup.getMeetupChannel().getId(), meetup.getMessageId())
|
||||||
|
.exceptionally(throwable -> {
|
||||||
|
log.error("Failed to delete message {} for meetup {} in server {}.", messageId, meetupId, serverId);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
meetupComponentManagementServiceBean.deleteAllComponents(meetup);
|
meetupComponentManagementServiceBean.deleteAllComponents(meetup);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
import dev.sheldan.sissi.module.quotes.config.QuoteSlashCommandNames;
|
import dev.sheldan.sissi.module.quotes.config.QuoteSlashCommandNames;
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
|||||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.config.SlashCommandConfig;
|
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
|||||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
import dev.sheldan.abstracto.core.command.slash.parameter.SlashCommandParameterService;
|
|
||||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||||
|
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||||
import dev.sheldan.sissi.module.quotes.config.QuotesFeatureDefinition;
|
import dev.sheldan.sissi.module.quotes.config.QuotesFeatureDefinition;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<destFileName>app.jar</destFileName>
|
<destFileName>app.jar</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
<!-- template artefacts -->
|
<!-- abstracto template artefacts -->
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
@@ -73,6 +73,17 @@
|
|||||||
<destFileName>starboard.zip</destFileName>
|
<destFileName>starboard.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>moderation</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<!-- sissi template artefacts -->
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.sissi.templates</groupId>
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
<artifactId>quotes-templates</artifactId>
|
<artifactId>quotes-templates</artifactId>
|
||||||
@@ -93,7 +104,7 @@
|
|||||||
<destFileName>meetup.zip</destFileName>
|
<destFileName>meetup.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
<!-- translation artefacts -->
|
<!-- abstracto translation artefacts -->
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
@@ -125,6 +136,18 @@
|
|||||||
<destFileName>starboard.zip</destFileName>
|
<destFileName>starboard.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>moderation</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<!-- sissi translation artefacts -->
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
<artifactId>quote-translations</artifactId>
|
<artifactId>quote-translations</artifactId>
|
||||||
@@ -147,7 +170,7 @@
|
|||||||
|
|
||||||
<!-- custom -->
|
<!-- custom -->
|
||||||
|
|
||||||
<!-- liquibase artifacts -->
|
<!-- abstracto liquibase artifacts -->
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
||||||
<artifactId>scheduling-impl</artifactId>
|
<artifactId>scheduling-impl</artifactId>
|
||||||
@@ -192,7 +215,18 @@
|
|||||||
<destFileName>starboard.zip</destFileName>
|
<destFileName>starboard.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
<!-- custom modules -->
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>moderation-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<!-- sissi liquibase artifacts -->
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.sissi.application.module</groupId>
|
<groupId>dev.sheldan.sissi.application.module</groupId>
|
||||||
@@ -218,10 +252,51 @@
|
|||||||
|
|
||||||
<!-- customizations -->
|
<!-- customizations -->
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.sissi.application.module.custom</groupId>
|
||||||
|
<artifactId>moderation-custom</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation-custom.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
|
<artifactId>moderation-customization-translations</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation-custom.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<!-- overrides -->
|
<!-- overrides -->
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
|
<artifactId>moderation-template-overrides</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation-template-overrides.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<!-- overrides translations -->
|
<!-- overrides translations -->
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
||||||
|
<artifactId>moderation-translation-overrides</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>moderation-translation-overrides.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
{
|
{
|
||||||
"template_artifacts": ["core","starboard", "link-embed", "quotes", "meetup"],
|
"template_artifacts": [
|
||||||
"translation_artifacts": ["core", "starboard", "link-embed", "quotes", "meetup"],
|
"core","starboard", "link-embed", "moderation",
|
||||||
|
"quotes", "meetup",
|
||||||
|
"moderation-template-overrides"
|
||||||
|
],
|
||||||
|
"translation_artifacts": [
|
||||||
|
"core",
|
||||||
|
"starboard", "link-embed", "moderation",
|
||||||
|
"quotes", "meetup",
|
||||||
|
"moderation-custom",
|
||||||
|
"moderation-translation-overrides"
|
||||||
|
],
|
||||||
"liquibase_artifacts": [
|
"liquibase_artifacts": [
|
||||||
{ "zip": "scheduling", "file": "scheduling-changeLog.xml" },
|
{ "zip": "scheduling", "file": "scheduling-changeLog.xml" },
|
||||||
{ "zip": "core", "file": "core-changeLog.xml" },
|
{ "zip": "core", "file": "core-changeLog.xml" },
|
||||||
{ "zip": "link-embed", "file": "link-embed-changeLog.xml"},
|
{ "zip": "link-embed", "file": "link-embed-changeLog.xml"},
|
||||||
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
||||||
{ "zip": "quotes", "file": "quotes-changeLog.xml"},
|
{ "zip": "quotes", "file": "quotes-changeLog.xml"},
|
||||||
{ "zip": "meetup", "file": "meetup-changeLog.xml"}
|
{ "zip": "meetup", "file": "meetup-changeLog.xml"},
|
||||||
|
{ "zip": "moderation", "file": "moderation-changeLog.xml"},
|
||||||
|
{ "zip": "moderation-custom", "file": "moderation-custom-changeLog.xml"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@@ -20,8 +20,8 @@
|
|||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<!-- edit in release.yml as well -->
|
<!-- edit in release.yml as well -->
|
||||||
<!-- when releasing a new bot version, update the .env as well-->
|
<!-- when releasing a new bot version, update the .env as well-->
|
||||||
<abstracto.version>1.4.0.RC2</abstracto.version>
|
<abstracto.version>1.4.0-SNAPSHOT</abstracto.version>
|
||||||
<abstracto.templates.version>1.4.0.RC1</abstracto.templates.version>
|
<abstracto.templates.version>1.4.0-SNAPSHOT</abstracto.templates.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|||||||
@@ -12,5 +12,6 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>module-templates</module>
|
<module>module-templates</module>
|
||||||
|
<module>template-overrides</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
|
<artifactId>template-overrides</artifactId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>moderation-template-overrides</artifactId>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<finalName>moderation-template-overrides-${project.version}</finalName>
|
||||||
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||||
|
<id>zip</id>
|
||||||
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<outputDirectory>.</outputDirectory>
|
||||||
|
<directory>${project.basedir}/src/main/resources</directory>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</assembly>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
<#include "abstracto_color">,
|
||||||
|
<#assign messageLink=reportedMessage.messageUrl>
|
||||||
|
<#assign userMention>${reportedMessage.author.asMention}</#assign>
|
||||||
|
<#assign messageContent><#if reportedMessage.content?has_content>`${reportedMessage.content?json_string}`<#else><@safe_include "reactionReport_no_content"/></#if></#assign>
|
||||||
|
"description" : "<#if context?has_content><@safe_include "reactionReport_additional_context_label"/>: `${context?json_string}`</#if>
|
||||||
|
<@safe_include "reactionReport_notification_embed_description"/>",
|
||||||
|
"footer": {
|
||||||
|
"text": "<@safe_include "reaction_report_custom_text"/>"
|
||||||
|
}
|
||||||
|
<#if reportedMessage.attachments?size gt 0>
|
||||||
|
,"imageUrl": "${reportedMessage.attachments[0].proxyUrl}"
|
||||||
|
<#elseif reportedMessage.attachments?size = 0 && reportedMessage.embeds?size gt 0 && reportedMessage.embeds[0].cachedThumbnail??>
|
||||||
|
,"imageUrl": "${message.embeds[0].cachedThumbnail.proxyUrl}"
|
||||||
|
<#elseif reportedMessage.attachments?size = 0 && reportedMessage.embeds?size gt 0 && reportedMessage.embeds[0].cachedImageInfo??>
|
||||||
|
,"imageUrl": "${reportedMessage.embeds[0].cachedImageInfo.proxyUrl}"
|
||||||
|
</#if>
|
||||||
|
<#if singularMessage>,
|
||||||
|
,"fields": [
|
||||||
|
{
|
||||||
|
"name": "<@safe_include "reactionReport_notification_embed_report_counter_field_title"/>",
|
||||||
|
"value": "${reportCount}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
</#if>
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"buttons": [
|
||||||
|
{
|
||||||
|
"label": "<@safe_include "reactionReport_jump_button_label"/>",
|
||||||
|
"url": "${messageLink?json_string}",
|
||||||
|
"buttonStyle": "link",
|
||||||
|
"metaConfig": {
|
||||||
|
"persistCallback": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
18
templates/sissi-templates/template-overrides/pom.xml
Normal file
18
templates/sissi-templates/template-overrides/pom.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>sissi-templates</artifactId>
|
||||||
|
<groupId>dev.sheldan.sissi.templates</groupId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>template-overrides</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>moderation-template-overrides</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
|
<artifactId>customization-translations</artifactId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>moderation-customization-translations</artifactId>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<finalName>moderation-custom-translations-${project.version}</finalName>
|
||||||
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||||
|
<id>zip</id>
|
||||||
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<outputDirectory>.</outputDirectory>
|
||||||
|
<directory>${project.basedir}/src/main/resources</directory>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</assembly>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Custom moderation
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Amount of reactions used for report messages. Default: ${defaultValue}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>sissi-translations</artifactId>
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>customization-translations</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>moderation-customization-translations</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>module-translations</module>
|
<module>module-translations</module>
|
||||||
|
<module>customization-translations</module>
|
||||||
|
<module>translation-overrides</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
||||||
|
<artifactId>translation-overrides</artifactId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>moderation-translation-overrides</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<finalName>moderation-translation-overrides-${project.version}</finalName>
|
||||||
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||||
|
<id>zip</id>
|
||||||
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<outputDirectory>.</outputDirectory>
|
||||||
|
<directory>${project.basedir}/src/main/resources</directory>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
</assembly>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
You were banned from the server ${serverName} for `${reason}`.
|
||||||
|
If you want to appeal, visit https://docs.google.com/forms/d/e/1FAIpQLSegsjW3OaHGZH_VZL6susvVPksLQ2jDWd3vzze6x9LyF4zdfg/viewform.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
♂️ Approved / Is ok, 📣 Mention it to user, 🤫 User mute,⚠️ User warn ,🔨 User ban
|
||||||
20
templates/sissi-translations/translation-overrides/pom.xml
Normal file
20
templates/sissi-translations/translation-overrides/pom.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations</groupId>
|
||||||
|
<artifactId>sissi-translations</artifactId>
|
||||||
|
<version>1.2.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>dev.sheldan.sissi.templates.translations.overrides</groupId>
|
||||||
|
<artifactId>translation-overrides</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>moderation-translation-overrides</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -13,7 +13,7 @@ db_database = os.getenv('DB_NAME')
|
|||||||
db_user = os.getenv('DB_USER')
|
db_user = os.getenv('DB_USER')
|
||||||
db_password = os.getenv('DB_PASS')
|
db_password = os.getenv('DB_PASS')
|
||||||
engine = db.create_engine('postgresql://%s:%s@%s:%s/%s' % (db_user, db_password, db_host, db_port, db_database))
|
engine = db.create_engine('postgresql://%s:%s@%s:%s/%s' % (db_user, db_password, db_host, db_port, db_database))
|
||||||
|
1
|
||||||
with engine.connect() as con:
|
with engine.connect() as con:
|
||||||
with con.begin():
|
with con.begin():
|
||||||
create_users(server_id, all_quotes, con)
|
create_users(server_id, all_quotes, con)
|
||||||
|
|||||||
11
tools/warn-migration/dto.py
Normal file
11
tools/warn-migration/dto.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
class LegacyWarning:
|
||||||
|
level = 0
|
||||||
|
reason = ''
|
||||||
|
author_id = 0
|
||||||
|
user_id = 0
|
||||||
|
date = 0
|
||||||
|
duration = 0
|
||||||
|
until = 0
|
||||||
|
mod_log_message_id = 0
|
||||||
|
mod_log_channel_id = 0
|
||||||
|
|
||||||
32
tools/warn-migration/legacy_loader.py
Normal file
32
tools/warn-migration/legacy_loader.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import json
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from dto import LegacyWarning
|
||||||
|
|
||||||
|
|
||||||
|
def load_all_warnings():
|
||||||
|
with open('settings.json') as warnings:
|
||||||
|
lines = warnings.read()
|
||||||
|
warnings_obj = json.loads(lines)
|
||||||
|
warned_users = warnings_obj['260']['MODLOGS']['297910194841583616']
|
||||||
|
all_warning_dtos = []
|
||||||
|
for user in warned_users:
|
||||||
|
warnings = warned_users[user]['x']
|
||||||
|
for warning in warnings:
|
||||||
|
warning_dto = LegacyWarning()
|
||||||
|
warning_dto.level = warning['level']
|
||||||
|
warning_dto.author_id = warning['author']
|
||||||
|
warning_dto.reason = warning['reason']
|
||||||
|
if 'duration' in warning and warning['duration'] is not None:
|
||||||
|
warning_dto.duration = int(float(warning['duration']))
|
||||||
|
if 'until' in warning:
|
||||||
|
warning_dto.until = warning['until']
|
||||||
|
warning_dto.date = datetime.fromtimestamp(int(warning['time']))
|
||||||
|
warning_dto.user_id = user
|
||||||
|
if 'modlog_message' in warning:
|
||||||
|
warning_dto.mod_log_channel_id = warning['modlog_message']['channel_id']
|
||||||
|
warning_dto.mod_log_message_id = warning['modlog_message']['message_id']
|
||||||
|
all_warning_dtos.append(warning_dto)
|
||||||
|
print(f'loaded {len(all_warning_dtos)} warnings.')
|
||||||
|
return all_warning_dtos
|
||||||
|
|
||||||
20
tools/warn-migration/main.py
Normal file
20
tools/warn-migration/main.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import os
|
||||||
|
import sqlalchemy as db
|
||||||
|
|
||||||
|
from legacy_loader import load_all_warnings
|
||||||
|
from warning_importer import import_warnings
|
||||||
|
|
||||||
|
server_id = os.getenv('SERVER_ID')
|
||||||
|
|
||||||
|
all_warnings = load_all_warnings()
|
||||||
|
db_host = os.getenv('DB_HOST')
|
||||||
|
db_port = os.getenv('DB_PORT')
|
||||||
|
db_database = os.getenv('DB_NAME')
|
||||||
|
db_user = os.getenv('DB_USER')
|
||||||
|
db_password = os.getenv('DB_PASS')
|
||||||
|
|
||||||
|
engine = db.create_engine('postgresql://%s:%s@%s:%s/%s' % (db_user, db_password, db_host, db_port, db_database))
|
||||||
|
|
||||||
|
with engine.connect() as con:
|
||||||
|
with con.begin():
|
||||||
|
import_warnings(server_id, all_warnings, con)
|
||||||
147
tools/warn-migration/warning_importer.py
Normal file
147
tools/warn-migration/warning_importer.py
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from sqlalchemy.sql import text
|
||||||
|
|
||||||
|
from dto import LegacyWarning
|
||||||
|
|
||||||
|
|
||||||
|
def import_warnings(server_id, warnings, connection):
|
||||||
|
user_ids = [warn.user_id for warn in warnings]
|
||||||
|
user_ids.extend([warn.author_id for warn in warnings])
|
||||||
|
create_users(server_id, user_ids, connection)
|
||||||
|
channel_ids = [warn.mod_log_channel_id for warn in warnings if warn.mod_log_channel_id is not None]
|
||||||
|
create_channels(server_id, channel_ids, connection)
|
||||||
|
warning_id = 0
|
||||||
|
mute_id = 0
|
||||||
|
for warning in warnings:
|
||||||
|
if warning.level == 5 or warning.level == 4:
|
||||||
|
import_ban(server_id, warning, connection)
|
||||||
|
if warning.level == 1:
|
||||||
|
warning_id += 1
|
||||||
|
import_warning(server_id, warning, connection, warning_id)
|
||||||
|
if warning.level == 2:
|
||||||
|
mute_id += 1
|
||||||
|
import_mute(server_id, warning, connection, mute_id)
|
||||||
|
if warning.level == 3:
|
||||||
|
import_kick(server_id, warning, connection)
|
||||||
|
connection.execute(f"INSERT INTO counter(counter, server_id, counter_key) VALUES ({warning_id}, {server_id}, 'WARNINGS')")
|
||||||
|
connection.execute(f"INSERT INTO counter(counter, server_id, counter_key) VALUES ({mute_id}, {server_id}, 'MUTES')")
|
||||||
|
|
||||||
|
|
||||||
|
def import_mute(server_id, warning: LegacyWarning, connection, mute_id):
|
||||||
|
statement = text("""INSERT INTO infraction(server_id, infraction_user_in_server_id, infraction_creator_user_in_server_id,
|
||||||
|
description, type, created, points, decayed)
|
||||||
|
VALUES(:server_id,
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :muted_user_id and server_id = :server_id),
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :author_id and server_id = :server_id),
|
||||||
|
:text, 'mute', :created, :points, false) returning id""")
|
||||||
|
infraction_id = connection.execute(statement, {'server_id': server_id, 'author_id': warning.author_id, 'muted_user_id': warning.user_id,
|
||||||
|
'text': warning.reason if warning.reason is not None else 'No reason provided', 'created': warning.date, 'points': 20}).fetchone()[0]
|
||||||
|
|
||||||
|
statement = text("""INSERT INTO infraction_parameter(key, value, infraction_id, created)
|
||||||
|
VALUES(:key, :value, :infraction_id, :created)""")
|
||||||
|
if warning.duration is not None:
|
||||||
|
duration = str(int(warning.duration / 60)) + 'm' if warning.duration < 60 * 60 else str(int(warning.duration / 60 / 60)) + 'h'
|
||||||
|
duration = duration if warning.duration < 60 * 60 * 24 else str(int(warning.duration / 60 / 60 / 24)) + 'd'
|
||||||
|
else:
|
||||||
|
duration = '0s'
|
||||||
|
connection.execute(statement, {'key': 'DURATION', 'value': duration, 'infraction_id': infraction_id, 'created': warning.date})
|
||||||
|
|
||||||
|
print(f'Creating infraction for mute for {warning.user_id}')
|
||||||
|
statement = text("""INSERT INTO mute(id, server_id, muted_user_in_server_id, muting_user_in_server_id,
|
||||||
|
reason, mute_date, target_date, mute_ended, created, infraction_id)
|
||||||
|
VALUES(:mute_id, :server_id,
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :warned_user_id and server_id = :server_id),
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :author_id and server_id = :server_id),
|
||||||
|
:text, :created, :target_date, true, :created, :infraction_id)""")
|
||||||
|
connection.execute(statement, {'mute_id': mute_id, 'server_id': server_id, 'author_id': warning.author_id, 'warned_user_id': warning.user_id,
|
||||||
|
'text': warning.reason if warning.reason is not None else 'No reason provided', 'created': warning.date, 'infraction_id': infraction_id,
|
||||||
|
'target_date': warning.date + timedelta(seconds=warning.duration)})
|
||||||
|
print(f'Creating warning for {warning.user_id}')
|
||||||
|
|
||||||
|
def import_warning(server_id, warning: LegacyWarning, connection, warning_id):
|
||||||
|
statement = text("""INSERT INTO infraction(server_id, infraction_user_in_server_id, infraction_creator_user_in_server_id,
|
||||||
|
description, type, created, points, decayed)
|
||||||
|
VALUES(:server_id,
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :warned_user_id and server_id = :server_id),
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :author_id and server_id = :server_id),
|
||||||
|
:text, 'warn', :created, :points, false) returning id""")
|
||||||
|
infraction_id = connection.execute(statement, {'server_id': server_id, 'author_id': warning.author_id, 'warned_user_id': warning.user_id,
|
||||||
|
'text': warning.reason if warning.reason is not None else 'No reason provided', 'created': warning.date, 'points': 10}).fetchone()[0]
|
||||||
|
print(f'Creating infraction for warning for {warning.user_id}')
|
||||||
|
statement = text("""INSERT INTO warning(id, server_id, warned_user_in_server_id, warning_user_in_server_id,
|
||||||
|
reason, warn_date, created, decayed, infraction_id)
|
||||||
|
VALUES(:warn_id, :server_id,
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :warned_user_id and server_id = :server_id),
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :author_id and server_id = :server_id),
|
||||||
|
:text, :created, :created, false, :infraction_id)""")
|
||||||
|
connection.execute(statement, {'warn_id': warning_id, 'server_id': server_id, 'author_id': warning.author_id, 'warned_user_id': warning.user_id,
|
||||||
|
'text': warning.reason if warning.reason is not None else 'No reason provided', 'created': warning.date, 'infraction_id': infraction_id})
|
||||||
|
print(f'Creating warning for {warning.user_id}')
|
||||||
|
|
||||||
|
|
||||||
|
def import_ban(server_id, warning: LegacyWarning, connection):
|
||||||
|
statement = text("""INSERT INTO infraction(server_id, infraction_user_in_server_id, infraction_creator_user_in_server_id,
|
||||||
|
description, type, created, points, decayed)
|
||||||
|
VALUES(:server_id,
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :banned_user_id and server_id = :server_id),
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :author_id and server_id = :server_id),
|
||||||
|
:text, 'ban', :created, :points, false)""")
|
||||||
|
connection.execute(statement, {'server_id': server_id, 'author_id': warning.author_id, 'banned_user_id': warning.user_id,
|
||||||
|
'text': warning.reason if warning.reason is not None else 'No reason provided', 'created': warning.date, 'points': 150})
|
||||||
|
print(f'Creating ban for {warning.user_id}')
|
||||||
|
|
||||||
|
|
||||||
|
def import_kick(server_id, warning: LegacyWarning, connection):
|
||||||
|
statement = text("""INSERT INTO infraction(server_id, infraction_user_in_server_id, infraction_creator_user_in_server_id,
|
||||||
|
description, type, created, points, decayed)
|
||||||
|
VALUES(:server_id,
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :kicked_user_id and server_id = :server_id),
|
||||||
|
(select user_in_server_id from user_in_server where user_id = :author_id and server_id = :server_id),
|
||||||
|
:text, 'kick', :created, :points, false)""")
|
||||||
|
connection.execute(statement, {'server_id': server_id, 'author_id': warning.author_id, 'kicked_user_id': warning.user_id,
|
||||||
|
'text': warning.reason if warning.reason is not None else 'No reason provided', 'created': warning.date, 'points': 50})
|
||||||
|
print(f'Creating kick for {warning.user_id}')
|
||||||
|
|
||||||
|
|
||||||
|
def create_users(server_id: int, user_ids, con):
|
||||||
|
created_users = {}
|
||||||
|
for user_id in user_ids:
|
||||||
|
if not does_user_exist(user_id, con) and user_id not in created_users:
|
||||||
|
create_user(user_id, con)
|
||||||
|
create_user_in_server(user_id, server_id, con)
|
||||||
|
created_users[user_id] = 1
|
||||||
|
|
||||||
|
|
||||||
|
def does_user_exist(user_id, con):
|
||||||
|
statement = text("""SELECT count(1) FROM auser where id = :id""")
|
||||||
|
return con.execute(statement, {'id': user_id}).fetchone()[0] == 1
|
||||||
|
|
||||||
|
|
||||||
|
def create_user(user_id, con):
|
||||||
|
statement = text("""INSERT INTO auser(id) VALUES(:id)""")
|
||||||
|
print(f'Creating user {user_id}')
|
||||||
|
con.execute(statement, {'id': user_id})
|
||||||
|
|
||||||
|
|
||||||
|
def create_channels(server_id: int, channel_ids, con):
|
||||||
|
channels_to_create = {}
|
||||||
|
for channel_id in channel_ids:
|
||||||
|
if not does_channel_exist(channel_id, con):
|
||||||
|
channels_to_create[channel_id] = 1
|
||||||
|
for channel_id in channels_to_create:
|
||||||
|
create_channel(channel_id, server_id, con)
|
||||||
|
|
||||||
|
def does_channel_exist(channel_id, con):
|
||||||
|
statement = text("""SELECT count(1) FROM channel where id = :id""")
|
||||||
|
return con.execute(statement, {'id': channel_id}).fetchone()[0] == 1
|
||||||
|
|
||||||
|
def create_channel(channel_id, server_id, con):
|
||||||
|
statement = text("""INSERT INTO channel(id, server_id, type, deleted) VALUES(:id, :server_id, 'TEXT', false)""")
|
||||||
|
print(f'Creating channel {channel_id}')
|
||||||
|
con.execute(statement, {'id': channel_id, 'server_id': server_id})
|
||||||
|
|
||||||
|
|
||||||
|
def create_user_in_server(user_id, server_id, con):
|
||||||
|
statement = text("""INSERT INTO user_in_server(server_id, user_id) VALUES(:server_id, :user_id) returning user_in_server_id""")
|
||||||
|
return con.execute(statement, {'user_id': user_id, 'server_id': server_id}).fetchone()[0]
|
||||||
Reference in New Issue
Block a user