mirror of
https://github.com/Sheldan/OnePlusBot.git
synced 2026-01-21 15:25:51 +00:00
Compare commits
41 Commits
oneplusbot
...
oneplusbot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1437373ff | ||
|
|
1e2ab7fbfa | ||
|
|
b3b16d0e74 | ||
|
|
d3d79e8803 | ||
|
|
bf448e167a | ||
|
|
1a135a9bb8 | ||
|
|
fa5abaaed4 | ||
|
|
2d98cbba81 | ||
|
|
f7502c76de | ||
|
|
7c2b627fc9 | ||
|
|
0419c70e49 | ||
|
|
7777e4f1f0 | ||
|
|
02fd4af0f4 | ||
|
|
4778bca1ac | ||
|
|
c14dc1a0a5 | ||
|
|
a34cf8ab4a | ||
|
|
9a9c6fca2d | ||
|
|
e236522328 | ||
|
|
67ae9702fd | ||
|
|
798d7bc894 | ||
|
|
91bef88ab8 | ||
|
|
e57d82dbe2 | ||
|
|
8de138550c | ||
|
|
a8ad582aec | ||
|
|
f2055d8c52 | ||
|
|
58f92293a4 | ||
|
|
2e3afbc77d | ||
|
|
aee9186031 | ||
|
|
a5a598fc25 | ||
|
|
c4e5e7a7c3 | ||
|
|
3dc9f45dde | ||
|
|
9f773abd7e | ||
|
|
bf55064984 | ||
|
|
d860ad6291 | ||
|
|
d563950bee | ||
|
|
79bd338f45 | ||
|
|
0bb14e0657 | ||
|
|
d71faa9749 | ||
|
|
e251b12dff | ||
|
|
4efb2470f8 | ||
|
|
77065f2374 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -34,5 +34,5 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
REGISTRY_PREFIX: docker.pkg.github.com/sheldan/oneplusbot/
|
REGISTRY_PREFIX: docker.pkg.github.com/sheldan/oneplusbot/
|
||||||
VERSION: ${{ env.version }}
|
VERSION: ${{ env.version }}
|
||||||
ABSTRACTO_VERSION: 1.2.7
|
ABSTRACTO_VERSION: 1.2.14
|
||||||
ABSTRACTO_REGISTRY_PREFIX: docker.pkg.github.com/sheldan/abstracto/
|
ABSTRACTO_REGISTRY_PREFIX: docker.pkg.github.com/sheldan/abstracto/
|
||||||
@@ -7,5 +7,5 @@ The migration of the existing data from the database is handled via one time mig
|
|||||||
|
|
||||||
Custom features which were ported
|
Custom features which were ported
|
||||||
- [ ] FAQ
|
- [ ] FAQ
|
||||||
- [ ] Setup channel handling
|
- [x] Setup channel handling
|
||||||
- [ ] Referral link handling
|
- [x] Referral link handling
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||||
<artifactId>application</artifactId>
|
<artifactId>application</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>executable</artifactId>
|
<artifactId>executable</artifactId>
|
||||||
@@ -85,17 +85,70 @@
|
|||||||
<artifactId>webservices-impl</artifactId>
|
<artifactId>webservices-impl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>remind-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>suggestion-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>starboard-impl</artifactId>
|
<artifactId>starboard-impl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>logging-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>invite-filter-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>statistic-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>profanity-filter-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>experience-tracking-impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||||
<artifactId>starboard-custom</artifactId>
|
<artifactId>starboard-custom</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>news</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>setup</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>referral</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||||
<artifactId>application</artifactId>
|
<artifactId>application</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||||
<artifactId>oneplus-bot-customizations</artifactId>
|
<artifactId>oneplus-bot-customizations</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../dbchangelog-3.8.xsd
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/dbchangelog-ext ../dbchangelog-3.8.xsd
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/pro ../dbchangelog-3.8.xsd" >
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
<include file="starboard-custom-seedData/data.xml" relativeToChangelogFile="true"/>
|
<include file="starboard-custom-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../dbchangelog-3.8.xsd
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
<include file="feature.xml" relativeToChangelogFile="true"/>
|
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog ../../dbchangelog-3.8.xsd
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/dbchangelog-ext ../../dbchangelog-3.8.xsd
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
<changeSet author="Sheldan" id="starboard_custom_feature-insertion">
|
<changeSet author="Sheldan" id="starboard_custom_feature-insertion">
|
||||||
<insert tableName="feature">
|
<insert tableName="feature">
|
||||||
<column name="key" value="starboardNotification"/>
|
<column name="key" value="starboardNotification"/>
|
||||||
|
|||||||
@@ -257,6 +257,7 @@
|
|||||||
<xsd:attributeGroup name="changeLogAttributes">
|
<xsd:attributeGroup name="changeLogAttributes">
|
||||||
<xsd:attribute name="logicalFilePath" type="xsd:string"/>
|
<xsd:attribute name="logicalFilePath" type="xsd:string"/>
|
||||||
<xsd:attribute name="context" type="xsd:string"/>
|
<xsd:attribute name="context" type="xsd:string"/>
|
||||||
|
<xsd:attribute name="changeLogId" type="xsd:string"/>
|
||||||
<xsd:attribute name="objectQuotingStrategy" type="objectQuotingStrategy" default="LEGACY"/>
|
<xsd:attribute name="objectQuotingStrategy" type="objectQuotingStrategy" default="LEGACY"/>
|
||||||
</xsd:attributeGroup>
|
</xsd:attributeGroup>
|
||||||
|
|
||||||
@@ -277,11 +278,12 @@
|
|||||||
<xsd:attribute name="created" type="xsd:string"/>
|
<xsd:attribute name="created" type="xsd:string"/>
|
||||||
<xsd:attribute name="runOrder" type="xsd:string"/>
|
<xsd:attribute name="runOrder" type="xsd:string"/>
|
||||||
<xsd:attribute name="ignore" type="booleanExp"/>
|
<xsd:attribute name="ignore" type="booleanExp"/>
|
||||||
|
<xsd:attribute name="runWith" type="xsd:string" />
|
||||||
</xsd:attributeGroup>
|
</xsd:attributeGroup>
|
||||||
|
|
||||||
<!-- Attributes for changes -->
|
<!-- Attributes for changes -->
|
||||||
<xsd:attributeGroup name="changeAttributes">
|
<xsd:attributeGroup name="changeAttributes">
|
||||||
<xsd:anyAttribute namespace="##any" processContents="lax"/>
|
<xsd:anyAttribute namespace="##other" processContents="lax"/>
|
||||||
</xsd:attributeGroup>
|
</xsd:attributeGroup>
|
||||||
|
|
||||||
<!-- Attributes for constraints -->
|
<!-- Attributes for constraints -->
|
||||||
@@ -306,7 +308,7 @@
|
|||||||
<xsd:attribute name="validateNullable" type="booleanExp"/>
|
<xsd:attribute name="validateNullable" type="booleanExp"/>
|
||||||
<xsd:attribute name="validateUnique" type="booleanExp"/>
|
<xsd:attribute name="validateUnique" type="booleanExp"/>
|
||||||
<xsd:attribute name="validatePrimaryKey" type="booleanExp"/>
|
<xsd:attribute name="validatePrimaryKey" type="booleanExp"/>
|
||||||
<xsd:attribute name="validateForeignKey " type="booleanExp"/>
|
<xsd:attribute name="validateForeignKey" type="booleanExp"/>
|
||||||
</xsd:attributeGroup>
|
</xsd:attributeGroup>
|
||||||
|
|
||||||
<xsd:attributeGroup name="column">
|
<xsd:attributeGroup name="column">
|
||||||
@@ -420,9 +422,10 @@
|
|||||||
<xsd:attribute name="incrementBy" type="xsd:string"/>
|
<xsd:attribute name="incrementBy" type="xsd:string"/>
|
||||||
<xsd:attribute name="maxValue" type="xsd:string"/>
|
<xsd:attribute name="maxValue" type="xsd:string"/>
|
||||||
<xsd:attribute name="minValue" type="xsd:string"/>
|
<xsd:attribute name="minValue" type="xsd:string"/>
|
||||||
<xsd:attribute name="ordered" type="booleanExp"/>
|
<xsd:attribute name="ordered" type="xsd:string"/>
|
||||||
<xsd:attribute name="cacheSize" type="xsd:string"/>
|
<xsd:attribute name="cacheSize" type="xsd:string"/>
|
||||||
<xsd:attribute name="cycle" type="booleanExp">
|
<xsd:attribute name="dataType" type="xsd:string" />
|
||||||
|
<xsd:attribute name="cycle" type="xsd:string">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
true for a cycling sequence, false for a non-cycling sequence.
|
true for a cycling sequence, false for a non-cycling sequence.
|
||||||
@@ -481,11 +484,15 @@
|
|||||||
<xsd:attributeGroup ref="changeAttributes"/>
|
<xsd:attributeGroup ref="changeAttributes"/>
|
||||||
<xsd:attributeGroup ref="tableNameAttribute"/>
|
<xsd:attributeGroup ref="tableNameAttribute"/>
|
||||||
<xsd:attribute name="constraintName" type="xsd:string"/>
|
<xsd:attribute name="constraintName" type="xsd:string"/>
|
||||||
|
<xsd:attribute name="dropIndex" type="booleanExp"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<xsd:element name="addUniqueConstraint">
|
<xsd:element name="addUniqueConstraint">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
|
||||||
|
</xsd:choice>
|
||||||
<xsd:attributeGroup ref="changeAttributes"/>
|
<xsd:attributeGroup ref="changeAttributes"/>
|
||||||
<xsd:attributeGroup ref="tableNameAttribute"/>
|
<xsd:attributeGroup ref="tableNameAttribute"/>
|
||||||
<xsd:attribute name="columnNames" type="xsd:string"
|
<xsd:attribute name="columnNames" type="xsd:string"
|
||||||
@@ -616,6 +623,7 @@
|
|||||||
<xsd:attribute name="header" type="xsd:string"/>
|
<xsd:attribute name="header" type="xsd:string"/>
|
||||||
<xsd:attribute name="name" type="xsd:string"/>
|
<xsd:attribute name="name" type="xsd:string"/>
|
||||||
<xsd:attribute name="type" type="xsd:string"/>
|
<xsd:attribute name="type" type="xsd:string"/>
|
||||||
|
<xsd:attribute name="allowUpdate" type="booleanExp"/>
|
||||||
<xsd:attribute name="defaultValue" type="xsd:string"/>
|
<xsd:attribute name="defaultValue" type="xsd:string"/>
|
||||||
<xsd:attribute name="defaultValueNumeric" type="xsd:string"/>
|
<xsd:attribute name="defaultValueNumeric" type="xsd:string"/>
|
||||||
<xsd:attribute name="defaultValueDate" type="xsd:string"/>
|
<xsd:attribute name="defaultValueDate" type="xsd:string"/>
|
||||||
@@ -919,6 +927,7 @@
|
|||||||
<xsd:attribute name="schemaName" type="xsd:string"/>
|
<xsd:attribute name="schemaName" type="xsd:string"/>
|
||||||
<xsd:attribute name="tableName" type="xsd:string" use="required"/>
|
<xsd:attribute name="tableName" type="xsd:string" use="required"/>
|
||||||
<xsd:attribute name="columnName" type="xsd:string" use="required"/>
|
<xsd:attribute name="columnName" type="xsd:string" use="required"/>
|
||||||
|
<xsd:attribute name="columnDataType" type="xsd:string"/>
|
||||||
<xsd:attribute name="remarks" type="xsd:string"/>
|
<xsd:attribute name="remarks" type="xsd:string"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
@@ -957,6 +966,7 @@
|
|||||||
<xsd:attributeGroup ref="tableNameAttribute"/>
|
<xsd:attributeGroup ref="tableNameAttribute"/>
|
||||||
<xsd:attribute name="tablespace" type="xsd:string"/>
|
<xsd:attribute name="tablespace" type="xsd:string"/>
|
||||||
<xsd:attribute name="remarks" type="xsd:string"/>
|
<xsd:attribute name="remarks" type="xsd:string"/>
|
||||||
|
<xsd:anyAttribute namespace="##other" processContents="lax"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
@@ -1124,7 +1134,7 @@
|
|||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:attributeGroup ref="changeAttributes"/>
|
<xsd:attributeGroup ref="changeAttributes"/>
|
||||||
<xsd:attribute name="tag" type="xsd:string" use="required"/>
|
<xsd:attribute name="tag" type="xsd:string" use="required"/>
|
||||||
|
<xsd:anyAttribute namespace="##other" processContents="lax"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
@@ -1226,7 +1236,6 @@
|
|||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:attributeGroup ref="changeAttributes"/>
|
<xsd:attributeGroup ref="changeAttributes"/>
|
||||||
<xsd:attributeGroup ref="sequenceAttributes"/>
|
<xsd:attributeGroup ref="sequenceAttributes"/>
|
||||||
<xsd:attribute name="dataType" type="xsd:string"/>
|
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
@@ -1283,7 +1292,7 @@
|
|||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attributeGroup ref="changeAttributes"/>
|
<xsd:attributeGroup ref="changeAttributes"/>
|
||||||
<xsd:attribute name="class" type="xsd:string" use="required"/>
|
<xsd:attribute name="class" type="xsd:string" use="required"/>
|
||||||
|
<xsd:anyAttribute processContents="lax" />
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
@@ -1374,4 +1383,4 @@
|
|||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
|
|
||||||
</xsd:group>
|
</xsd:group>
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog-3.8.xsd
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog-3.8.xsd
|
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||||
http://www.liquibase.org/xml/ns/pro dbchangelog-3.8.xsd" >
|
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||||
<include file="1.0-starboard-custom/collection.xml" relativeToChangelogFile="true"/>
|
<include file="1.0-starboard-custom/collection.xml" relativeToChangelogFile="true"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
39
application/oneplus-bot-modules/news/pom.xml
Normal file
39
application/oneplus-bot-modules/news/pom.xml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?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.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>oneplus-bot-modules</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>news</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<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,56 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.commands;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.config.NewsFeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.config.NewsModuleDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.NewsServiceBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class News extends AbstractConditionableCommand {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsServiceBean newsServiceBean;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||||
|
String text = (String) commandContext.getParameters().getParameters().get(0);
|
||||||
|
// workaround for Discord formatting issue
|
||||||
|
text = text.replace("\n >", "\n>");
|
||||||
|
return newsServiceBean.sendNewsPost(text, commandContext.getMessage())
|
||||||
|
.thenApply(unused -> CommandResult.fromSuccess());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandConfiguration getConfiguration() {
|
||||||
|
Parameter newsText = Parameter.builder().name("text").type(String.class).remainder(true).templated(true).build();
|
||||||
|
List<Parameter> parameters = Arrays.asList(newsText);
|
||||||
|
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
||||||
|
return CommandConfiguration.builder()
|
||||||
|
.name("news")
|
||||||
|
.module(NewsModuleDefinition.NEWS)
|
||||||
|
.parameters(parameters)
|
||||||
|
.supportsEmbedException(true)
|
||||||
|
.async(true)
|
||||||
|
.help(helpInfo)
|
||||||
|
.templated(true)
|
||||||
|
.causesReaction(true)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return NewsFeatureDefinition.NEWS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.commands;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||||
|
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||||
|
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.config.NewsFeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.config.NewsModuleDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.NewsServiceBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class UpdateNews extends AbstractConditionableCommand {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsServiceBean newsServiceBean;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||||
|
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||||
|
Long messageId = (Long) parameters.get(0);
|
||||||
|
String postText = (String) parameters.get(1);
|
||||||
|
// workaround for Discord formatting issue
|
||||||
|
postText = postText.replace("\n >", "\n>");
|
||||||
|
return newsServiceBean.updateNewsPostViaId(messageId, postText, commandContext.getMessage())
|
||||||
|
.thenApply(unused -> CommandResult.fromSuccess());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandConfiguration getConfiguration() {
|
||||||
|
Parameter newsPostId = Parameter.builder().name("newsPostId").type(Long.class).templated(true).build();
|
||||||
|
Parameter newsText = Parameter.builder().name("text").type(String.class).remainder(true).templated(true).build();
|
||||||
|
List<Parameter> parameters = Arrays.asList(newsPostId, newsText);
|
||||||
|
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
||||||
|
return CommandConfiguration.builder()
|
||||||
|
.name("updateNews")
|
||||||
|
.module(NewsModuleDefinition.NEWS)
|
||||||
|
.parameters(parameters)
|
||||||
|
.supportsEmbedException(true)
|
||||||
|
.async(true)
|
||||||
|
.help(helpInfo)
|
||||||
|
.templated(true)
|
||||||
|
.causesReaction(true)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return NewsFeatureDefinition.NEWS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class NewsFeature implements FeatureConfig {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return NewsFeatureDefinition.NEWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||||
|
return Arrays.asList(NewsPostTarget.NEWS_TARGET);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum NewsFeatureDefinition implements FeatureDefinition {
|
||||||
|
NEWS("news");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
NewsFeatureDefinition(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.command.config.ModuleDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.command.config.ModuleInfo;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class NewsModuleDefinition implements ModuleDefinition {
|
||||||
|
|
||||||
|
public static final String NEWS = "newsModule";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModuleInfo getInfo() {
|
||||||
|
return ModuleInfo.builder().name(NEWS).templated(true).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getParentModule() {
|
||||||
|
return "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum NewsPostTarget implements PostTargetEnum {
|
||||||
|
NEWS_TARGET("news");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
NewsPostTarget(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@PropertySource("classpath:news.properties")
|
||||||
|
public class NewsProperties {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.exception;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||||
|
import dev.sheldan.abstracto.core.templating.Templatable;
|
||||||
|
|
||||||
|
public class NewsPostLockedException extends AbstractoRunTimeException implements Templatable {
|
||||||
|
@Override
|
||||||
|
public String getTemplateName() {
|
||||||
|
return "news_post_locked_exception";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getTemplateModel() {
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.exception;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||||
|
import dev.sheldan.abstracto.core.templating.Templatable;
|
||||||
|
|
||||||
|
public class NewsPostNotFoundException extends AbstractoRunTimeException implements Templatable {
|
||||||
|
@Override
|
||||||
|
public String getTemplateName() {
|
||||||
|
return "news_post_not_found_exception";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getTemplateModel() {
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.job;
|
||||||
|
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.NewsServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.quartz.DisallowConcurrentExecution;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.quartz.PersistJobDataAfterExecution;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
@Component
|
||||||
|
@PersistJobDataAfterExecution
|
||||||
|
public class NewsPostCleanupJob extends QuartzJobBean {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsServiceBean newsServiceBean;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
try {
|
||||||
|
log.info("Executing news post cleanup job.");
|
||||||
|
newsServiceBean.cleanUpNewsPosts();
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.error("Failed to execute news post cleanup job.", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.job;
|
||||||
|
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.NewsServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.quartz.DisallowConcurrentExecution;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.quartz.PersistJobDataAfterExecution;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
@Component
|
||||||
|
@PersistJobDataAfterExecution
|
||||||
|
public class NewsPostLockingJob extends QuartzJobBean {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsServiceBean newsServiceBean;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
|
try {
|
||||||
|
log.info("Executing news post lock job.");
|
||||||
|
newsServiceBean.lockNewsPosts();
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.error("Failed to execute news post lock job.", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.listener;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
|
import dev.sheldan.abstracto.core.listener.async.jda.AsyncMessageUpdatedListener;
|
||||||
|
import dev.sheldan.abstracto.core.models.listener.MessageUpdatedModel;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.config.NewsFeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsPost;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.NewsServiceBean;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.management.NewsPostManagementServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class NewsMessageSourceMessageUpdatedListener implements AsyncMessageUpdatedListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsPostManagementServiceBean newsPostManagementServiceBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsServiceBean newsServiceBean;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultListenerResult execute(MessageUpdatedModel model) {
|
||||||
|
Optional<NewsPost> existingPostOptional = newsPostManagementServiceBean.getNewsPostForSourceMessage(model.getAfter().getIdLong());
|
||||||
|
if(existingPostOptional.isPresent()) {
|
||||||
|
NewsPost newsPost = existingPostOptional.get();
|
||||||
|
if(!newsPost.isLocked()) {
|
||||||
|
newsServiceBean.updateNewsPost(newsPost, model.getAfter());
|
||||||
|
return DefaultListenerResult.PROCESSED;
|
||||||
|
} else {
|
||||||
|
log.info("Not updating news post {}, because it is locked.", newsPost.getSourceMessageId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return NewsFeatureDefinition.NEWS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.model;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
public class NewsMessageModel {
|
||||||
|
private String messageText;
|
||||||
|
private Message message;
|
||||||
|
private Member author;
|
||||||
|
private Role newsRole;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.model.database;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table(name = "news_post")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class NewsPost {
|
||||||
|
@Id
|
||||||
|
@Column(name = "source_message_id")
|
||||||
|
private Long sourceMessageId;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "server_id", nullable = false)
|
||||||
|
private AServer server;
|
||||||
|
|
||||||
|
@Column(name = "news_message_id")
|
||||||
|
private Long newsMessageId;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "author_user_in_server_id", nullable = false)
|
||||||
|
private AUserInAServer author;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "source_channel_id", nullable = false)
|
||||||
|
private AChannel sourceChannel;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "news_channel_id", nullable = false)
|
||||||
|
private AChannel newsChannel;
|
||||||
|
|
||||||
|
@Column(name = "locked")
|
||||||
|
private boolean locked;
|
||||||
|
|
||||||
|
@Column(name = "created")
|
||||||
|
private Instant created;
|
||||||
|
|
||||||
|
@Column(name = "updated")
|
||||||
|
private Instant updated;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.repository;
|
||||||
|
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsPost;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface NewsPostRepository extends JpaRepository<NewsPost, Long> {
|
||||||
|
|
||||||
|
List<NewsPost> findByCreatedLessThanAndLockedFalse(Instant date);
|
||||||
|
List<NewsPost> findByUpdatedLessThanAndLockedTrue(Instant date);
|
||||||
|
Optional<NewsPost> findByNewsMessageId(Long newsMessageId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.service;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
|
import dev.sheldan.abstracto.core.service.PostTargetService;
|
||||||
|
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||||
|
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||||
|
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.config.NewsPostTarget;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.exception.NewsPostLockedException;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.model.NewsMessageModel;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsPost;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.service.management.NewsPostManagementServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.TextChannel;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class NewsServiceBean {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PostTargetService postTargetService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TemplateService templateService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsPostManagementServiceBean newsPostManagementServiceBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChannelService channelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsServiceBean self;
|
||||||
|
|
||||||
|
private static final String MESSAGE_TEMPLATE_KEY = "news_post";
|
||||||
|
|
||||||
|
@Value("${abstracto.feature.news.postLockSeconds}")
|
||||||
|
private Long postLockSeconds;
|
||||||
|
|
||||||
|
@Value("${abstracto.feature.news.removalDays}")
|
||||||
|
private Long removalDays;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void lockNewsPosts() {
|
||||||
|
Instant oldestDate = Instant.now().minus(postLockSeconds, ChronoUnit.SECONDS);
|
||||||
|
log.info("Locking news posts older than {}.", oldestDate);
|
||||||
|
List<NewsPost> oldPosts = newsPostManagementServiceBean.findNewsPostsOlderNotLocked(oldestDate);
|
||||||
|
log.info("Locking {} news posts.", oldPosts.size());
|
||||||
|
oldPosts.forEach(newsPost -> newsPost.setLocked(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void cleanUpNewsPosts() {
|
||||||
|
Instant oldestDate = Instant.now().minus(removalDays, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS);
|
||||||
|
log.info("Deleting news posts older than {}.", oldestDate);
|
||||||
|
List<NewsPost> oldPosts = newsPostManagementServiceBean.findNewsPostsUpdatedOlderThanAndLocked(oldestDate);
|
||||||
|
newsPostManagementServiceBean.deleteNewsPosts(oldPosts);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Message> sendNewsPost(String text, Message commandMessage) {
|
||||||
|
NewsMessageModel model = NewsMessageModel
|
||||||
|
.builder()
|
||||||
|
.messageText(text)
|
||||||
|
.message(commandMessage)
|
||||||
|
.author(commandMessage.getMember())
|
||||||
|
.build();
|
||||||
|
log.info("Sending new message post based on message {}.", commandMessage.getIdLong());
|
||||||
|
Long serverId = commandMessage.getGuild().getIdLong();
|
||||||
|
MessageToSend messageToSend = templateService.renderEmbedTemplate(MESSAGE_TEMPLATE_KEY, model, serverId);
|
||||||
|
List<CompletableFuture<Message>> messageFutures = postTargetService.sendEmbedInPostTarget(messageToSend, NewsPostTarget.NEWS_TARGET, serverId);
|
||||||
|
return FutureUtils.toSingleFutureGeneric(messageFutures)
|
||||||
|
.thenApply(unused -> {
|
||||||
|
Message createdMessage = messageFutures.get(0).join();
|
||||||
|
self.persistPost(commandMessage, createdMessage);
|
||||||
|
return createdMessage;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Void> updateNewsPostViaId(Long postId, String postText, Message updatedMessage) {
|
||||||
|
NewsPost post = newsPostManagementServiceBean.getNewsPostForNewsMessageId(postId);
|
||||||
|
if(post.isLocked()) {
|
||||||
|
throw new NewsPostLockedException();
|
||||||
|
}
|
||||||
|
return updateNewsPostMessage(post, updatedMessage, postText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Void> updateNewsPost(NewsPost newsPost, Message updatedMessage) {
|
||||||
|
String contentStripped = updatedMessage.getContentRaw();
|
||||||
|
String command = contentStripped.split(" ")[0];
|
||||||
|
String postText = updatedMessage.getContentRaw().replaceFirst(command, "");
|
||||||
|
return updateNewsPostMessage(newsPost, updatedMessage, postText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompletableFuture<Void> updateNewsPostMessage(NewsPost newsPost, Message updatedMessage, String postText) {
|
||||||
|
NewsMessageModel model = NewsMessageModel
|
||||||
|
.builder()
|
||||||
|
.messageText(postText)
|
||||||
|
.message(updatedMessage)
|
||||||
|
.author(updatedMessage.getMember())
|
||||||
|
.build();
|
||||||
|
Long serverId = updatedMessage.getGuild().getIdLong();
|
||||||
|
newsPost.setUpdated(Instant.now());
|
||||||
|
log.info("Updating news post {} with new content based on message from user {} in server {}.",
|
||||||
|
newsPost.getSourceMessageId(), updatedMessage.getIdLong(), updatedMessage.getGuild().getId());
|
||||||
|
MessageToSend messageToSend = templateService.renderEmbedTemplate(MESSAGE_TEMPLATE_KEY, model, serverId);
|
||||||
|
TextChannel newsChannel = channelService.getTextChannelFromServer(serverId, newsPost.getNewsChannel().getId());
|
||||||
|
return channelService.editMessageInAChannelFuture(messageToSend, newsChannel, newsPost.getNewsMessageId())
|
||||||
|
.thenApply(message -> null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void persistPost(Message commandMessage, Message createdMessage) {
|
||||||
|
log.info("Persisting news post with created message {} based on command message {}.", createdMessage.getIdLong(), commandMessage.getIdLong());
|
||||||
|
newsPostManagementServiceBean.createNewsPost(commandMessage, createdMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.news.service.management;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AChannel;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.exception.NewsPostNotFoundException;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsPost;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.news.repository.NewsPostRepository;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class NewsPostManagementServiceBean {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NewsPostRepository newsPostRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserInServerManagementService userInServerManagementService;
|
||||||
|
|
||||||
|
public NewsPost createNewsPost(Message commandMessage, Message createdMessage) {
|
||||||
|
AChannel sourceChannel = entityManager.getReference(AChannel.class, commandMessage.getChannel().getIdLong());
|
||||||
|
AChannel newsChannel = entityManager.getReference(AChannel.class, createdMessage.getChannel().getIdLong());
|
||||||
|
AUserInAServer author = userInServerManagementService.loadOrCreateUser(commandMessage.getMember());
|
||||||
|
NewsPost post = NewsPost
|
||||||
|
.builder()
|
||||||
|
.sourceChannel(sourceChannel)
|
||||||
|
.newsChannel(newsChannel)
|
||||||
|
.author(author)
|
||||||
|
.newsMessageId(createdMessage.getIdLong())
|
||||||
|
.sourceMessageId(commandMessage.getIdLong())
|
||||||
|
.server(author.getServerReference())
|
||||||
|
.locked(false)
|
||||||
|
.build();
|
||||||
|
log.debug("Created news post based on message {}.", createdMessage.getIdLong());
|
||||||
|
return newsPostRepository.save(post);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<NewsPost> getNewsPostForSourceMessage(Long sourceMessageId) {
|
||||||
|
return newsPostRepository.findById(sourceMessageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<NewsPost> getNewsPostForNewsMessageIdOptional(Long sourceMessageId) {
|
||||||
|
return newsPostRepository.findByNewsMessageId(sourceMessageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewsPost getNewsPostForNewsMessageId(Long sourceMessageId) {
|
||||||
|
return getNewsPostForNewsMessageIdOptional(sourceMessageId).orElseThrow(NewsPostNotFoundException::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NewsPost> findNewsPostsOlderNotLocked(Instant pointInTime) {
|
||||||
|
log.debug("Checking for not locked news posts older than {}", pointInTime);
|
||||||
|
return newsPostRepository.findByCreatedLessThanAndLockedFalse(pointInTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NewsPost> findNewsPostsUpdatedOlderThanAndLocked(Instant pointInTime) {
|
||||||
|
log.debug("Checking for not locked news posts updated older than {}.", pointInTime);
|
||||||
|
return newsPostRepository.findByUpdatedLessThanAndLockedTrue(pointInTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteNewsPosts(List<NewsPost> postsToDelete) {
|
||||||
|
log.info("Deleting {} news posts.", postsToDelete.size());
|
||||||
|
postsToDelete.forEach(newsPost -> log.info("Deleting news post {}", newsPost.getSourceMessageId()));
|
||||||
|
newsPostRepository.deleteAll(postsToDelete);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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="news-update/update.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?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="rename-news-module">
|
||||||
|
<update tableName="module">
|
||||||
|
<column name="name" value="newsModule" />
|
||||||
|
<where>name = 'news'</where>
|
||||||
|
</update>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -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="module.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="news-tables/tables.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="news-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?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" >
|
||||||
|
<property name="newsFeature" value="(SELECT id FROM feature WHERE key = 'news')"/>
|
||||||
|
<property name="newsModule" value="(SELECT id FROM module WHERE name = 'news')"/>
|
||||||
|
<changeSet author="Sheldan" id="news-commands" >
|
||||||
|
<insert tableName="command">
|
||||||
|
<column name="name" value="news"/>
|
||||||
|
<column name="module_id" valueComputed="${newsModule}"/>
|
||||||
|
<column name="feature_id" valueComputed="${newsFeature}"/>
|
||||||
|
</insert>
|
||||||
|
<insert tableName="command">
|
||||||
|
<column name="name" value="updateNews"/>
|
||||||
|
<column name="module_id" valueComputed="${newsModule}"/>
|
||||||
|
<column name="feature_id" valueComputed="${newsFeature}"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?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="module.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="news_jobs.xml" relativeToChangelogFile="true"/>
|
||||||
|
</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="news_feature-insertion">
|
||||||
|
<insert tableName="feature">
|
||||||
|
<column name="key" value="news"/>
|
||||||
|
</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="news-module-insertion">
|
||||||
|
<insert tableName="module">
|
||||||
|
<column name="name" value="news"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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="news-job-insert">
|
||||||
|
<insert tableName="scheduler_job">
|
||||||
|
<column name="name" value="newsLockJob"/>
|
||||||
|
<column name="group_name" value="news"/>
|
||||||
|
<column name="clazz" value="dev.sheldan.oneplus.bot.modules.news.job.NewsPostLockingJob"/>
|
||||||
|
<column name="active" value="true"/>
|
||||||
|
<column name="cron_expression" value="0 0 * * * ?"/>
|
||||||
|
<column name="recovery" value="false"/>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert tableName="scheduler_job">
|
||||||
|
<column name="name" value="newsCleanupJob"/>
|
||||||
|
<column name="group_name" value="news"/>
|
||||||
|
<column name="clazz" value="dev.sheldan.oneplus.bot.modules.news.job.NewsPostCleanupJob"/>
|
||||||
|
<column name="active" value="true"/>
|
||||||
|
<column name="cron_expression" value="0 0 0 * * ?"/>
|
||||||
|
<column name="recovery" value="false"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?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="news_post-table">
|
||||||
|
<createTable tableName="news_post">
|
||||||
|
<column name="source_message_id" type="BIGINT">
|
||||||
|
<constraints nullable="true" primaryKey="true" primaryKeyName="pk_news_post"/>
|
||||||
|
</column>
|
||||||
|
<column name="source_channel_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="news_channel_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="author_user_in_server_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="news_message_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="server_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="locked" type="boolean">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
|
</createTable>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="source_channel_id" baseTableName="news_post" constraintName="fk_news_post_source_channel"
|
||||||
|
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||||
|
referencedColumnNames="id" referencedTableName="channel" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="news_channel_id" baseTableName="news_post" constraintName="fk_news_channel"
|
||||||
|
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||||
|
referencedColumnNames="id" referencedTableName="channel" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="author_user_in_server_id" baseTableName="news_post" constraintName="fk_news_post_author"
|
||||||
|
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||||
|
referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="server_id" baseTableName="news_post" constraintName="fk_news_post_server"
|
||||||
|
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||||
|
referencedColumnNames="id" referencedTableName="server" validate="true"/>
|
||||||
|
|
||||||
|
|
||||||
|
<sql>
|
||||||
|
DROP TRIGGER IF EXISTS news_post_update_trigger ON news_post;
|
||||||
|
CREATE TRIGGER repost_check_channel_group_update_trigger BEFORE UPDATE ON news_post FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
|
||||||
|
</sql>
|
||||||
|
<sql>
|
||||||
|
DROP TRIGGER IF EXISTS news_post_insert_trigger ON news_post;
|
||||||
|
CREATE TRIGGER repost_check_channel_group_insert_trigger BEFORE INSERT ON news_post FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
|
||||||
|
</sql>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -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="news_post.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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="1.3.9-news/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="1.3.10-news/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
abstracto.postTargets.news.name=news
|
||||||
|
|
||||||
|
abstracto.featureFlags.news.featureName=news
|
||||||
|
abstracto.featureFlags.news.enabled=false
|
||||||
|
|
||||||
|
abstracto.feature.news.removalDays=4
|
||||||
|
abstracto.feature.news.postLockSeconds=3600
|
||||||
24
application/oneplus-bot-modules/pom.xml
Normal file
24
application/oneplus-bot-modules/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?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.oneplus.bot.application</groupId>
|
||||||
|
<artifactId>application</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>oneplus-bot-modules</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>news</module>
|
||||||
|
<module>setup</module>
|
||||||
|
<module>referral</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
||||||
39
application/oneplus-bot-modules/referral/pom.xml
Normal file
39
application/oneplus-bot-modules/referral/pom.xml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?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.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>oneplus-bot-modules</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>referral</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<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,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ReferralBeanConfig {
|
||||||
|
@Bean(value = "referralDelayExecutor")
|
||||||
|
public ScheduledExecutorService getDelayedExecutor() {
|
||||||
|
return Executors.newSingleThreadScheduledExecutor();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ReferralFeature implements FeatureConfig {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return ReferralFeatureDefinition.REFERRAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||||
|
return Arrays.asList(ReferralPostTarget.REFERRAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ReferralFeatureDefinition implements FeatureDefinition {
|
||||||
|
REFERRAL("referral");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
ReferralFeatureDefinition(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ReferralPostTarget implements PostTargetEnum {
|
||||||
|
REFERRAL("referral");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
ReferralPostTarget(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@PropertySource("classpath:referral.properties")
|
||||||
|
public class ReferralProperties {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.listener;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
|
import dev.sheldan.abstracto.core.listener.async.jda.AsyncMessageReceivedListener;
|
||||||
|
import dev.sheldan.abstracto.core.models.ServerUser;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.PostTarget;
|
||||||
|
import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
||||||
|
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||||
|
import dev.sheldan.abstracto.core.service.MessageService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.PostTargetManagement;
|
||||||
|
import dev.sheldan.abstracto.core.utils.CompletableFutureList;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.config.ReferralFeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.config.ReferralPostTarget;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.template.Referral;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.template.ReferralPostModel;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.template.ReferralTooRecentModel;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.service.ReferralServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ReferralListener implements AsyncMessageReceivedListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PostTargetManagement postTargetManagement;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageService messageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReferralServiceBean referralServiceBean;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChannelService channelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReferralListener self;
|
||||||
|
|
||||||
|
@Qualifier("referralDelayExecutor")
|
||||||
|
@Autowired
|
||||||
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Value("${oneplus.bot.referral.deleteDelaySeconds}")
|
||||||
|
private Long deleteDelaySeconds;
|
||||||
|
|
||||||
|
@Value("${oneplus.bot.referral.maxReferralCount}")
|
||||||
|
private Long maxReferralLinksPerPost;
|
||||||
|
|
||||||
|
private static final String NO_REFERRAL_LINK_FOUND_TEMPLATE_KEY = "referralListener_no_referral_link_found";
|
||||||
|
private static final String REFERRAL_POST_TOO_RECENT_TEMPLATE_KEY = "referralListener_too_recent_post";
|
||||||
|
private static final String REFERRAL_POST_EMBED_TEMPLATE_KEY = "referralListener_referral_post";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultListenerResult execute(MessageReceivedModel model) {
|
||||||
|
Long serverId = model.getServerId();
|
||||||
|
Optional<PostTarget> referralPostTargetOptional = postTargetManagement.getPostTargetOptional(ReferralPostTarget.REFERRAL, serverId);
|
||||||
|
if(referralPostTargetOptional.isPresent()) {
|
||||||
|
PostTarget referralTarget = referralPostTargetOptional.get();
|
||||||
|
Message message = model.getMessage();
|
||||||
|
if (message.getChannel().getIdLong() == referralTarget.getChannelReference().getId()) {
|
||||||
|
Long authorId = message.getAuthor().getIdLong();
|
||||||
|
if (!message.isFromGuild() || message.isWebhookMessage() || message.getType().isSystem()) {
|
||||||
|
log.info("Deleting illegal message by user {} in referral channel in server {}.", authorId, serverId);
|
||||||
|
messageService.deleteMessage(message).exceptionally(deletionErrorConsumer(message));
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
if(message.getAuthor().isBot()) {
|
||||||
|
log.debug("Ignoring message from a bot user {} in referral channel in server {}.", authorId, serverId);
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
List<Referral> foundReferrals = referralServiceBean.getReferralsFromMessage(message);
|
||||||
|
if(foundReferrals.isEmpty()) {
|
||||||
|
log.info("Did not find referrals in message {} by user {} in server {} - deleting message.",
|
||||||
|
message.getIdLong(), authorId, serverId);
|
||||||
|
deleteAndNotify(message, NO_REFERRAL_LINK_FOUND_TEMPLATE_KEY, new Object());
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Found {} referral links in message {} by user {} in server {}.",
|
||||||
|
foundReferrals.size(), message.getIdLong(), authorId, serverId);
|
||||||
|
|
||||||
|
Instant nextReferralDate = referralServiceBean.getNextReferralDate(message.getMember());
|
||||||
|
if(nextReferralDate.isAfter(Instant.now())) {
|
||||||
|
log.info("Referrals in message {} by user {} in server {} was before allowed repost date {} - deleting message.",
|
||||||
|
message.getIdLong(), authorId, serverId, nextReferralDate);
|
||||||
|
ReferralTooRecentModel templateModel = ReferralTooRecentModel
|
||||||
|
.builder()
|
||||||
|
.nextReferralDate(nextReferralDate)
|
||||||
|
.build();
|
||||||
|
deleteAndNotify(message, REFERRAL_POST_TOO_RECENT_TEMPLATE_KEY, templateModel);
|
||||||
|
return DefaultListenerResult.PROCESSED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(foundReferrals.size() > maxReferralLinksPerPost) {
|
||||||
|
log.info("More referral links ({}) than allowed ({}) in message {} in server {} by user {}.",
|
||||||
|
foundReferrals.size(), maxReferralLinksPerPost, message.getIdLong(), serverId, authorId);
|
||||||
|
foundReferrals = foundReferrals.subList(0, maxReferralLinksPerPost.intValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
ReferralPostModel postModel = ReferralPostModel
|
||||||
|
.builder()
|
||||||
|
.referrals(foundReferrals)
|
||||||
|
.postingMember(message.getMember())
|
||||||
|
.build();
|
||||||
|
ServerUser serverUser = ServerUser.fromMember(message.getMember());
|
||||||
|
CompletableFutureList<Message> sendFutures = new CompletableFutureList<>(channelService
|
||||||
|
.sendEmbedTemplateInMessageChannelList(REFERRAL_POST_EMBED_TEMPLATE_KEY, postModel, message.getChannel()));
|
||||||
|
CompletableFuture<Void> deletionFuture = messageService.deleteMessage(message);
|
||||||
|
CompletableFuture.allOf(sendFutures.getMainFuture(), deletionFuture)
|
||||||
|
.thenAccept(unused -> self.updateReferralStateInDatabase(serverUser))
|
||||||
|
.exceptionally(throwable -> {
|
||||||
|
log.error("Failed to delete or persist referral message from user {} in server {}.", authorId, serverId, throwable);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateReferralStateInDatabase(ServerUser serverUser) {
|
||||||
|
referralServiceBean.updateDbState(serverUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteAndNotify(Message message, String usedTemplate, Object usedModel) {
|
||||||
|
CompletableFutureList<Message> futures = new CompletableFutureList<>(channelService
|
||||||
|
.sendEmbedTemplateInMessageChannelList(usedTemplate, usedModel, message.getChannel()));
|
||||||
|
futures.getMainFuture().thenAccept(unused ->
|
||||||
|
scheduledExecutorService.schedule(() ->
|
||||||
|
futures.getObjects().forEach(createdMessage -> messageService.deleteMessage(createdMessage)),
|
||||||
|
deleteDelaySeconds, TimeUnit.SECONDS));
|
||||||
|
futures.getMainFuture().exceptionally(throwable -> {
|
||||||
|
log.error("Failed to send denial about setups with template {} message {} in channel {} in server {} by {}.",
|
||||||
|
usedTemplate, message.getIdLong(), message.getChannel().getIdLong(), message.getGuild().getIdLong(), message.getAuthor().getIdLong());
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
messageService.deleteMessage(message).exceptionally(deletionErrorConsumer(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Function<Throwable, Void> deletionErrorConsumer(Message message) {
|
||||||
|
return throwable -> {
|
||||||
|
log.error("Failed to delete setups message {} in channel {} in server {} by {}.",
|
||||||
|
message.getIdLong(), message.getChannel().getIdLong(), message.getGuild().getIdLong(), message.getAuthor().getIdLong());
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return ReferralFeatureDefinition.REFERRAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ReferralType {
|
||||||
|
SMARTPHONE("smartphone"), ACCESSORIES("accessories"), SMARTPHONE_INDIA("smartphoneIndia");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
ReferralType(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.model.database;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table(name = "referral_user_in_server")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class ReferralUserInAServer {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link AUserInAServer user} which is represented by this object
|
||||||
|
*/
|
||||||
|
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
|
||||||
|
@PrimaryKeyJoinColumn
|
||||||
|
private AUserInAServer user;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "server_id", nullable = false)
|
||||||
|
private AServer server;
|
||||||
|
|
||||||
|
@Column(name = "last_referral_post")
|
||||||
|
private Instant lastReferralPost;
|
||||||
|
|
||||||
|
@Column(name = "created")
|
||||||
|
private Instant created;
|
||||||
|
|
||||||
|
@Column(name = "updated")
|
||||||
|
private Instant updated;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.model.template;
|
||||||
|
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.ReferralType;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
public class Referral {
|
||||||
|
private String referralLink;
|
||||||
|
private String referralIdentifier;
|
||||||
|
private ReferralType type;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.model.template;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
public class ReferralPostModel {
|
||||||
|
private Member postingMember;
|
||||||
|
private List<Referral> referrals;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.model.template;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
public class ReferralTooRecentModel {
|
||||||
|
private Instant nextReferralDate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.repository;
|
||||||
|
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.database.ReferralUserInAServer;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ReferralUserInAServerRepository extends JpaRepository<ReferralUserInAServer, Long> {
|
||||||
|
Optional<ReferralUserInAServer> findByServer_IdAndUser_UserReference_Id(Long serverId, Long userId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.service;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.models.ServerUser;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.ReferralType;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.database.ReferralUserInAServer;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.template.Referral;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.service.management.ReferralUserManagementServiceBean;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ReferralServiceBean {
|
||||||
|
|
||||||
|
@Value("${oneplus.bot.referral.referralRepostDays}")
|
||||||
|
private Long repostDurationDays;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReferralUserManagementServiceBean referralUserManagementServiceBean;
|
||||||
|
|
||||||
|
private final Pattern referralPattern = Pattern.compile("(?<whole>https?://(?:www\\.)?oneplus\\.(?:[a-z]{1,63})[^\\s]*invite(?:#(?<identifier>[^\\s]+)|.+=([^\\s&]+)))");
|
||||||
|
|
||||||
|
public List<Referral> getReferralsFromMessage(Message message) {
|
||||||
|
List<Referral> referrals = new ArrayList<>();
|
||||||
|
Matcher matcher = referralPattern.matcher(message.getContentRaw());
|
||||||
|
while(matcher.find()) {
|
||||||
|
String fullUrl = matcher.group("whole");
|
||||||
|
String referralIdentifier = matcher.group("identifier");
|
||||||
|
Referral referral = Referral
|
||||||
|
.builder()
|
||||||
|
.referralLink(fullUrl)
|
||||||
|
.type(getType(referralIdentifier, fullUrl))
|
||||||
|
.referralIdentifier(referralIdentifier)
|
||||||
|
.build();
|
||||||
|
referrals.add(referral);
|
||||||
|
}
|
||||||
|
return referrals;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ReferralType getType(String identifier, String fullUrl) {
|
||||||
|
if(identifier.length() < 20) {
|
||||||
|
return ReferralType.SMARTPHONE;
|
||||||
|
} else if(fullUrl.contains(".in")) {
|
||||||
|
return ReferralType.SMARTPHONE_INDIA;
|
||||||
|
} else {
|
||||||
|
return ReferralType.ACCESSORIES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateDbState(ServerUser serverUser) {
|
||||||
|
Optional<ReferralUserInAServer> userOptional = referralUserManagementServiceBean.getReferralFromDb(serverUser);
|
||||||
|
if(userOptional.isPresent()) {
|
||||||
|
userOptional.get().setLastReferralPost(Instant.now());
|
||||||
|
} else {
|
||||||
|
referralUserManagementServiceBean.createReferralUser(serverUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getNextReferralDate(Member member) {
|
||||||
|
ServerUser serverUser = ServerUser.fromMember(member);
|
||||||
|
Optional<ReferralUserInAServer> userOptional = referralUserManagementServiceBean.getReferralFromDb(serverUser);
|
||||||
|
return userOptional.map(referralUserInAServer -> referralUserInAServer
|
||||||
|
.getLastReferralPost()
|
||||||
|
.plus(repostDurationDays, ChronoUnit.DAYS))
|
||||||
|
.orElse(Instant.now());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.referral.service.management;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.models.ServerUser;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.model.database.ReferralUserInAServer;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.referral.repository.ReferralUserInAServerRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ReferralUserManagementServiceBean {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReferralUserInAServerRepository repository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserInServerManagementService userInServerManagementService;
|
||||||
|
|
||||||
|
public Optional<ReferralUserInAServer> getReferralFromDb(ServerUser serverUser) {
|
||||||
|
return repository.findByServer_IdAndUser_UserReference_Id(serverUser.getServerId(), serverUser.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferralUserInAServer createReferralUser(ServerUser serverUser) {
|
||||||
|
AUserInAServer userInAServer = userInServerManagementService.loadOrCreateUser(serverUser);
|
||||||
|
ReferralUserInAServer user = ReferralUserInAServer
|
||||||
|
.builder()
|
||||||
|
.user(userInAServer)
|
||||||
|
.id(userInAServer.getUserInServerId())
|
||||||
|
.lastReferralPost(Instant.now())
|
||||||
|
.server(userInAServer.getServerReference())
|
||||||
|
.build();
|
||||||
|
return repository.save(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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="referral-tables/tables.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="referral-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -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="feature.xml" relativeToChangelogFile="true"/>
|
||||||
|
</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="referral_feature-insertion">
|
||||||
|
<insert tableName="feature">
|
||||||
|
<column name="key" value="referral"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?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="referral_user_in_server-table">
|
||||||
|
<createTable tableName="referral_user_in_server">
|
||||||
|
<column name="id" type="BIGINT">
|
||||||
|
<constraints nullable="false" primaryKey="true" primaryKeyName="referral_user_in_server_pkey"/>
|
||||||
|
</column>
|
||||||
|
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||||
|
<column name="last_referral_post" type="TIMESTAMP WITHOUT TIME ZONE" />
|
||||||
|
<column name="server_id" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="server_id" baseTableName="referral_user_in_server" constraintName="fk_referral_user_in_server_server" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="server" validate="true"/>
|
||||||
|
<addForeignKeyConstraint baseColumnNames="id" baseTableName="referral_user_in_server" constraintName="fk_referral_user_in_server_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
|
||||||
|
<sql>
|
||||||
|
DROP TRIGGER IF EXISTS referral_user_in_server_update_trigger ON referral_user_in_server;
|
||||||
|
CREATE TRIGGER referral_user_in_server_update_trigger BEFORE UPDATE ON referral_user_in_server FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
|
||||||
|
</sql>
|
||||||
|
<sql>
|
||||||
|
DROP TRIGGER IF EXISTS referral_user_in_server_insert_trigger ON referral_user_in_server;
|
||||||
|
CREATE TRIGGER referral_user_in_server_insert_trigger BEFORE INSERT ON referral_user_in_server FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
|
||||||
|
</sql>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -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="referral_user_in_server.xml" relativeToChangelogFile="true"/>
|
||||||
|
</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.3.11-referral/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
abstracto.postTargets.referral.name=referral
|
||||||
|
|
||||||
|
abstracto.featureFlags.referral.featureName=referral
|
||||||
|
abstracto.featureFlags.referral.enabled=false
|
||||||
|
|
||||||
|
oneplus.bot.referral.maxReferralCount=2
|
||||||
|
oneplus.bot.referral.deleteDelaySeconds=7
|
||||||
|
oneplus.bot.referral.referralRepostDays=14
|
||||||
34
application/oneplus-bot-modules/setup/pom.xml
Normal file
34
application/oneplus-bot-modules/setup/pom.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?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>oneplus-bot-modules</artifactId>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>setup</artifactId>
|
||||||
|
|
||||||
|
<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,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class SetupBeanConfig {
|
||||||
|
@Bean(value = "setupDelayedExecutor")
|
||||||
|
public ScheduledExecutorService getDelayedExecutor() {
|
||||||
|
return Executors.newSingleThreadScheduledExecutor();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static dev.sheldan.oneplus.bot.modules.setup.listener.SetupListener.SETUP_UPVOTE_EMOTE_KEY;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SetupFeatureConfig implements FeatureConfig {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return SetupFeatureDefinition.SETUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||||
|
return Arrays.asList(SetupPostTarget.SETUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getRequiredEmotes() {
|
||||||
|
return Arrays.asList(SETUP_UPVOTE_EMOTE_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SetupFeatureDefinition implements FeatureDefinition {
|
||||||
|
SETUP("setup");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
SetupFeatureDefinition(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.config;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SetupPostTarget implements PostTargetEnum {
|
||||||
|
SETUP("setup");
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
SetupPostTarget(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@PropertySource("classpath:setup.properties")
|
||||||
|
public class SetupProperties {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.listener;
|
||||||
|
|
||||||
|
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||||
|
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||||
|
import dev.sheldan.abstracto.core.listener.async.jda.AsyncMessageReceivedListener;
|
||||||
|
import dev.sheldan.abstracto.core.models.database.PostTarget;
|
||||||
|
import dev.sheldan.abstracto.core.models.listener.MessageReceivedModel;
|
||||||
|
import dev.sheldan.abstracto.core.service.MessageService;
|
||||||
|
import dev.sheldan.abstracto.core.service.ReactionService;
|
||||||
|
import dev.sheldan.abstracto.core.service.management.PostTargetManagement;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.setup.config.SetupFeatureDefinition;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.setup.config.SetupPostTarget;
|
||||||
|
import dev.sheldan.oneplus.bot.modules.setup.service.SetupServiceBean;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SetupListener implements AsyncMessageReceivedListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PostTargetManagement postTargetManagement;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SetupServiceBean setupServiceBean;
|
||||||
|
|
||||||
|
@Qualifier("setupDelayedExecutor")
|
||||||
|
@Autowired
|
||||||
|
private ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Value("${oneplus.bot.setup.deletionDelaySeconds}")
|
||||||
|
private Long deletionDelay;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageService messageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReactionService reactionService;
|
||||||
|
|
||||||
|
public static final String SETUP_UPVOTE_EMOTE_KEY = "setupUpvote";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultListenerResult execute(MessageReceivedModel model) {
|
||||||
|
Long serverId = model.getServerId();
|
||||||
|
Optional<PostTarget> setupPostTargetOptional = postTargetManagement.getPostTargetOptional(SetupPostTarget.SETUP, serverId);
|
||||||
|
if(setupPostTargetOptional.isPresent()) {
|
||||||
|
PostTarget setupTarget = setupPostTargetOptional.get();
|
||||||
|
Message originalMessage = model.getMessage();
|
||||||
|
if(originalMessage.getChannel().getIdLong() == setupTarget.getChannelReference().getId()) {
|
||||||
|
if(!originalMessage.isFromGuild() || originalMessage.isWebhookMessage() || originalMessage.getType().isSystem()) {
|
||||||
|
messageService.deleteMessage(originalMessage);
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
boolean currentlyInvalid = setupServiceBean.currentlyInvalid(originalMessage);
|
||||||
|
if(currentlyInvalid) {
|
||||||
|
if(setupServiceBean.mightContainEmbed(originalMessage)) {
|
||||||
|
log.info("Setup message did not contain embeds not attachments, but a link - waiting for embeds on message {}" +
|
||||||
|
" in channel {} in guild {} by user {}.", originalMessage.getIdLong(), originalMessage.getChannel().getIdLong(),
|
||||||
|
originalMessage.getGuild().getIdLong(), originalMessage.getAuthor().getIdLong());
|
||||||
|
scheduledExecutorService.schedule(() -> {
|
||||||
|
messageService.loadMessage(originalMessage).thenAccept(loadedMessage -> {
|
||||||
|
if(setupServiceBean.currentlyInvalid(loadedMessage)) {
|
||||||
|
log.info("Message did not contain attachments nor embeds after a delay - deleting setup message {}.", loadedMessage.getIdLong());
|
||||||
|
messageService.deleteMessage(loadedMessage);
|
||||||
|
} else {
|
||||||
|
log.info("Message contained embeds/attachments after a delay - message was accepted {}.", loadedMessage.getIdLong());
|
||||||
|
reactionService.addReactionToMessage(SETUP_UPVOTE_EMOTE_KEY, serverId, loadedMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, deletionDelay, TimeUnit.SECONDS);
|
||||||
|
} else {
|
||||||
|
log.info("Did not find any attachments nor embeds and no link to lead to any embeds - deleting setup message {} in channel {} in server {}" +
|
||||||
|
"by user {} for setup.", originalMessage.getIdLong(), originalMessage.getChannel().getIdLong(), originalMessage.getGuild().getIdLong(),
|
||||||
|
originalMessage.getAuthor().getIdLong());
|
||||||
|
messageService.deleteMessage(originalMessage);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("Accepting setup message {} in channel {} in guild {} from user {}.", originalMessage.getIdLong(),
|
||||||
|
originalMessage.getChannel().getIdLong(), originalMessage.getGuild().getIdLong(), originalMessage.getAuthor().getIdLong());
|
||||||
|
reactionService.addReactionToMessage(SETUP_UPVOTE_EMOTE_KEY, serverId, originalMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DefaultListenerResult.IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureDefinition getFeature() {
|
||||||
|
return SetupFeatureDefinition.SETUP;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package dev.sheldan.oneplus.bot.modules.setup.service;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.entities.EmbedType;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SetupServiceBean {
|
||||||
|
|
||||||
|
private static final Pattern URL_REGEX = Pattern.compile("((https?|ftp)://|(www|ftp)\\.)?[a-z0-9-]+(\\.[a-z0-9-]+)+([/?].*)?");
|
||||||
|
|
||||||
|
public boolean mightContainEmbed(Message message) {
|
||||||
|
Matcher urlMatcher = URL_REGEX.matcher(message.getContentRaw());
|
||||||
|
return urlMatcher.find();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean currentlyValid(Message message) {
|
||||||
|
return !message.getAttachments().isEmpty() ||
|
||||||
|
(
|
||||||
|
!message.getEmbeds().isEmpty() &&
|
||||||
|
message
|
||||||
|
.getEmbeds()
|
||||||
|
.stream()
|
||||||
|
.anyMatch(messageEmbed -> messageEmbed.getType().equals(EmbedType.IMAGE))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean currentlyInvalid(Message message) {
|
||||||
|
return !currentlyValid(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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="setup-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,15 @@
|
|||||||
|
<?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="setup_default_emote-insert">
|
||||||
|
<insert tableName="default_emote">
|
||||||
|
<column name="emote_key" value="setupUpvote"/>
|
||||||
|
<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="setup_feature-insertion">
|
||||||
|
<insert tableName="feature">
|
||||||
|
<column name="key" value="setup"/>
|
||||||
|
</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.3.11-setup/collection.xml" relativeToChangelogFile="true"/>
|
||||||
|
</databaseChangeLog>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
abstracto.postTargets.setup.name=setup
|
||||||
|
|
||||||
|
abstracto.featureFlags.setup.featureName=setup
|
||||||
|
abstracto.featureFlags.setup.enabled=false
|
||||||
|
|
||||||
|
oneplus.bot.setup.deletionDelaySeconds=3
|
||||||
@@ -5,16 +5,17 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||||
<artifactId>oneplusbot</artifactId>
|
<artifactId>oneplusbot</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||||
<artifactId>application</artifactId>
|
<artifactId>application</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>executable</module>
|
<module>executable</module>
|
||||||
<module>oneplus-bot-customizations</module>
|
<module>oneplus-bot-customizations</module>
|
||||||
|
<module>oneplus-bot-modules</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
||||||
<artifactId>deployment</artifactId>
|
<artifactId>deployment</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ PGADMIN_DEFAULT_EMAIL=sheldan@sheldan.dev
|
|||||||
PGADMIN_DEFAULT_PASSWORD=admin
|
PGADMIN_DEFAULT_PASSWORD=admin
|
||||||
TOKEN=<INSERT TOKEN>
|
TOKEN=<INSERT TOKEN>
|
||||||
YOUTUBE_API_KEY=<INSERT KEY>
|
YOUTUBE_API_KEY=<INSERT KEY>
|
||||||
ONEPLUS_BOT_VERSION=1.3.7
|
ONEPLUS_BOT_VERSION=1.4.1
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
||||||
<artifactId>deployment</artifactId>
|
<artifactId>deployment</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -52,6 +52,17 @@
|
|||||||
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
<destFileName>core.zip</destFileName>
|
<destFileName>core.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>experience-tracking</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>experience-tracking.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
<artifactId>entertainment</artifactId>
|
<artifactId>entertainment</artifactId>
|
||||||
@@ -89,7 +100,7 @@
|
|||||||
<destFileName>utility.zip</destFileName>
|
<destFileName>utility.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
f <artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
<artifactId>webservices</artifactId>
|
<artifactId>webservices</artifactId>
|
||||||
<version>${abstracto.templates.version}</version>
|
<version>${abstracto.templates.version}</version>
|
||||||
@@ -99,6 +110,66 @@
|
|||||||
<destFileName>webservices.zip</destFileName>
|
<destFileName>webservices.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>remind</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>remind.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>suggestion</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>suggestion.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>invite-filter</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>invite-filter.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>statistic</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>statistic.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>logging</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>logging.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
|
||||||
|
<artifactId>profanity-filter</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>profanity-filter.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||||
<artifactId>starboard-custom-templates</artifactId>
|
<artifactId>starboard-custom-templates</artifactId>
|
||||||
@@ -109,6 +180,26 @@
|
|||||||
<destFileName>starboard-custom.zip</destFileName>
|
<destFileName>starboard-custom.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||||
|
<artifactId>news-templates</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>news.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||||
|
<artifactId>referral-templates</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>referral.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<!-- translation artefacts -->
|
<!-- translation artefacts -->
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
@@ -119,6 +210,15 @@
|
|||||||
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
<destFileName>utility.zip</destFileName>
|
<destFileName>utility.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>experience-tracking</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>experience-tracking.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
@@ -176,9 +276,69 @@
|
|||||||
<destFileName>webservices.zip</destFileName>
|
<destFileName>webservices.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>remind</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>remind.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>suggestion</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>suggestion.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>invite-filter</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>invite-filter.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>statistic</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>statistic.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>profanity-filter</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>profanity-filter.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||||
|
<artifactId>logging</artifactId>
|
||||||
|
<version>${abstracto.templates.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>logging.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||||
<artifactId>starboard-custom</artifactId>
|
<artifactId>starboard-custom-translations</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
<overWrite>true</overWrite>
|
<overWrite>true</overWrite>
|
||||||
@@ -186,6 +346,37 @@
|
|||||||
<destFileName>starboard-custom.zip</destFileName>
|
<destFileName>starboard-custom.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<!-- custom -->
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||||
|
<artifactId>news-translations</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>news.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||||
|
<artifactId>setup-translations</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>setup.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||||
|
<artifactId>referral-translations</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||||
|
<destFileName>referral.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<!-- liquibase artifacts -->
|
<!-- liquibase artifacts -->
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
||||||
@@ -220,6 +411,17 @@
|
|||||||
<destFileName>utility.zip</destFileName>
|
<destFileName>utility.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>experience-tracking-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>experience-tracking.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
<artifactId>entertainment-impl</artifactId>
|
<artifactId>entertainment-impl</artifactId>
|
||||||
@@ -276,6 +478,73 @@
|
|||||||
<destFileName>webservices.zip</destFileName>
|
<destFileName>webservices.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>remind-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>remind.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>suggestion-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>suggestion.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>invite-filter-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>invite-filter.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>statistic-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>statistic.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>profanity-filter-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>profanity-filter.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||||
|
<artifactId>logging-impl</artifactId>
|
||||||
|
<version>${abstracto.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>logging.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<!-- customizations -->
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||||
<artifactId>starboard-custom</artifactId>
|
<artifactId>starboard-custom</artifactId>
|
||||||
@@ -287,7 +556,51 @@
|
|||||||
<destFileName>starboard-custom.zip</destFileName>
|
<destFileName>starboard-custom.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>news</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>news.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>setup</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>setup.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||||
|
<artifactId>referral</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>liquibase</classifier>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||||
|
<destFileName>referral.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<!-- overrides -->
|
<!-- overrides -->
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>overrides-templates-core.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||||
<artifactId>webservices</artifactId>
|
<artifactId>webservices</artifactId>
|
||||||
@@ -298,6 +611,27 @@
|
|||||||
<destFileName>overrides-templates-webservices.zip</destFileName>
|
<destFileName>overrides-templates-webservices.zip</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||||
|
<artifactId>logging</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>overrides-templates-logging.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
|
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||||
|
<artifactId>statistic</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>zip</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
|
||||||
|
<destFileName>overrides-templates-statistic.zip</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
{
|
{
|
||||||
"template_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "starboard-custom", "overrides-templates-webservices"],
|
"template_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "remind", "logging",
|
||||||
"translation_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "starboard-custom"],
|
"suggestion", "invite-filter", "profanity-filter", "statistic", "experience-tracking",
|
||||||
|
"starboard-custom",
|
||||||
|
"overrides-templates-webservices", "overrides-templates-core", "overrides-templates-logging", "overrides-templates-statistic",
|
||||||
|
"news", "referral"],
|
||||||
|
"translation_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "suggestion",
|
||||||
|
"remind", "logging", "invite-filter", "profanity-filter", "statistic", "experience-tracking",
|
||||||
|
"starboard-custom",
|
||||||
|
"news", "setup", "referral"],
|
||||||
"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" },
|
||||||
@@ -9,7 +16,17 @@
|
|||||||
{ "zip": "link-embed", "file": "link-embed-changeLog.xml"},
|
{ "zip": "link-embed", "file": "link-embed-changeLog.xml"},
|
||||||
{ "zip": "webservices", "file": "webservices-changeLog.xml"},
|
{ "zip": "webservices", "file": "webservices-changeLog.xml"},
|
||||||
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
{ "zip": "starboard", "file": "starboard-changeLog.xml"},
|
||||||
{ "zip": "starboard-custom", "file": "starboard-custom-changeLog.xml"}
|
{ "zip": "remind", "file": "remind-changeLog.xml"},
|
||||||
|
{ "zip": "logging", "file": "logging-changeLog.xml"},
|
||||||
|
{ "zip": "suggestion", "file": "suggestion-changeLog.xml"},
|
||||||
|
{ "zip": "invite-filter", "file": "inviteFilter-changeLog.xml"},
|
||||||
|
{ "zip": "profanity-filter", "file": "profanityFilter-changeLog.xml"},
|
||||||
|
{ "zip": "statistic", "file": "statistic-changeLog.xml"},
|
||||||
|
{ "zip": "setup", "file": "setup-changeLog.xml"},
|
||||||
|
{ "zip": "referral", "file": "referral-changeLog.xml"},
|
||||||
|
{ "zip": "experience-tracking", "file": "experience-changeLog.xml"},
|
||||||
|
{ "zip": "starboard-custom", "file": "starboard-custom-changeLog.xml"},
|
||||||
|
{ "zip": "news", "file": "news-changeLog.xml"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"editable": true,
|
"editable": true,
|
||||||
"gnetId": null,
|
"gnetId": null,
|
||||||
"graphTooltip": 1,
|
"graphTooltip": 1,
|
||||||
|
"iteration": 1617834467529,
|
||||||
"links": [],
|
"links": [],
|
||||||
"panels": [
|
"panels": [
|
||||||
{
|
{
|
||||||
@@ -521,12 +522,12 @@
|
|||||||
"fillGradient": 0,
|
"fillGradient": 0,
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 7,
|
"h": 7,
|
||||||
"w": 6,
|
"w": 12,
|
||||||
"x": 12,
|
"x": 12,
|
||||||
"y": 16
|
"y": 16
|
||||||
},
|
},
|
||||||
"hiddenSeries": false,
|
"hiddenSeries": false,
|
||||||
"id": 10,
|
"id": 32,
|
||||||
"legend": {
|
"legend": {
|
||||||
"avg": false,
|
"avg": false,
|
||||||
"current": false,
|
"current": false,
|
||||||
@@ -553,110 +554,16 @@
|
|||||||
"steppedLine": false,
|
"steppedLine": false,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "increase(help_executions_total[1m])",
|
"exemplar": true,
|
||||||
|
"expr": "discord_gateway_ping",
|
||||||
"interval": "",
|
"interval": "",
|
||||||
"legendFormat": "{{ category }}",
|
"legendFormat": "Gateway ping",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"thresholds": [],
|
"thresholds": [],
|
||||||
"timeFrom": null,
|
|
||||||
"timeRegions": [],
|
"timeRegions": [],
|
||||||
"timeShift": null,
|
"title": "Gateway ping",
|
||||||
"title": "Help command",
|
|
||||||
"tooltip": {
|
|
||||||
"shared": true,
|
|
||||||
"sort": 0,
|
|
||||||
"value_type": "individual"
|
|
||||||
},
|
|
||||||
"type": "graph",
|
|
||||||
"xaxis": {
|
|
||||||
"buckets": null,
|
|
||||||
"mode": "time",
|
|
||||||
"name": null,
|
|
||||||
"show": true,
|
|
||||||
"values": []
|
|
||||||
},
|
|
||||||
"yaxes": [
|
|
||||||
{
|
|
||||||
"format": "short",
|
|
||||||
"label": null,
|
|
||||||
"logBase": 1,
|
|
||||||
"max": null,
|
|
||||||
"min": null,
|
|
||||||
"show": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"format": "short",
|
|
||||||
"label": null,
|
|
||||||
"logBase": 1,
|
|
||||||
"max": null,
|
|
||||||
"min": null,
|
|
||||||
"show": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"yaxis": {
|
|
||||||
"align": false,
|
|
||||||
"alignLevel": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"aliasColors": {},
|
|
||||||
"bars": false,
|
|
||||||
"dashLength": 10,
|
|
||||||
"dashes": false,
|
|
||||||
"datasource": null,
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"fill": 1,
|
|
||||||
"fillGradient": 0,
|
|
||||||
"gridPos": {
|
|
||||||
"h": 7,
|
|
||||||
"w": 6,
|
|
||||||
"x": 18,
|
|
||||||
"y": 16
|
|
||||||
},
|
|
||||||
"hiddenSeries": false,
|
|
||||||
"id": 22,
|
|
||||||
"legend": {
|
|
||||||
"avg": false,
|
|
||||||
"current": false,
|
|
||||||
"max": false,
|
|
||||||
"min": false,
|
|
||||||
"show": true,
|
|
||||||
"total": false,
|
|
||||||
"values": false
|
|
||||||
},
|
|
||||||
"lines": true,
|
|
||||||
"linewidth": 1,
|
|
||||||
"nullPointMode": "null",
|
|
||||||
"options": {
|
|
||||||
"alertThreshold": true
|
|
||||||
},
|
|
||||||
"percentage": false,
|
|
||||||
"pluginVersion": "7.5.2",
|
|
||||||
"pointradius": 2,
|
|
||||||
"points": false,
|
|
||||||
"renderer": "flot",
|
|
||||||
"seriesOverrides": [],
|
|
||||||
"spaceLength": 10,
|
|
||||||
"stack": false,
|
|
||||||
"steppedLine": false,
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"expr": "increase(modmail_threads_total[1m])",
|
|
||||||
"interval": "",
|
|
||||||
"legendFormat": "{{ action }}",
|
|
||||||
"refId": "A"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"thresholds": [],
|
|
||||||
"timeFrom": null,
|
|
||||||
"timeRegions": [],
|
|
||||||
"timeShift": null,
|
|
||||||
"title": "Modmail threads",
|
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"shared": true,
|
"shared": true,
|
||||||
"sort": 0,
|
"sort": 0,
|
||||||
@@ -898,7 +805,7 @@
|
|||||||
"y": 23
|
"y": 23
|
||||||
},
|
},
|
||||||
"hiddenSeries": false,
|
"hiddenSeries": false,
|
||||||
"id": 6,
|
"id": 10,
|
||||||
"legend": {
|
"legend": {
|
||||||
"avg": false,
|
"avg": false,
|
||||||
"current": false,
|
"current": false,
|
||||||
@@ -925,9 +832,9 @@
|
|||||||
"steppedLine": false,
|
"steppedLine": false,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "increase(message_embedded_total[1m])",
|
"expr": "increase(help_executions_total[1m])",
|
||||||
"interval": "",
|
"interval": "",
|
||||||
"legendFormat": "{{action}}",
|
"legendFormat": "{{ category }}",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -935,7 +842,7 @@
|
|||||||
"timeFrom": null,
|
"timeFrom": null,
|
||||||
"timeRegions": [],
|
"timeRegions": [],
|
||||||
"timeShift": null,
|
"timeShift": null,
|
||||||
"title": "Embedded messages",
|
"title": "Help command",
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"shared": true,
|
"shared": true,
|
||||||
"sort": 0,
|
"sort": 0,
|
||||||
@@ -991,7 +898,7 @@
|
|||||||
"y": 23
|
"y": 23
|
||||||
},
|
},
|
||||||
"hiddenSeries": false,
|
"hiddenSeries": false,
|
||||||
"id": 20,
|
"id": 22,
|
||||||
"legend": {
|
"legend": {
|
||||||
"avg": false,
|
"avg": false,
|
||||||
"current": false,
|
"current": false,
|
||||||
@@ -1018,9 +925,9 @@
|
|||||||
"steppedLine": false,
|
"steppedLine": false,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"expr": "increase(moderation_purge_total[1m])",
|
"expr": "increase(modmail_threads_total[1m])",
|
||||||
"interval": "",
|
"interval": "",
|
||||||
"legendFormat": "Messages",
|
"legendFormat": "{{ action }}",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1028,7 +935,7 @@
|
|||||||
"timeFrom": null,
|
"timeFrom": null,
|
||||||
"timeRegions": [],
|
"timeRegions": [],
|
||||||
"timeShift": null,
|
"timeShift": null,
|
||||||
"title": "Message purges",
|
"title": "Modmail threads",
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"shared": true,
|
"shared": true,
|
||||||
"sort": 0,
|
"sort": 0,
|
||||||
@@ -1270,6 +1177,192 @@
|
|||||||
"y": 30
|
"y": 30
|
||||||
},
|
},
|
||||||
"hiddenSeries": false,
|
"hiddenSeries": false,
|
||||||
|
"id": 6,
|
||||||
|
"legend": {
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"show": true,
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 1,
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"options": {
|
||||||
|
"alertThreshold": true
|
||||||
|
},
|
||||||
|
"percentage": false,
|
||||||
|
"pluginVersion": "7.5.2",
|
||||||
|
"pointradius": 2,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"seriesOverrides": [],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "increase(message_embedded_total[1m])",
|
||||||
|
"interval": "",
|
||||||
|
"legendFormat": "{{action}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeRegions": [],
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Embedded messages",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"yaxis": {
|
||||||
|
"align": false,
|
||||||
|
"alignLevel": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": null,
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"fill": 1,
|
||||||
|
"fillGradient": 0,
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 6,
|
||||||
|
"x": 18,
|
||||||
|
"y": 30
|
||||||
|
},
|
||||||
|
"hiddenSeries": false,
|
||||||
|
"id": 20,
|
||||||
|
"legend": {
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"show": true,
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 1,
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"options": {
|
||||||
|
"alertThreshold": true
|
||||||
|
},
|
||||||
|
"percentage": false,
|
||||||
|
"pluginVersion": "7.5.2",
|
||||||
|
"pointradius": 2,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"seriesOverrides": [],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"expr": "increase(moderation_purge_total[1m])",
|
||||||
|
"interval": "",
|
||||||
|
"legendFormat": "Messages",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thresholds": [],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeRegions": [],
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Message purges",
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 0,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"yaxis": {
|
||||||
|
"align": false,
|
||||||
|
"alignLevel": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"aliasColors": {},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"datasource": null,
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"fill": 1,
|
||||||
|
"fillGradient": 0,
|
||||||
|
"gridPos": {
|
||||||
|
"h": 7,
|
||||||
|
"w": 6,
|
||||||
|
"x": 12,
|
||||||
|
"y": 37
|
||||||
|
},
|
||||||
|
"hiddenSeries": false,
|
||||||
"id": 18,
|
"id": 18,
|
||||||
"legend": {
|
"legend": {
|
||||||
"avg": false,
|
"avg": false,
|
||||||
@@ -1360,7 +1453,7 @@
|
|||||||
"h": 7,
|
"h": 7,
|
||||||
"w": 6,
|
"w": 6,
|
||||||
"x": 18,
|
"x": 18,
|
||||||
"y": 30
|
"y": 37
|
||||||
},
|
},
|
||||||
"hiddenSeries": false,
|
"hiddenSeries": false,
|
||||||
"id": 28,
|
"id": 28,
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>oneplusbot</artifactId>
|
<artifactId>oneplusbot</artifactId>
|
||||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
8
pom.xml
8
pom.xml
@@ -12,15 +12,15 @@
|
|||||||
|
|
||||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||||
<artifactId>oneplusbot</artifactId>
|
<artifactId>oneplusbot</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<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 opbot version, update the docker-compose as well-->
|
<!-- when releasing a new opbot version, update the docker-compose as well-->
|
||||||
<abstracto.version>1.2.7</abstracto.version>
|
<abstracto.version>1.2.14</abstracto.version>
|
||||||
<abstracto.templates.version>1.2.3</abstracto.templates.version>
|
<abstracto.templates.version>1.2.10</abstracto.templates.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<scm>
|
<scm>
|
||||||
<url>https://maven.pkg.github.com/Sheldan/OnePlusBot</url>
|
<url>https://maven.pkg.github.com/Sheldan/OnePlusBot</url>
|
||||||
<developerConnection>scm:git:git@github.com:Sheldan/OnePlusBot.git</developerConnection>
|
<developerConnection>scm:git:git@github.com:Sheldan/OnePlusBot.git</developerConnection>
|
||||||
<tag>oneplusbot-1.3.7</tag>
|
<tag>oneplusbot-1.4.1</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
</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.oneplus.bot.templates.modules</groupId>
|
||||||
|
<artifactId>oneplus-bot-modules-templates</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>news-templates</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>starboard-custom-templates-${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,12 @@
|
|||||||
|
{
|
||||||
|
<#assign roleMention="<@&479202891358535681>"/>
|
||||||
|
<#assign authorMention>${author.user.name}#${author.user.discriminator}</#assign>
|
||||||
|
"additionalMessage": "<@safe_include "news_post_description"/>",
|
||||||
|
<#if message.attachments?size gt 0>
|
||||||
|
"imageUrl": "${message.attachments[0].proxyUrl}",
|
||||||
|
</#if>
|
||||||
|
"metaConfig": {
|
||||||
|
"allowsRoleMention": true,
|
||||||
|
"preventEmptyEmbed": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<#include "news_post_locked_exception_message">
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<#include "news_post_not_found_exception_text">
|
||||||
@@ -3,16 +3,18 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||||
<artifactId>templates</artifactId>
|
<artifactId>templates</artifactId>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||||
<artifactId>oneplus-bot-modules</artifactId>
|
<artifactId>oneplus-bot-modules-templates</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.3.7</version>
|
<version>1.4.1</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>starboard-custom</module>
|
<module>starboard-custom-templates</module>
|
||||||
|
<module>news-templates</module>
|
||||||
|
<module>referral-templates</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>
|
||||||
|
<artifactId>oneplus-bot-modules-templates</artifactId>
|
||||||
|
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>referral-templates</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>referral-templates-${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>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user