Compare commits

...

62 Commits

Author SHA1 Message Date
Sheldan
ed85b1955f [maven-release-plugin] prepare release oneplusbot-1.6.9 2023-09-23 21:35:57 +02:00
Sheldan
f83042c84f [OPB-xxx] updating versions 2023-09-23 21:35:31 +02:00
Sheldan
b11b49e5c4 [OPB-xxx] fixing globally unique ids for grafana dashbaords 2023-09-23 21:34:44 +02:00
Sheldan
9d1382019f [maven-release-plugin] prepare for next development iteration 2023-09-23 19:17:30 +02:00
Sheldan
6e25ac91cb [maven-release-plugin] prepare release oneplusbot-1.6.8 2023-09-23 19:17:26 +02:00
Sheldan
44e3f8656c [OPB-xxx] fixing chart and image name to not be the same 2023-09-23 19:16:40 +02:00
Sheldan
c8a6f67af5 [maven-release-plugin] prepare for next development iteration 2023-09-23 18:27:28 +02:00
Sheldan
a39942beef [maven-release-plugin] prepare release oneplusbot-1.6.7 2023-09-23 18:27:23 +02:00
Sheldan
ca36645197 [OPB-xxx] fixing release job
updating version
2023-09-23 18:22:24 +02:00
Sheldan
e177b5f559 [maven-release-plugin] prepare for next development iteration 2023-09-23 18:16:15 +02:00
Sheldan
9f11ec5ffa [maven-release-plugin] prepare release oneplusbot-1.6.6 2023-09-23 18:16:11 +02:00
Sheldan
5378a4038b [OPB-xxx] adding configuration and changing structure for k8s deployment 2023-09-23 18:02:39 +02:00
Sheldan
d448dfbf9b [OPB-xxx] adding missing parameters for docker compose deployment 2023-07-10 00:57:13 +02:00
Sheldan
f0b548a97e [maven-release-plugin] prepare for next development iteration 2023-02-15 00:56:36 +01:00
Sheldan
b0c2c24dce [maven-release-plugin] prepare release oneplusbot-1.6.5 2023-02-15 00:56:27 +01:00
Sheldan
658683c013 [OPB-xxx] prepare for release 2023-02-15 00:55:04 +01:00
Sheldan
8c8cadefdd [maven-release-plugin] prepare for next development iteration 2023-02-04 20:47:40 +01:00
Sheldan
8e9a7004a2 [maven-release-plugin] prepare release oneplusbot-1.6.4 2023-02-04 20:47:36 +01:00
Sheldan
29fb53fb7a [OPB-xxx] prepare for release 2023-02-04 20:45:26 +01:00
Sheldan
6d23fffc77 [maven-release-plugin] prepare for next development iteration 2022-12-21 19:08:01 +01:00
Sheldan
d816a8a48c [maven-release-plugin] prepare release oneplusbot-1.6.3 2022-12-21 19:07:56 +01:00
Sheldan
386011d2e9 [OPB-xxx] updating abstracto version
preparing for release
2022-12-21 19:03:59 +01:00
Sheldan
015609f9d2 [maven-release-plugin] prepare for next development iteration 2022-10-16 13:50:44 +02:00
Sheldan
35a6f0aeeb [maven-release-plugin] prepare release oneplusbot-1.6.2 2022-10-16 13:50:40 +02:00
Sheldan
743195b137 [OPB-xxx] updating to new version of abstracto
preparing for release
2022-10-16 13:46:02 +02:00
Sheldan
9f35781f2d [OPB-xxx] upgrading to new JDA alpha 2022-09-18 15:54:04 +02:00
Sheldan
dbf131abfe [maven-release-plugin] prepare for next development iteration 2022-08-29 00:28:20 +02:00
Sheldan
05dbb1fc2f [maven-release-plugin] prepare release oneplusbot-1.6.1 2022-08-29 00:28:16 +02:00
Sheldan
47284686d6 [OPB-xxx] updating abstracto version to 1.4.3 2022-08-29 00:26:02 +02:00
Sheldan
46ef5435c7 [maven-release-plugin] prepare for next development iteration 2022-08-01 23:32:38 +02:00
Sheldan
bcfaf1c928 [maven-release-plugin] prepare release oneplusbot-1.6.0 2022-08-01 23:32:34 +02:00
Sheldan
124d45ba5b Merge branch 'master' into feature/JDA-5
# Conflicts:
#	pom.xml
2022-08-01 23:27:48 +02:00
Sheldan
4cdaf87412 [OPB-xxx] updating versions and classes 2022-08-01 23:26:50 +02:00
Sheldan
13cf06e1dc [OPB-xxx] preparing new release 2022-08-01 21:41:37 +02:00
Sheldan
e8ae0f430d [OPB-xxx] preparing new release 2022-08-01 21:39:25 +02:00
Sheldan
cda9d1a2b8 [OPB-xxx] updating terraform module version 2022-07-14 20:02:39 +02:00
Sheldan
653246f3ee [OPB-xxx] adding terraform config 2022-07-14 01:59:45 +02:00
Sheldan
0879c7cc93 [OPB-xxx] creating issue templates 2022-05-31 00:22:13 +02:00
Sheldan
4ea878dd42 [maven-release-plugin] prepare for next development iteration 2022-04-07 23:25:07 +02:00
Sheldan
562f5ae9e1 [maven-release-plugin] prepare release oneplusbot-1.5.10 2022-04-07 23:25:03 +02:00
Sheldan
92925d176f Updating to new Abstracto version 1.3.12 2022-04-07 23:12:02 +02:00
Sheldan
6a5f45c416 [maven-release-plugin] prepare for next development iteration 2021-12-24 14:25:23 +01:00
Sheldan
c7e8fd315f [maven-release-plugin] prepare release oneplusbot-1.5.9 2021-12-24 14:25:19 +01:00
Sheldan
95ad8fdd3a [OPB-xxx] preparing for release 2021-12-24 13:53:01 +01:00
Sheldan
51775b454e [OPB-41] adding seasonal lights effect 2021-12-23 23:44:45 +01:00
Sheldan
aa4de8f571 [OPB-42] aligning templates with new multi embed support 2021-12-08 16:40:35 +01:00
Sheldan
eae07fd07c [maven-release-plugin] prepare for next development iteration 2021-10-26 00:07:29 +02:00
Sheldan
c492640cd7 [maven-release-plugin] prepare release oneplusbot-1.5.8 2021-10-26 00:07:23 +02:00
Sheldan
2c49cf2918 [OPB-40] adding warning threshold notification
restructured template module structure and naming
2021-10-25 00:15:51 +02:00
Sheldan
60ac314ecc [OPB-39] fixing faq export not properly exporting image only embeds
fixing requiring alias values if the key is present
2021-09-28 21:26:28 +02:00
Sheldan
c82ef9ac18 Merge pull request #1 from AnonymousWP/master
Fixed typo in the help output of `updateNews`
2021-09-18 14:55:42 +02:00
AnonymousWP
6369ae7c01 Fixed typo in the help output of updateNews 2021-09-18 14:50:17 +02:00
Sheldan
f9b2174f84 [maven-release-plugin] prepare for next development iteration 2021-09-06 02:21:16 +02:00
Sheldan
d5c8509ab0 [maven-release-plugin] prepare release oneplusbot-1.5.7 2021-09-06 02:21:12 +02:00
Sheldan
eaddea63b3 [OPB-xxx] preparing for release 2021-09-06 02:15:38 +02:00
Sheldan
7dc141a8a4 [OPB-xxx] adding logging dashboard to grafana 2021-09-06 01:34:23 +02:00
Sheldan
6652c90edb [OPB-37] fixing loki data source in docker compose config 2021-08-22 19:09:28 +02:00
Sheldan
d7f5fc21d6 [OPB-38] fixing json validation 2021-08-22 18:39:41 +02:00
Sheldan
bf98d5db3a [maven-release-plugin] prepare for next development iteration 2021-08-10 00:21:38 +02:00
Sheldan
57fb34920d [maven-release-plugin] prepare release oneplusbot-1.5.6 2021-08-10 00:21:31 +02:00
Sheldan
3f959f3bbb [OPB-37] adding loki log collector
upgrading to newer abstracto version
adding some info to readme
2021-08-09 23:42:23 +02:00
Sheldan
0380720ec8 [maven-release-plugin] prepare for next development iteration 2021-07-26 02:08:06 +02:00
307 changed files with 3489 additions and 8363 deletions

42
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Bug Report
description: Found a bug that needs fixing?
body:
- type: checkboxes
attributes:
label: General Troubleshooting
description: You confirm to have made the following checks first.
options:
- label: I have checked for similar issues on the Issue-tracker.
required: true
- label: I have updated to the latest version
required: true
- label: I have checked the branches or the maintainers' PRs for upcoming bug fixes.
required: true
- type: textarea
attributes:
label: "Description"
description: "General information about the bug"
placeholder: "..."
validations:
required: true
- type: textarea
attributes:
label: "Steps to reproduce"
description: "What happened when the bug occurred?"
placeholder: "1. ..."
validations:
required: true
- type: textarea
attributes:
label: "Expected behaviour"
description: "What should happen?"
placeholder: "It should..."
validations:
required: true
- type: textarea
attributes:
label: "Actual behaviour"
description: "What did happen instead?"
placeholder: "It actually ..."
validations:
required: true

36
.github/ISSUE_TEMPLATE/feature.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Feature request
description: Want some functionality added?
body:
- type: checkboxes
attributes:
label: General Information
description: You confirm to have made the following checks first.
options:
- label: I have checked for similar issues on the Issue-tracker.
required: true
- label: I have updated to the latest version
required: true
- label: I have checked the branches or the maintainers' PRs for upcoming features fixes.
required: true
- type: textarea
attributes:
label: "Description"
description: "General description of the feature"
placeholder: "..."
validations:
required: true
- type: textarea
attributes:
label: "Feature worth and general use"
description: "Why should this exist?"
placeholder: "..."
validations:
required: true
- type: textarea
attributes:
label: "Suggestions for implementation"
description: "Any ideas about what the feature should behave/look like? Commands?"
placeholder: "It should..."
validations:
required: false

View File

@@ -17,11 +17,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v3
with:
java-version: 1.8
persist-credentials: false
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
- name: Build with Maven
run: mvn -s settings.xml -B install --file pom.xml
env:

View File

@@ -6,13 +6,14 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up Java for publishing to GitHub Packages
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 1.8
distribution: 'corretto'
java-version: 17
- name: Load current version
id: version
run: echo "version=$(mvn -s settings.xml --file pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_ENV
@@ -22,17 +23,26 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
user: Sheldan
token: ${{ secrets.ABSTRACTO_PAT }}
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
- name: Login to Harbor
uses: docker/login-action@v2
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push deployment container
registry: harbor.sheldan.dev
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Load env files
id: dotenv
uses: falti/dotenv-action@v1.0.4
with:
path: ./deployment/image-packaging/src/main/docker/.env
- name: Push container
working-directory: ./deployment/image-packaging/src/main/docker
run: docker-compose build && docker-compose push
env:
REGISTRY_PREFIX: docker.pkg.github.com/sheldan/oneplusbot/
VERSION: ${{ env.version }}
ABSTRACTO_VERSION: 1.3.6
ABSTRACTO_REGISTRY_PREFIX: docker.pkg.github.com/sheldan/abstracto/
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
VERSION: ${{ steps.dotenv.outputs.version }}
- name: Helm push
working-directory: ./deployment/helm/
run: |-
helm registry login -u '${{ secrets.HARBOR_USERNAME }}' -p '${{ secrets.HARBOR_TOKEN }}' harbor.sheldan.dev
helm package oneplus-bot
helm push oneplus-bot*.tgz oci://harbor.sheldan.dev/oneplus-bot

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Sheldan
Copyright (c) 2022 Sheldan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,6 +1,6 @@
# r/oneplus Discord bot privacy policy
Last updated: 04.07.2021
Last updated: 06.09.2021
## Description
@@ -75,6 +75,7 @@ The detailed list of what information is stored and processed is the following:
* this was used for the message used to update the status of a suggestion, but this is currently disabled
* the author of the suggestion and the message which has been posted in the suggestions channel
* every suggestion will be deleted completely from the database a few days after it has reached a final state (rejected, denied, accepted)
* whether you voted for a suggestion and which decision you took
### Leveling system
* the amount of messages which were considered for the leveling system

View File

@@ -1,11 +1,21 @@
# r/oneplus Discord server bot
This repository contains the rewrite of the [Bot](https://github.com/Rithari/OnePlusBot), which is still in use. The features will be gradually be ported
and most of them will be in [abstracto](https://github.com/Sheldan/abstracto), but some of the features need to be customized, as they are r/oneplus specific.
This repository contains the rewrite of the [Bot](https://github.com/Rithari/OnePlusBot). It is developed by customizing [abstracto](https://github.com/Sheldan/abstracto), because some features are r/oneplus specific.
The migration of the existing data from the database is handled via one time migration, and can be found [here](https://github.com/Sheldan/OnePlusBot-migration).
The FAQ configuration can be found [here](https://github.com/Sheldan/OnePlusBot-faq/).
Custom features which were ported
- [x] FAQ
- [x] Setup channel handling
- [x] Referral link handling
# Technologies used in addition to the ones provided in abstracto
- [grafana](https://github.com/grafana/grafana) for visualization of the bot status and metrics
- [Loki](https://github.com/grafana/loki) to visualize and query log files
- [pgAdmin](https://github.com/postgres/pgadmin4) to view the database
- [prometheus](https://github.com/prometheus/prometheus) for metric collection
- [postgres](https://github.com/postgres/postgres) as a database
- [loki](https://github.com/grafana/loki) for log aggregation

40
Tiltfile Normal file
View File

@@ -0,0 +1,40 @@
allow_k8s_contexts('k8s-cluster')
load('ext://restart_process', 'docker_build_with_restart')
registry = 'harbor.sheldan.dev/oneplus-bot/'
local_resource(
'oneplus-bot-java-compile',
'mvn install && ' +
'rm -rf application/executable/target/jar-staging && ' +
'unzip -o application/executable/target/oneplus-bot-exec.jar -d application/executable/target/jar-staging && ' +
'rsync --delete --inplace --checksum -r application/executable/target/jar-staging/ application/executable/target/jar && ' +
'mkdir application/executable/target/jar/snapshots && ' +
'rsync --delete --inplace --checksum -r application/executable/target/jar/BOOT-INF/lib/*-SNAPSHOT.jar application/executable/target/jar/snapshots && ' +
'rm -f application/executable/target/jar/BOOT-INF/lib/*-SNAPSHOT.jar ',
deps=['pom.xml'])
docker_build_with_restart(
registry + 'oneplus-bot',
'./application/executable/target/jar',
entrypoint=['java', '-noverify', '-cp', '.:./lib/*', 'dev.sheldan.oneplus.bot.executable.Application'],
dockerfile='./application/executable/Dockerfile',
live_update=[
sync('./application/executable/target/jar/BOOT-INF/lib', '/app/lib'),
sync('./application/executable/target/jar/META-INF', '/app/META-INF'),
sync('./application/executable/target/jar/BOOT-INF/classes', '/app'),
sync('./application/executable/target/jar/snapshots', '/app/lib')
],
)
docker_build(registry + 'oneplus-bot-db-data', 'deployment/image-packaging/src/main/docker/db-data/')
docker_build(registry + 'oneplus-bot-template-data', 'deployment/image-packaging/src/main/docker/template-data/')
k8s_yaml(helm('deployment/helm/oneplus-bot', values=
['./../OnePlusBot-environments/argocd/apps/oneplus-bot/values/local/values.yaml',
'secrets://./../OnePlusBot-environments/argocd/apps/oneplus-bot/values/local/values.secrets.yaml']
))
local_resource('fetch-packages', 'mvn install -f deployment/image-packaging/pom.xml', auto_init=False, trigger_mode = TRIGGER_MODE_MANUAL)
k8s_resource('chart-oneplus-bot', port_forwards='5005:5005')

View File

@@ -0,0 +1,10 @@
FROM amazoncorretto:17.0.8-alpine3.18
RUN apk add entr
WORKDIR /app
ADD BOOT-INF/lib/ /app/lib
ADD snapshots/ /app/lib
ADD META-INF /app/META-INF
ADD BOOT-INF/classes /app
ENTRYPOINT java -cp .:./lib/* dev.sheldan.oneplus.bot.executable.Application

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application</groupId>
<artifactId>application</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>executable</artifactId>
@@ -14,6 +14,7 @@
</properties>
<build>
<finalName>oneplus-bot</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
@@ -191,6 +192,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<artifactId>seasonal</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,18 @@
package dev.sheldan.oneplus.bot.executable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((authorize) -> authorize
.anyRequest().permitAll());
return http.build();
}
}

View File

@@ -1,21 +0,0 @@
spring.datasource.url=jdbc:postgresql://localhost:5432/abstracto
spring.datasource.username= abstracto
spring.datasource.password= abstracto
spring.jpa.properties.hibernate.default_schema=abstracto
spring.quartz.jdbc.initialize-schema=never
spring.jpa.hibernate.ddl-auto = none
spring.jpa.show-sql = false
spring.jpa.properties.hibernate.format_sql = true
log4j.logger.org.hibernate.SQL=trace
log4j.logger.org.hibernate.type.descriptor.sql=trace
log4j.logger.org.hibernate.type=trace
management.metrics.tags.application=oneplus-bot
spring.security.user.name=abstracto
spring.security.user.password=password
spring.security.user.roles=USER
spring.application.name=OnePlusBot

View File

@@ -1,11 +1,13 @@
spring.datasource.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}
spring.datasource.username= ${DB_USER}
spring.datasource.password= ${DB_PASS}
spring.jpa.hibernate.default_schema=${DB_NAME}
spring.jpa.hibernate.default_schema=abstracto
spring.jpa.properties.hibernate.default_schema=abstracto
spring.quartz.jdbc.initialize-schema=never
management.metrics.tags.application=oneplus-bot
spring.security.user.name= ${REST_USER_NAME}
spring.security.user.password= ${REST_PASSWORD}
spring.security.user.roles=USER
management.metrics.tags.application=OnePlusBot
management.endpoint.health.probes.enabled=true
management.health.livenessState.enabled=true
management.health.readinessState.enabled=true
spring.application.name=OnePlusBot
spring.application.name=OnePlusBot
spring.main.allow-circular-references=true

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
<artifactId>oneplus-bot-customizations</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>oneplus-bot-customizations</artifactId>
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -2,6 +2,7 @@ package dev.sheldan.oneplus.bot.custom.moderation.config;
import dev.sheldan.abstracto.core.config.FeatureConfig;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.config.PostTargetEnum;
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureConfig;
import dev.sheldan.oneplus.bot.custom.moderation.service.ModModeServiceBean;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +15,8 @@ import java.util.List;
@Component
public class ModerationCustomFeature implements FeatureConfig {
public static final String WARN_NOTIFICATION_THRESHOLD = "warnNotificationThreshold";
@Autowired
private ModerationFeatureConfig moderationFeatureConfig;
@@ -27,9 +30,14 @@ public class ModerationCustomFeature implements FeatureConfig {
return Arrays.asList(moderationFeatureConfig);
}
@Override
public List<PostTargetEnum> getRequiredPostTargets() {
return Arrays.asList(ModerationCustomPostTarget.WARN_THRESHOLD_NOTIFICATION);
}
@Override
public List<String> getRequiredSystemConfigKeys() {
return Arrays.asList(ModModeServiceBean.MODMODE_ROLE_CONFIG_KEY,
ModModeServiceBean.MODMODE_CHANGED_ROLE_COLOR_CONFIG_KEY);
ModModeServiceBean.MODMODE_CHANGED_ROLE_COLOR_CONFIG_KEY, WARN_NOTIFICATION_THRESHOLD);
}
}

View File

@@ -0,0 +1,15 @@
package dev.sheldan.oneplus.bot.custom.moderation.config;
import dev.sheldan.abstracto.core.config.PostTargetEnum;
import lombok.Getter;
@Getter
public enum ModerationCustomPostTarget implements PostTargetEnum {
WARN_THRESHOLD_NOTIFICATION("warnThresholdNotification");
private String key;
ModerationCustomPostTarget(String key) {
this.key = key;
}
}

View File

@@ -0,0 +1,98 @@
package dev.sheldan.oneplus.bot.custom.moderation.listener;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
import dev.sheldan.abstracto.core.models.ServerUser;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import dev.sheldan.abstracto.core.models.template.display.ChannelDisplay;
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
import dev.sheldan.abstracto.core.service.*;
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
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.abstracto.moderation.listener.WarningCreatedListener;
import dev.sheldan.abstracto.moderation.model.listener.WarningCreatedEventModel;
import dev.sheldan.abstracto.moderation.service.management.WarnManagementService;
import dev.sheldan.oneplus.bot.custom.moderation.config.ModerationCustomFeature;
import dev.sheldan.oneplus.bot.custom.moderation.config.ModerationCustomFeatureDefinition;
import dev.sheldan.oneplus.bot.custom.moderation.config.ModerationCustomPostTarget;
import dev.sheldan.oneplus.bot.custom.moderation.model.template.WarningThresholdNotificationModel;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Component
@Slf4j
public class WarningAddedListener implements WarningCreatedListener {
@Autowired
private ConfigService configService;
@Autowired
private WarnManagementService warnManagementService;
@Autowired
private UserInServerManagementService userInServerManagementService;
@Autowired
private ChannelService channelService;
@Autowired
private PostTargetService postTargetService;
@Autowired
private TemplateService templateService;
public static final String WARN_THRESHOLD_NOTIFICATION_TEMPLATE_KEY = "warning_threshold_notification";
@Override
public DefaultListenerResult execute(WarningCreatedEventModel model) {
Long warnNotificationAmount = configService.getLongValueOrConfigDefault(ModerationCustomFeature.WARN_NOTIFICATION_THRESHOLD, model.getServerId());
ServerUser warnedUser = ServerUser
.builder()
.userId(model.getWarnedUserId())
.serverId(model.getServerId())
.build();
AUserInAServer warnedUserInAServer = userInServerManagementService.loadOrCreateUser(warnedUser);
List<Long> activeWarnsForUser = warnManagementService.getActiveWarnsForUser(warnedUserInAServer)
.stream().map(warning -> warning.getWarnId().getId()).collect(Collectors.toList());
Set<Long> warnIds = new HashSet<>(activeWarnsForUser);
// we cant be sure we receive the newly persisted warning yet, sadly
warnIds.add(model.getWarningId());
if(warnIds.size() == warnNotificationAmount) {
Long serverId = model.getServerId();
Long channelId = model.getWarningChannelId();
Long warnedUserId = model.getWarnedUserId();
GuildMessageChannel channel = channelService.getMessageChannelFromServer(serverId, channelId);
WarningThresholdNotificationModel notificationModel = WarningThresholdNotificationModel
.builder()
.channelDisplay(ChannelDisplay.fromChannel(channel))
.memberDisplay(MemberDisplay.fromAUserInAServer(warnedUserInAServer))
.messageId(model.getWarningMessageId())
.warnCount(warnIds.size())
.build();
MessageToSend messageToSend = templateService.renderEmbedTemplate(WARN_THRESHOLD_NOTIFICATION_TEMPLATE_KEY, notificationModel, serverId);
FutureUtils.toSingleFutureGeneric(postTargetService.sendEmbedInPostTarget(messageToSend, ModerationCustomPostTarget.WARN_THRESHOLD_NOTIFICATION, serverId))
.thenAccept(unused -> log.info("Warn threshold notification sent for user {} in server {}.", warnedUserId, serverId))
.exceptionally(throwable -> {
log.error("Failed to sent warn threshold notification for user {} in server {}.", warnedUserId, serverId, throwable);
return null;
});
}
return DefaultListenerResult.PROCESSED;
}
@Override
public FeatureDefinition getFeature() {
return ModerationCustomFeatureDefinition.MODERATION_CUSTOM;
}
}

View File

@@ -0,0 +1,15 @@
package dev.sheldan.oneplus.bot.custom.moderation.model.template;
import dev.sheldan.abstracto.core.models.template.display.ChannelDisplay;
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
import lombok.Builder;
import lombok.Getter;
@Builder
@Getter
public class WarningThresholdNotificationModel {
private MemberDisplay memberDisplay;
private Integer warnCount;
private ChannelDisplay channelDisplay;
private Long messageId;
}

View File

@@ -5,4 +5,9 @@ abstracto.systemConfigs.modModeRoleId.name=modModeRoleId
abstracto.systemConfigs.modModeRoleId.longValue=0
abstracto.systemConfigs.modModeNewRoleColor.name=modModeNewRoleColor
abstracto.systemConfigs.modModeNewRoleColor.stringValue=0,0,0
abstracto.systemConfigs.modModeNewRoleColor.stringValue=0,0,0
abstracto.systemConfigs.warnNotificationThreshold.name=warnNotificationThreshold
abstracto.systemConfigs.warnNotificationThreshold.longValue=3
abstracto.postTargets.warnThresholdNotification.name=warnThresholdNotification

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application</groupId>
<artifactId>application</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
<artifactId>oneplus-bot-customizations</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>oneplus-bot-modules</artifactId>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -17,7 +17,8 @@ import dev.sheldan.oneplus.bot.modules.faq.config.FAQFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.faq.config.FAQModuleDefinition;
import dev.sheldan.oneplus.bot.modules.faq.models.command.faq.FAQResponseModel;
import dev.sheldan.oneplus.bot.modules.faq.service.FAQResponseServiceBean;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,7 +51,7 @@ public class FAQ extends AbstractConditionableCommand {
String commandName;
if(!parameters.isEmpty()) {
commandName = (String) parameters.get(0);
TextChannel channel;
GuildMessageChannel channel;
if (parameters.size() == 2) {
channel = (TextChannel) parameters.get(1);
} else {

View File

@@ -66,6 +66,7 @@ public class ImportFAQ extends AbstractConditionableCommand {
AServer server = serverManagementService.loadServer(commandContext.getGuild());
List<FaqCommandConfig> commands = faqServiceBean.loadFAQCommandsFromJson(jsonContent);
faqServiceBean.createOrUpdateFAQCommands(commands, server);
return CompletableFuture.completedFuture(CommandResult.fromSuccess());
} else {
List<String> errors = jsonValidationService.getDetailedException(result.getExceptions())
@@ -73,8 +74,8 @@ public class ImportFAQ extends AbstractConditionableCommand {
.map(ValidationException::getMessage)
.collect(Collectors.toList());
channelService.sendTextToChannel(String.join("\n", errors), commandContext.getChannel());
return CompletableFuture.completedFuture(CommandResult.fromError("Incorrect faq config."));
}
return CompletableFuture.completedFuture(CommandResult.fromSuccess());
} catch (IOException e) {
log.error("IO Exception when loading input file.", e);
throw new AbstractoTemplatedException("Failed to load json config.", "failed_to_set_template_exception", e);

View File

@@ -65,7 +65,8 @@ public class FAQCommandConfigConverter {
private FaqCommandResponseMessageConfig convertCommandResponse(FAQCommandResponse response, Long botUserId) {
FaqCommandResponseEmbedConfig embedConfig = null;
if(response.getDescription() != null) {
// one of those must not be null, for it to be considered a proper embed
if(response.getDescription() != null || response.getImageURL() != null) {
boolean useBot = response.getAuthorUserId().equals(botUserId);
FaqCommandResponseEmbedColorConfig colorConfig = FaqCommandResponseEmbedColorConfig
.builder()

View File

@@ -3,7 +3,7 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database;
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.time.Instant;
@Builder

View File

@@ -3,7 +3,7 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database;
import dev.sheldan.oneplus.bot.modules.faq.models.database.embed.ChannelGroupCommandId;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList;

View File

@@ -3,7 +3,7 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database;
import dev.sheldan.abstracto.core.models.database.AServer;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList;

View File

@@ -3,7 +3,7 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database;
import dev.sheldan.oneplus.bot.modules.faq.models.database.embed.FAQCommandAliasId;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.io.Serializable;
import java.time.Instant;

View File

@@ -3,7 +3,7 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database;
import dev.sheldan.oneplus.bot.modules.faq.models.database.embed.CommandResponseId;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.time.Instant;
@Builder

View File

@@ -2,8 +2,8 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database.embed;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import java.io.Serializable;
@Embeddable

View File

@@ -2,8 +2,8 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database.embed;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import java.io.Serializable;
@Embeddable

View File

@@ -2,8 +2,8 @@ package dev.sheldan.oneplus.bot.modules.faq.models.database.embed;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import java.io.Serializable;
@Embeddable

View File

@@ -22,10 +22,8 @@ import dev.sheldan.oneplus.bot.modules.faq.service.management.FAQChannelGroupCom
import dev.sheldan.oneplus.bot.modules.faq.service.management.FAQCommandAliasManagementService;
import dev.sheldan.oneplus.bot.modules.faq.service.management.FAQCommandManagementServiceBean;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.ISnowflake;
import net.dv8tion.jda.api.entities.SelfUser;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -67,7 +65,7 @@ public class FAQResponseServiceBean {
@Autowired
private FAQResponseServiceBean self;
public CompletableFuture<FAQResponseModel> loadFAQResponse(String commandName, TextChannel textChannel) {
public CompletableFuture<FAQResponseModel> loadFAQResponse(String commandName, GuildMessageChannel textChannel) {
AServer server = serverManagementService.loadServer(textChannel.getGuild().getIdLong());
Optional<FAQCommand> faqCommandOptional = faqCommandManagementServiceBean.findByNameAndServer(commandName, server);
if(!faqCommandOptional.isPresent()) {

View File

@@ -3,143 +3,124 @@
"type": "array",
"minItems": 1,
"maxItems": 30,
"items": [
{
"type": "object",
"properties": {
"faqCommandName": {
"items": {
"type": "object",
"properties": {
"faqCommandName": {
"type": "string",
"minLength": 1,
"maxLength": 30,
"pattern": "\\w*"
},
"global": {
"default": false,
"type": "boolean"
},
"aliases": {
"type": "array",
"minItems": 0,
"maxItems": 20,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 30,
"pattern": "\\w*"
},
"global": {
"default": false,
"type": "boolean"
},
"aliases": {
"type": "array",
"minItems": 1,
"maxItems": 20,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 30,
"pattern": "\\w*"
}
},
"responses": {
"type": "array",
"minItems": 1,
"maxItems": 255,
"items": {
"type": "object",
"properties": {
"channelGroupName": {
"type": "string",
"minLength": 1,
"maxLength": 20,
"pattern": "\\w*"
},
"messages": {
"type": "array",
"minItems": 1,
"maxItems": 3,
"items": [
{
}
},
"responses": {
"type": "array",
"minItems": 1,
"maxItems": 255,
"items": {
"type": "object",
"properties": {
"channelGroupName": {
"type": "string",
"minLength": 1,
"maxLength": 20,
"pattern": "\\w*"
},
"messages": {
"type": "array",
"minItems": 1,
"maxItems": 3,
"items": {
"type": "object",
"properties": {
"position": {
"type": "number",
"minimum": 0,
"maximum": 2
},
"additionalMessage": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"embed": {
"type": "object",
"properties": {
"position": {
"type": "number",
"minimum": 0,
"maximum": 2
},
"additionalMessage": {
"description": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"embed": {
"imageUrl": {
"type": "string",
"minLength": 1,
"maxLength": 2000,
"pattern": "\\s*https?:\/\/\\S+"
},
"color": {
"type": "object",
"properties": {
"description": {
"type": "string",
"minLength": 1,
"maxLength": 2000
"red": {
"type": "integer",
"minimum": 0,
"default": 0,
"maximum": 255
},
"imageUrl": {
"type": "string",
"minLength": 1,
"maxLength": 2000,
"pattern": "\\s*https?:\/\/\\S+"
"green": {
"type": "integer",
"minimum": 0,
"default": 0,
"maximum": 255
},
"color": {
"type": "object",
"properties": {
"red": {
"type": "integer",
"minimum": 0,
"default": 0,
"maximum": 255
},
"green": {
"type": "integer",
"minimum": 0,
"default": 0,
"maximum": 255
},
"blue": {
"type": "integer",
"minimum": 0,
"default": 0,
"maximum": 255
}
},
"required": [
"red",
"green",
"blue"
]
"blue": {
"type": "integer",
"minimum": 0,
"default": 0,
"maximum": 255
}
},
"required": [
"red",
"green",
"blue"
]
},
"author": {
"type": "object",
"properties": {
"userId": {
"minimum": 1,
"maximum": 18446744073709551615,
"type": "integer"
},
"author": {
"type": "object",
"properties": {
"userId": {
"minimum": 1,
"maximum": 18446744073709551615,
"type": "integer"
},
"useBot": {
"type": "boolean"
}
},
"additionalProperties": false,
"anyOf": [
{
"required": [
"userId"
]
},
{
"required": [
"useBot"
]
}
]
"useBot": {
"type": "boolean"
}
},
"additionalProperties": false,
"anyOf": [
{
"required": [
"description",
"author"
"userId"
]
},
{
"required": [
"imageUrl",
"author"
"useBot"
]
}
]
@@ -149,41 +130,56 @@
"anyOf": [
{
"required": [
"additionalMessage",
"position"
"description",
"author"
]
},
{
"required": [
"embed",
"position"
]
},
{
"required": [
"additionalMessage",
"embed",
"position"
"imageUrl",
"author"
]
}
]
}
},
"additionalProperties": false,
"anyOf": [
{
"required": [
"additionalMessage",
"position"
]
},
{
"required": [
"embed",
"position"
]
},
{
"required": [
"additionalMessage",
"embed",
"position"
]
}
]
}
},
"additionalProperties": false,
"required": [
"channelGroupName",
"messages"
]
}
}
},
"additionalProperties": false,
"required": [
"channelGroupName",
"messages"
]
}
},
"additionalProperties": false,
"required": [
"faqCommandName",
"responses"
]
}
]
}
},
"additionalProperties": false,
"required": [
"faqCommandName",
"responses"
]
}
}

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<artifactId>oneplus-bot-modules</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -14,6 +14,13 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling-int</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>

View File

@@ -5,7 +5,7 @@ import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.time.Instant;
@Builder

View File

@@ -12,7 +12,7 @@ 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 net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -113,7 +113,7 @@ public class NewsServiceBean {
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());
GuildMessageChannel newsChannel = channelService.getMessageChannelFromServer(serverId, newsPost.getNewsChannel().getId());
return channelService.editMessageInAChannelFuture(messageToSend, newsChannel, newsPost.getNewsMessageId())
.thenApply(message -> null);
}

View File

@@ -6,12 +6,12 @@ import dev.sheldan.abstracto.core.service.management.UserInServerManagementServi
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 jakarta.persistence.*;
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;

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application</groupId>
<artifactId>application</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -15,6 +15,7 @@
<module>setup</module>
<module>referral</module>
<module>faq</module>
<module>seasonal</module>
</modules>
<properties>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<artifactId>oneplus-bot-modules</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@ import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
import lombok.*;
import javax.persistence.*;
import jakarta.persistence.*;
import java.time.Instant;
@Builder

View File

@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>dev.sheldan.oneplus.bot.application</groupId>
<artifactId>application</artifactId>
<version>1.5.5</version>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<artifactId>oneplus-bot-modules</artifactId>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>database</artifactId>
<artifactId>seasonal</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<build>
<plugins>

View File

@@ -0,0 +1,24 @@
package dev.sheldan.oneplus.bot.modules.seasonal.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 SeasonalEntertainmentFeatureDefinition implements ModuleDefinition {
public static final String ENTERTAINMENT = "entertainment";
@Override
public ModuleInfo getInfo() {
return ModuleInfo
.builder()
.name(ENTERTAINMENT)
.templated(true)
.build();
}
@Override
public String getParentModule() {
return "default";
}
}

View File

@@ -0,0 +1,15 @@
package dev.sheldan.oneplus.bot.modules.seasonal.config;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import lombok.Getter;
@Getter
public enum SeasonalFeatureDefinition implements FeatureDefinition {
LIGHTS("lights");
private String key;
SeasonalFeatureDefinition(String key) {
this.key = key;
}
}

View File

@@ -0,0 +1,10 @@
package dev.sheldan.oneplus.bot.modules.seasonal.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource("classpath:seasonal.properties")
public class SeasonalProperties {
}

View File

@@ -0,0 +1,58 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.command;
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.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalEntertainmentFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.LightsRoleServiceBean;
import net.dv8tion.jda.api.entities.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class AddRoleToLights extends AbstractConditionableCommand {
@Autowired
private LightsRoleServiceBean lightsMemberServiceBean;
@Override
public CommandResult execute(CommandContext commandContext) {
List<Object> parameters = commandContext.getParameters().getParameters();
Role role = (Role) parameters.get(0);
if(!role.getGuild().equals(commandContext.getGuild())) {
throw new EntityGuildMismatchException();
}
lightsMemberServiceBean.addMemberToSeasonalLights(role);
return CommandResult.fromSuccess();
}
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(Parameter.builder().name("role").templated(true).type(Role.class).build());
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("addRoleToLights")
.module(SeasonalEntertainmentFeatureDefinition.ENTERTAINMENT)
.templated(true)
.supportsEmbedException(true)
.causesReaction(true)
.parameters(parameters)
.help(helpInfo)
.build();
}
@Override
public FeatureDefinition getFeature() {
return SeasonalFeatureDefinition.LIGHTS;
}
}

View File

@@ -0,0 +1,58 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.command;
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.abstracto.core.exception.EntityGuildMismatchException;
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalEntertainmentFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.LightsRoleServiceBean;
import net.dv8tion.jda.api.entities.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class RemoveRoleFromLights extends AbstractConditionableCommand {
@Autowired
private LightsRoleServiceBean lightsMemberServiceBean;
@Override
public CommandResult execute(CommandContext commandContext) {
List<Object> parameters = commandContext.getParameters().getParameters();
Role role = (Role) parameters.get(0);
if(!role.getGuild().equals(commandContext.getGuild())) {
throw new EntityGuildMismatchException();
}
lightsMemberServiceBean.removeMemberFromSeasonalLights(role);
return CommandResult.fromSuccess();
}
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(Parameter.builder().name("role").templated(true).type(Role.class).build());
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("removeRoleFromLights")
.module(SeasonalEntertainmentFeatureDefinition.ENTERTAINMENT)
.templated(true)
.supportsEmbedException(true)
.causesReaction(true)
.parameters(parameters)
.help(helpInfo)
.build();
}
@Override
public FeatureDefinition getFeature() {
return SeasonalFeatureDefinition.LIGHTS;
}
}

View File

@@ -0,0 +1,55 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.command;
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.seasonal.config.SeasonalEntertainmentFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.LightsRoleServiceBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@Component
public class SwitchLights extends AbstractConditionableCommand {
@Autowired
private LightsRoleServiceBean lightsMemberServiceBean;
@Override
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
return lightsMemberServiceBean.switchLights(commandContext.getGuild())
.thenApply(unused -> CommandResult.fromSuccess());
}
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
HelpInfo helpInfo = HelpInfo
.builder()
.templated(true)
.build();
return CommandConfiguration.builder()
.name("switchLights")
.module(SeasonalEntertainmentFeatureDefinition.ENTERTAINMENT)
.templated(true)
.async(true)
.causesReaction(true)
.supportsEmbedException(true)
.parameters(parameters)
.help(helpInfo)
.build();
}
@Override
public FeatureDefinition getFeature() {
return SeasonalFeatureDefinition.LIGHTS;
}
}

View File

@@ -0,0 +1,17 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.config;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.LightsRoleColor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.List;
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "abstracto.feature.lights")
public class LightsColorConfig {
private List<LightsRoleColor> colors;
}

View File

@@ -0,0 +1,16 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.config;
import dev.sheldan.abstracto.core.config.FeatureConfig;
import dev.sheldan.abstracto.core.config.FeatureDefinition;
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
import org.springframework.stereotype.Component;
@Component
public class LightsFeatureConfig implements FeatureConfig {
@Override
public FeatureDefinition getFeature() {
return SeasonalFeatureDefinition.LIGHTS;
}
}

View File

@@ -0,0 +1,18 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.models;
import lombok.Getter;
import lombok.Setter;
import java.awt.*;
@Getter
@Setter
public class LightsRoleColor {
private Integer r;
private Integer g;
private Integer b;
public Color toColor() {
return new Color(r, g, b);
}
}

View File

@@ -0,0 +1,31 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database;
import dev.sheldan.abstracto.core.models.database.ARole;
import dev.sheldan.abstracto.core.models.database.AServer;
import lombok.*;
import jakarta.persistence.*;
@Builder
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "lights_role")
@Getter
@Setter
@EqualsAndHashCode
public class LightsRole {
@Id
@Column(name = "id")
private Long id;
@Getter
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "server_id", nullable = false)
private AServer server;
@Getter
@ManyToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private ARole role;
}

View File

@@ -0,0 +1,13 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.repository;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database.LightsRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface LightsRoleRepository extends JpaRepository<LightsRole, Long> {
List<LightsRole> findByServer(AServer server);
}

View File

@@ -0,0 +1,81 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.service;
import dev.sheldan.abstracto.core.models.database.ARole;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.abstracto.core.service.RoleService;
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
import dev.sheldan.abstracto.core.utils.FutureUtils;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.config.LightsColorConfig;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database.LightsRole;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.management.LightsRoleServiceManagementBean;
import lombok.extern.slf4j.Slf4j;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.awt.*;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@Component
@Slf4j
public class LightsRoleServiceBean {
@Autowired
private ServerManagementService serverManagementService;
@Autowired
private LightsRoleServiceManagementBean serviceManagementBean;
@Autowired
private RoleManagementService roleManagementService;
@Autowired
private RoleService roleService;
@Autowired
private SecureRandom secureRandom;
@Autowired
private LightsColorConfig lightsColorConfig;
public void addMemberToSeasonalLights(Role role) {
ARole aRole = roleManagementService.findRole(role.getIdLong());
log.info("Adding {} to lights for guild {}.", role.getId(), role.getGuild().getId());
serviceManagementBean.addMemberToLights(aRole);
}
public void removeMemberFromSeasonalLights(Role role) {
ARole aRole = roleManagementService.findRole(role.getIdLong());
log.info("Removing {} from lights for guild {}.", role.getId(), role.getGuild().getId());
serviceManagementBean.removeMemberFromLights(aRole);
}
public CompletableFuture<Void> switchLights(Guild guild) {
log.info("Switching lights in guild {}", guild.getIdLong());
AServer server = serverManagementService.loadServer(guild.getIdLong());
List<LightsRole> lightUsers = serviceManagementBean.getLightsUserInServer(server);
List<Long> roleIds = lightUsers
.stream()
.map(lightsMember -> lightsMember.getRole().getId())
.distinct()
.collect(Collectors.toList());
List<CompletableFuture<Void>> futures = new ArrayList<>();
roleIds.forEach(roleId -> {
Role foundRole = guild.getRoleById(roleId);
if(foundRole != null) {
futures.add(roleService.setRoleColorTo(foundRole, getRandomColor()));
}
});
return FutureUtils.toSingleFutureGeneric(futures);
}
private Color getRandomColor() {
return lightsColorConfig.getColors().get(secureRandom.nextInt(lightsColorConfig.getColors().size())).toColor();
}
}

View File

@@ -0,0 +1,37 @@
package dev.sheldan.oneplus.bot.modules.seasonal.lights.service.management;
import dev.sheldan.abstracto.core.models.database.ARole;
import dev.sheldan.abstracto.core.models.database.AServer;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database.LightsRole;
import dev.sheldan.oneplus.bot.modules.seasonal.lights.repository.LightsRoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class LightsRoleServiceManagementBean {
@Autowired
private LightsRoleRepository lightMemberRepository;
public void addMemberToLights(ARole aRole) {
if(!lightMemberRepository.existsById(aRole.getId())) {
LightsRole member = LightsRole
.builder()
.id(aRole.getId())
.server(aRole.getServer())
.role(aRole)
.build();
lightMemberRepository.save(member);
}
}
public void removeMemberFromLights(ARole aRole) {
lightMemberRepository.deleteById(aRole.getId());
}
public List<LightsRole> getLightsUserInServer(AServer server) {
return lightMemberRepository.findByServer(server);
}
}

View File

@@ -6,5 +6,6 @@
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="structure/structure.xml" relativeToChangelogFile="true"/>
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -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" >
<property name="lightsFeature" value="(SELECT id FROM feature WHERE key = 'lights')"/>
<property name="entertainmentModule" value="(SELECT id FROM module WHERE name = 'entertainment')"/>
<changeSet author="Sheldan" id="lights-commands" >
<insert tableName="command">
<column name="name" value="addRoleToLights"/>
<column name="module_id" valueComputed="${entertainmentModule}"/>
<column name="feature_id" valueComputed="${lightsFeature}"/>
</insert>
<insert tableName="command">
<column name="name" value="removeRoleFromLights"/>
<column name="module_id" valueComputed="${entertainmentModule}"/>
<column name="feature_id" valueComputed="${lightsFeature}"/>
</insert>
<insert tableName="command">
<column name="name" value="switchLights"/>
<column name="module_id" valueComputed="${entertainmentModule}"/>
<column name="feature_id" valueComputed="${lightsFeature}"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -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="command.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -6,14 +6,9 @@
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="create_grafana_user">
<sql>
CREATE USER ${abstractografanadbuser} WITH PASSWORD '${abstractografanadbpass}';
GRANT CONNECT ON DATABASE abstracto TO ${abstractografanadbuser};
GRANT USAGE ON SCHEMA abstracto TO ${abstractografanadbuser};
GRANT SELECT ON ALL TABLES IN SCHEMA abstracto TO ${abstractografanadbuser};
ALTER DEFAULT PRIVILEGES IN SCHEMA abstracto
GRANT SELECT ON TABLES TO ${abstractografanadbuser};
</sql>
<changeSet author="Sheldan" id="seasonal_lights_feature-insertion">
<insert tableName="feature">
<column name="key" value="lights"/>
</insert>
</changeSet>
</databaseChangeLog>

View File

@@ -0,0 +1,44 @@
<?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="lights_role-table">
<createTable tableName="lights_role">
<column name="id" type="BIGINT">
<constraints nullable="true" primaryKey="true" primaryKeyName="pk_lights_role"/>
</column>
<column name="server_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="role_id" type="BIGINT">
<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="server_id" baseTableName="lights_role" constraintName="fk_lights_role_server"
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
referencedColumnNames="id" referencedTableName="server" validate="true"/>
<addForeignKeyConstraint baseColumnNames="id" baseTableName="lights_role" constraintName="fk_lights_role_role"
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
referencedColumnNames="id" referencedTableName="role" validate="true"/>
<sql>
DROP TRIGGER IF EXISTS lights_role_update_trigger ON lights_role;
CREATE TRIGGER lights_role_update_trigger BEFORE UPDATE ON lights_role FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
</sql>
<sql>
DROP TRIGGER IF EXISTS lights_role_insert_trigger ON lights_role;
CREATE TRIGGER lights_role_insert_trigger BEFORE INSERT ON lights_role FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
</sql>
</changeSet>
</databaseChangeLog>

View File

@@ -6,5 +6,5 @@
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="grafana_user.xml" relativeToChangelogFile="true"/>
<include file="lights_role.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -6,5 +6,5 @@
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.5.4/collection.xml" relativeToChangelogFile="true"/>
<include file="1.5.9/collection.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@@ -0,0 +1,30 @@
abstracto.featureFlags.lights.featureName=lights
abstracto.featureFlags.lights.enabled=false
abstracto.feature.lights.colors[0].r=12
abstracto.feature.lights.colors[0].g=169
abstracto.feature.lights.colors[0].b=12
abstracto.feature.lights.colors[1].r=206
abstracto.feature.lights.colors[1].g=13
abstracto.feature.lights.colors[1].b=13
abstracto.feature.lights.colors[2].r=255
abstracto.feature.lights.colors[2].g=255
abstracto.feature.lights.colors[2].b=255
abstracto.feature.lights.colors[3].r=148
abstracto.feature.lights.colors[3].g=125
abstracto.feature.lights.colors[3].b=0
abstracto.feature.lights.colors[4].r=77
abstracto.feature.lights.colors[4].g=106
abstracto.feature.lights.colors[4].b=255
abstracto.feature.lights.colors[5].r=166
abstracto.feature.lights.colors[5].g=51
abstracto.feature.lights.colors[5].b=222
abstracto.feature.lights.colors[6].r=246
abstracto.feature.lights.colors[6].g=232
abstracto.feature.lights.colors[6].b=63

View File

@@ -3,7 +3,7 @@
<parent>
<artifactId>oneplus-bot-modules</artifactId>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,18 +5,17 @@
<parent>
<groupId>dev.sheldan.oneplus.bot</groupId>
<artifactId>oneplusbot</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<groupId>dev.sheldan.oneplus.bot.application</groupId>
<artifactId>application</artifactId>
<packaging>pom</packaging>
<version>1.5.5</version>
<version>1.6.9</version>
<modules>
<module>executable</module>
<module>oneplus-bot-customizations</module>
<module>oneplus-bot-modules</module>
<module>database</module>
</modules>
<dependencyManagement>
@@ -38,15 +37,7 @@
<artifactId>core-int</artifactId>
</dependency>
<dependency>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility-int</artifactId>
</dependency>
<dependency>
<groupId>dev.sheldan.abstracto.scheduling</groupId>
<artifactId>scheduling-int</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,34 +0,0 @@
<?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.deployment</groupId>
<artifactId>deployment</artifactId>
<version>1.5.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>docker-compose</artifactId>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly-docker-compose-configuration</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/docker-compose.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,19 +0,0 @@
<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>docker-compose</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>./docker-compose</outputDirectory>
<directory>${project.basedir}/src/main/resources/</directory>
<includes>
<include>**/*</include>
</includes>
<filtered>true</filtered>
</fileSet>
</fileSets>
</assembly>

View File

@@ -1,31 +0,0 @@
# database configuration
DATABASE_HOST=database
DATABASE_PORT=5432
DATABASE_USER=abstracto
DATABASE_NAME=abstracto
DATABASE_PASSWORD=abstracto
GRAFANA_DATABASE_PASSWORD=grafana
GRAFANA_DATABASE_USER=grafana
# deployment configuration, whether or not the container should execute the parts on startup
EXECUTE_DEPLOYMENT=true
EXECUTE_LIQUIBASE=true
EXECUTE_TEMPLATES=true
# whether or not remote debug should be enabled on the application
REMOTE_DEBUG=false
DEBUG_PORT=5005
TOMCAT_PORT=8080
# authentication for actuator endpoints
REST_USER_NAME=abstracto
REST_PASSWORD=password
# port grafana will be reachable
GRAFANA_PORT=3000
# port prometheus will be reachable
PROMETHEUS_PORT=9090
# port pg admin will be reachable
PGADMIN_PORT=5050
# default authentication for pg admin
PGADMIN_DEFAULT_EMAIL=sheldan@sheldan.dev
PGADMIN_DEFAULT_PASSWORD=admin
TOKEN=<INSERT TOKEN>
YOUTUBE_API_KEY=<INSERT KEY>
ONEPLUS_BOT_VERSION=1.5.5

View File

@@ -1,10 +0,0 @@
# Setup for local docker-compose deployment
* Install docker [here](https://docs.docker.com/get-docker/)
* Install docker-compose [here](https://docs.docker.com/compose/install/).
* Execute `docker-compose build` in `image-packaging`.
* Fill out values in `.env` for token and database password. There are some default values, but token is required to be changed.
* Execute `fill-prometheus-file-sh` in order to populate the prometheus config with the correct password (https://github.com/prometheus/prometheus/issues/2357)
* Execute `docker-compose up` in this directory and wait for completion.
* Per default pgAdmin is available on `localhost:5050` with the configured user and password. It will contain a configuration in the servers list.

View File

@@ -1,122 +0,0 @@
version: '3.7'
services:
db:
image: ${REGISTRY_PREFIX}oneplus_bot_database:${ONEPLUS_BOT_VERSION}
container_name: database
restart: always
environment:
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_USER: ${DATABASE_USER}
ports:
- "127.0.0.1:${DATABASE_PORT}:5432"
networks:
- oneplusbot
volumes:
- db-data:/var/lib/postgresql/data
deployment_container:
container_name: deployment
image: ${REGISTRY_PREFIX}oneplus_bot_deployment:${ONEPLUS_BOT_VERSION}
depends_on:
- db
environment:
DB_PASS: ${DATABASE_PASSWORD}
DB_HOST: ${DATABASE_HOST}
DB_PORT: ${DATABASE_PORT}
DB_USER: ${DATABASE_USER}
DB_NAME: ${DATABASE_NAME}
ABSTRACTO_GRAFANA_DB_PASS: ${GRAFANA_DATABASE_PASSWORD}
ABSTRACTO_GRAFANA_DB_USER: ${GRAFANA_DATABASE_USER}
EXECUTE_DEPLOYMENT: ${EXECUTE_DEPLOYMENT}
EXECUTE_LIQUIBASE: ${EXECUTE_LIQUIBASE}
EXECUTE_TEMPLATES: ${EXECUTE_TEMPLATES}
LIQUIBASE_PATH: ${LIQUIBASE_PATH:-/liquibase}
POSTGRES_DRIVER_PATH: ${EXECUTE_DEPLOYMENT:-/postgres/driver.jar}
WAIT_HOSTS: database:5432
networks:
- oneplusbot
bot:
image: ${REGISTRY_PREFIX}oneplus_bot:${ONEPLUS_BOT_VERSION}
depends_on:
- db
- deployment_container
restart: on-failure
container_name: oneplusbot
environment:
TOKEN: ${TOKEN}
REMOTE_DEBUG: ${REMOTE_DEBUG}
DB_PASS: ${DATABASE_PASSWORD}
DB_HOST: ${DATABASE_HOST}
DB_PORT: ${DATABASE_PORT}
DB_USER: ${DATABASE_USER}
DB_NAME: ${DATABASE_NAME}
REST_USER_NAME: ${REST_USER_NAME}
REST_PASSWORD: ${REST_PASSWORD}
YOUTUBE_API_KEY: ${YOUTUBE_API_KEY}
command: sh -c "while ping -c1 deployment_container &>/dev/null; do sleep 1; done; echo 'Liquibase finished!' && ./start.sh"
ports:
- "127.0.0.1:${DEBUG_PORT}:5005"
- "127.0.0.1:${TOMCAT_PORT}:8080"
networks:
- oneplusbot
volumes:
- bot-logs:/logs
- ./config:/config
pgadmin:
container_name: pgadmin
image: ${REGISTRY_PREFIX}oneplus_bot_pg_admin:${ONEPLUS_BOT_VERSION}
depends_on:
- db
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
ports:
- "127.0.0.1:${PGADMIN_PORT}:80"
restart: unless-stopped
networks:
- oneplusbot
prometheus:
container_name: prometheus
image: ${REGISTRY_PREFIX}oneplus_bot_prometheus:${ONEPLUS_BOT_VERSION}
depends_on:
- bot
ports:
- "127.0.0.1:${PROMETHEUS_PORT}:9090"
restart: unless-stopped
networks:
- oneplusbot
volumes:
- ./res/prometheus-scrapper-password-filled:/etc/prometheus/micrometer_password
- prometheus-data:/prometheus
grafana:
container_name: grafana
image: ${REGISTRY_PREFIX}oneplus_bot_grafana:${ONEPLUS_BOT_VERSION}
depends_on:
- prometheus
- bot
ports:
- "127.0.0.1:${GRAFANA_PORT}:3000"
restart: unless-stopped
environment:
DB_PASS: ${GRAFANA_DATABASE_PASSWORD}
DB_HOST: ${DATABASE_HOST}
DB_PORT: ${DATABASE_PORT}
DB_USER: ${GRAFANA_DATABASE_USER}
DB_NAME: ${DATABASE_NAME}
PROMETHEUS_HOST: 'prometheus'
PROMETHEUS_PORT: 9090
volumes:
- grafana-user-data:/var/lib/grafana
networks:
- oneplusbot
networks:
oneplusbot:
driver: bridge
name: oneplusbot-network
volumes:
db-data:
grafana-user-data:
prometheus-data:
bot-logs:

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -o allexport
source .env
set +o allexport
envsubst < res/prometheus-scrapper-password > res/prometheus-scrapper-password-filled

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: oneplus-bot
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.6.9
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.6.9"

View File

@@ -0,0 +1,4 @@
base_url: {{ $.Values.grafanaDeployment.grafana.host }}
username: {{ $.Values.grafanaDeployment.grafana.basicAuth.username }}
password: {{ $.Values.grafanaDeployment.grafana.basicAuth.password }}
folder_name: OnePlusBot

View File

@@ -0,0 +1,939 @@
{
"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(discord_api_interactions_total{namespace=\"oneplus-bot\"}[1m]) /2",
"instant": false,
"legendFormat": "{{ "{{" }} action {{ "}}" }}",
"range": true,
"refId": "A"
}
],
"title": "Discord API Interaction",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(command_processed_total{namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "{{ "{{" }}type{{ "}}" }}-{{ "{{" }}status{{ "}}" }}",
"range": true,
"refId": "A"
}
],
"title": "Commands processed",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 3,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(message_total{namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "{{ "{{" }} action {{ "}}" }}",
"range": true,
"refId": "A"
}
],
"title": "Message events",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"id": 4,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(okhttp_request_total{namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "{{ "{{" }} http_code {{ "}}" }}",
"range": true,
"refId": "A"
}
],
"title": "HTTP Reponse codes",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 16
},
"id": 5,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(cache_evictions_total{application=\"$application\", cache=\"messages\", namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "Cache evictions",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(cache_gets_total{application=\"$application\", cache=\"messages\", namespace=\"oneplus-bot\"}[1m]) / 2",
"hide": false,
"instant": false,
"legendFormat": "Cache gets {{ "{{" }} result {{ "}}" }}",
"range": true,
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(cache_puts_total{application=\"$application\", cache=\"messages\", namespace=\"oneplus-bot\"}[1m]) / 2",
"hide": false,
"instant": false,
"legendFormat": "Cache puts",
"range": true,
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(cache_removals{application=\"$application\", cache=\"messages\", namespace=\"oneplus-bot\"}[1m]) / 2",
"hide": false,
"instant": false,
"legendFormat": "Cache removals",
"range": true,
"refId": "D"
}
],
"title": "Message cache statistic",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 16
},
"id": 6,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "discord_gateway_ping{namespace=\"oneplus-bot\"}",
"instant": false,
"legendFormat": "Gateway ping",
"range": true,
"refId": "A"
}
],
"title": "Gateway ping",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 24
},
"id": 7,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(starboard_stars_total{namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "{{ "{{" }} action {{ "}}" }}",
"range": true,
"refId": "A"
}
],
"title": "Starboard reactions",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 24
},
"id": 8,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(emote_usages_total{namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "Used emotes",
"range": true,
"refId": "A"
}
],
"title": "Used tracked emotes",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 16,
"w": 24,
"x": 0,
"y": 32
},
"id": 9,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"editorMode": "code",
"expr": "increase(jda_event_total{namespace=\"oneplus-bot\"}[1m]) / 2",
"instant": false,
"legendFormat": "{{ "{{" }} event_class {{ "}}" }}",
"range": true,
"refId": "A"
}
],
"title": "JDA Events",
"type": "timeseries"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"hide": 2,
"label": "",
"name": "application",
"query": "OnePlusBot",
"skipUrlSync": false,
"type": "constant"
}
]
},
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "OnePlusBot Discord status",
"uid": "8e3188c3-4ea2-4223-865e-d1681f1ef0fb",
"version": 2,
"weekStart": ""
},
"overwrite": true
}

View File

@@ -0,0 +1,238 @@
{
"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Overview over logging outputs of OnePlusBot",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"description": "Display logs and search for logs",
"gridPos": {
"h": 13,
"w": 24,
"x": 0,
"y": 0
},
"id": 4,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Ascending",
"wrapLogMessage": true
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"editorMode": "builder",
"expr": "{app=\"OnePlusBot\", namespace=\"oneplus-bot\"} |= `$logFilter`",
"maxLines": 5000,
"queryType": "range",
"refId": "A"
}
],
"title": "OnePlusBot Logs",
"type": "logs"
},
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"description": "Any line on level ERROR",
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 13
},
"id": 2,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Ascending",
"wrapLogMessage": true
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"editorMode": "code",
"expr": "{app=\"OnePlusBot\", namespace=\"oneplus-bot\"} |= \"ERROR\"",
"maxLines": 5000,
"queryType": "range",
"refId": "A"
}
],
"title": "OnePlusBot Error Logs",
"type": "logs"
},
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"description": "Number of log events",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 13
},
"id": 3,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "loki"
},
"editorMode": "code",
"expr": "rate({app=\"OnePlusBot\", namespace=\"oneplus-bot\"}[$__interval])",
"queryType": "range",
"refId": "A"
}
],
"title": "Log Rate",
"type": "timeseries"
}
],
"refresh": "",
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "",
"value": ""
},
"description": "What to search in the logs",
"hide": 0,
"name": "logFilter",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"skipUrlSync": false,
"type": "textbox"
}
]
},
"time": {
"from": "now-30m",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "OnePlus Bot Logs",
"uid": "b30e19ce-eb4b-4534-bf51-9fd7da75f606",
"version": 2,
"weekStart": ""
},
"overwrite": true
}

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "oneplusBot.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "oneplusBot.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "oneplusBot.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "oneplusBot.labels" -}}
helm.sh/chart: {{ include "oneplusBot.chart" . }}
{{ include "oneplusBot.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "oneplusBot.selectorLabels" -}}
app.kubernetes.io/name: {{ include "oneplusBot.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "oneplusBot.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "oneplusBot.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: api-keys
data:
discordToken: {{ $.Values.apiKeys.discord.token | b64enc }} # b64enc is needed, because a stringData secret field cannot hold numeric values
youtubeApiKey: {{ $.Values.apiKeys.youtube.apiKey | b64enc }}

View File

@@ -0,0 +1,69 @@
{{- if .Values.dbConfigDeployment.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
{{- $deploymentJobName := print ((include "oneplusBot.fullname" .) | trunc 39) "-db-config-deployment-job" }}
name: {{ $deploymentJobName | trunc 63 }}
annotations:
"helm.sh/hook": pre-upgrade,pre-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: db-config-deployment-job
image: "{{ $.Values.dbConfigDeployment.repository }}/{{ $.Values.dbConfigDeployment.image }}:{{ $.Values.dbConfigDeployment.tag | default .Chart.AppVersion}}"
imagePullPolicy: {{ $.Values.dbConfigDeployment.pullPolicy }}
args:
- "/var/db-config/"
env:
- name: DB_PASS
valueFrom:
secretKeyRef:
name: db-credentials
key: dbPassword
- name: DB_HOST
valueFrom:
secretKeyRef:
name: db-credentials
key: dbHost
- name: DB_PORT
valueFrom:
secretKeyRef:
name: db-credentials
key: dbPort
- name: DB_USER
valueFrom:
secretKeyRef:
name: db-credentials
key: dbUser
- name: DB_NAME
valueFrom:
secretKeyRef:
name: db-credentials
key: dbName
- name: DB_SCHEME
value: "abstracto"
volumeMounts:
- mountPath: "/var/db-config/"
name: database-config-mount
restartPolicy: Never
initContainers:
- name: database-config-data
image: "{{ $.Values.dbConfigDeploymentData.repository }}/{{ $.Values.dbConfigDeploymentData.image }}:{{ $.Values.dbConfigDeploymentData.tag | default .Chart.AppVersion}}"
imagePullPolicy: {{ $.Values.dbConfigDeploymentData.pullPolicy }}
volumeMounts:
- mountPath: "/var/run-config"
name: database-config-mount
volumes:
- name: database-config-mount
emptyDir: {}
backoffLimit: 4
{{- end }}

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
name: db-credentials
annotations:
"helm.sh/hook": pre-upgrade,pre-install
"helm.sh/hook-weight": "-6"
data:
dbPassword: {{ $.Values.dbCredentials.password | b64enc }} # b64enc is needed, because a stringData secret field cannot hold numeric values
dbUser: {{ $.Values.dbCredentials.userName | b64enc }}
dbHost: {{ $.Values.dbCredentials.host | b64enc }}
dbPort: {{ $.Values.dbCredentials.port | b64enc }}
dbName: {{ $.Values.dbCredentials.name | b64enc }}

View File

@@ -0,0 +1,106 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "oneplusBot.fullname" . }}
labels:
{{- include "oneplusBot.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "oneplusBot.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "oneplusBot.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "oneplusBot.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.bot.repository }}/{{ .Values.bot.image }}:{{ .Values.bot.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.bot.pullPolicy }}
env:
- name: DB_PASS
valueFrom:
secretKeyRef:
name: db-credentials
key: dbPassword
- name: DB_HOST
valueFrom:
secretKeyRef:
name: db-credentials
key: dbHost
- name: DB_PORT
valueFrom:
secretKeyRef:
name: db-credentials
key: dbPort
- name: DB_USER
valueFrom:
secretKeyRef:
name: db-credentials
key: dbUser
- name: DB_NAME
valueFrom:
secretKeyRef:
name: db-credentials
key: dbName
- name: TOKEN
valueFrom:
secretKeyRef:
name: api-keys
key: discordToken
- name: OPEN_WEATHER_MAP_API_KEY
value: "placeholder" # a value is required, if the webservices module is loaded, but weather not used
- name: YOUTUBE_API_KEY
valueFrom:
secretKeyRef:
name: api-keys
key: youtubeApiKey
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
- name: debug
containerPort: 5005
protocol: TCP
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: {{ $.Values.bot.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ $.Values.bot.livenessProbe.periodSeconds }}
failureThreshold: {{ $.Values.bot.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: {{ $.Values.bot.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ $.Values.bot.readinessProbe.periodSeconds }}
failureThreshold: {{ $.Values.bot.readinessProbe.failureThreshold }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,42 @@
{{- if $.Values.grafanaDeployment.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: grafana-dashboard-deployment-job
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-4"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: template-deployment-job
image: "{{ $.Values.grafanaDeployment.repository }}/{{ $.Values.grafanaDeployment.image }}:{{ $.Values.grafanaDeployment.tag }}"
imagePullPolicy: {{ $.Values.grafanaDeployment.pullPolicy }}
args:
- "/var/userconfig"
volumeMounts:
- mountPath: "/var/userconfig"
name: grafana-dashboard-config
readOnly: true
volumes:
- name: grafana-dashboard-config
secret:
secretName: grafana-dashboard-config
restartPolicy: Never
backoffLimit: 4
---
apiVersion: v1
kind: Secret
metadata:
name: grafana-dashboard-config
data:
config.yaml: {{ (tpl (.Files.Get "configuration/grafana/config.yaml") . ) | b64enc }}
log-dashboard.json: {{ (tpl (.Files.Get "configuration/grafana/oneplus-bot-log-dashboard.json") . ) | b64enc }}
discord-dashboard.json: {{ (tpl (.Files.Get "configuration/grafana/oneplus-bot-discord-dashboard.json") . ) | b64enc }}
{{- end }}

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "oneplusBot.fullname" . }}
labels:
{{- include "oneplusBot.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "oneplusBot.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "oneplusBot.serviceAccountName" . }}
labels:
{{- include "oneplusBot.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,69 @@
{{- if .Values.dbConfigDeployment.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
{{- $deploymentJobName := print ((include "oneplusBot.fullname" .) | trunc 39) "-template-deployment-job" }}
name: {{ $deploymentJobName | trunc 63 }}
annotations:
"helm.sh/hook": pre-upgrade,pre-install
"helm.sh/hook-weight": "-4"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: template-deployment-job
image: "{{ $.Values.templateDeployment.repository }}/{{ $.Values.templateDeployment.image }}:{{ $.Values.templateDeployment.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ $.Values.templateDeployment.pullPolicy }}
args:
- "/var/template-config/"
env:
- name: DB_PASS
valueFrom:
secretKeyRef:
name: db-credentials
key: dbPassword
- name: DB_HOST
valueFrom:
secretKeyRef:
name: db-credentials
key: dbHost
- name: DB_PORT
valueFrom:
secretKeyRef:
name: db-credentials
key: dbPort
- name: DB_USER
valueFrom:
secretKeyRef:
name: db-credentials
key: dbUser
- name: DB_NAME
valueFrom:
secretKeyRef:
name: db-credentials
key: dbName
- name: DB_SCHEME
value: "abstracto."
volumeMounts:
- mountPath: "/var/template-config/"
name: template-config-mount
initContainers:
- name: database-config-data
image: "{{ $.Values.templateDeploymentData.repository }}/{{ $.Values.templateDeploymentData.image }}:{{ $.Values.templateDeploymentData.tag | default .Chart.AppVersion}}"
imagePullPolicy: {{ $.Values.templateDeploymentData.pullPolicy }}
volumeMounts:
- mountPath: "/var/run-config"
name: template-config-mount
volumes:
- name: template-config-mount
emptyDir: {}
restartPolicy: Never
backoffLimit: 4
{{- end }}

View File

@@ -0,0 +1,125 @@
# Default values for oneplus-bot.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
bot:
repository: harbor.sheldan.dev/oneplus-bot
pullPolicy: IfNotPresent
image: oneplus-bot-image
tag: 1.6.9
livenessProbe:
initialDelaySeconds: 60
periodSeconds: 5
failureThreshold: 3
readinessProbe:
initialDelaySeconds: 60
periodSeconds: 5
failureThreshold: 3
templateDeployment:
enabled: true
repository: harbor.sheldan.dev/abstracto
pullPolicy: Always
image: abstracto-template-deployment
tag: 1.5.9
templateDeploymentData:
repository: harbor.sheldan.dev/oneplus-bot
pullPolicy: Always
image: oneplus-bot-template-data
tag: 1.6.9
dbConfigDeployment:
enabled: true
repository: harbor.sheldan.dev/abstracto
pullPolicy: Always
image: abstracto-db-deployment
tag: 1.5.9
dbConfigDeploymentData:
repository: harbor.sheldan.dev/oneplus-bot
pullPolicy: Always
image: oneplus-bot-db-data
tag: 1.6.9
dbCredentials:
host:
port:
userName:
password:
name:
grafanaDeployment:
repository: harbor.sheldan.dev/grafana-tools
pullPolicy: Always
image: grafana-dashboard-deployment
tag: 0.0.2
enabled: true
grafana:
host:
basicAuth:
username:
password:
apiKeys:
discord:
token:
youtube:
apiKey:
openWeatherMap:
apiKey:
twitch:
secret:
clientId:
imagePullSecrets:
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 8080
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/actuator/prometheus"
prometheus.io/port: "8080"
resources:
limits:
cpu:
memory:
requests:
cpu:
memory:
nodeSelector: {}
tolerations: []
affinity: {}

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
<artifactId>deployment</artifactId>
<version>1.5.5</version>
<version>1.6.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -49,7 +49,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>core.zip</destFileName>
</artifactItem>
@@ -59,7 +59,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>experience-tracking.zip</destFileName>
</artifactItem>
@@ -69,7 +69,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>assignable-roles.zip</destFileName>
</artifactItem>
@@ -79,7 +79,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>anti-raid.zip</destFileName>
</artifactItem>
@@ -89,7 +89,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>voice-channel-context.zip</destFileName>
</artifactItem>
@@ -99,7 +99,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>modmail.zip</destFileName>
</artifactItem>
@@ -109,7 +109,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>moderation.zip</destFileName>
</artifactItem>
@@ -119,7 +119,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>entertainment.zip</destFileName>
</artifactItem>
<artifactItem>
@@ -128,7 +128,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>link-embed.zip</destFileName>
</artifactItem>
<artifactItem>
@@ -137,7 +137,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>starboard.zip</destFileName>
</artifactItem>
<artifactItem>
@@ -146,7 +146,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>utility.zip</destFileName>
</artifactItem>
@@ -156,7 +156,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>webservices.zip</destFileName>
</artifactItem>
@@ -166,7 +166,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>remind.zip</destFileName>
</artifactItem>
@@ -176,7 +176,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>suggestion.zip</destFileName>
</artifactItem>
@@ -186,7 +186,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>invite-filter.zip</destFileName>
</artifactItem>
@@ -196,7 +196,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>statistic.zip</destFileName>
</artifactItem>
@@ -206,7 +206,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>logging.zip</destFileName>
</artifactItem>
@@ -216,17 +216,17 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>profanity-filter.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
<artifactId>starboard-custom-templates</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
<artifactId>starboard-customization-templates</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>starboard-custom.zip</destFileName>
</artifactItem>
@@ -236,7 +236,7 @@
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>news.zip</destFileName>
</artifactItem>
@@ -246,7 +246,7 @@
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>referral.zip</destFileName>
</artifactItem>
@@ -256,7 +256,7 @@
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>faq.zip</destFileName>
</artifactItem>
@@ -268,7 +268,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>core.zip</destFileName>
</artifactItem>
@@ -278,7 +278,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>modmail.zip</destFileName>
</artifactItem>
@@ -288,7 +288,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>assignable-roles.zip</destFileName>
</artifactItem>
@@ -298,7 +298,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>anti-raid.zip</destFileName>
</artifactItem>
@@ -308,7 +308,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>voice-channel-context.zip</destFileName>
</artifactItem>
@@ -318,7 +318,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>utility.zip</destFileName>
</artifactItem>
@@ -328,7 +328,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>experience-tracking.zip</destFileName>
</artifactItem>
@@ -338,7 +338,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>entertainment.zip</destFileName>
</artifactItem>
@@ -348,7 +348,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>moderation.zip</destFileName>
</artifactItem>
@@ -358,7 +358,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>link-embed.zip</destFileName>
</artifactItem>
@@ -368,27 +368,17 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>starboard.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
<artifactId>utility</artifactId>
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<destFileName>utility.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
<artifactId>webservices</artifactId>
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>webservices.zip</destFileName>
</artifactItem>
@@ -398,7 +388,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>remind.zip</destFileName>
</artifactItem>
@@ -408,7 +398,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>suggestion.zip</destFileName>
</artifactItem>
@@ -418,7 +408,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>invite-filter.zip</destFileName>
</artifactItem>
@@ -428,7 +418,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>statistic.zip</destFileName>
</artifactItem>
@@ -438,7 +428,7 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>profanity-filter.zip</destFileName>
</artifactItem>
@@ -448,78 +438,88 @@
<version>${abstracto.templates.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>logging.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<artifactId>starboard-custom-translations</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
<artifactId>starboard-customization-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>starboard-custom.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<artifactId>moderation-custom</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
<artifactId>moderation-customization-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>moderation-custom.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
<artifactId>dynamic-activity-custom-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>dynamic-activity-custom-translations.zip</destFileName>
</artifactItem>
<!-- custom -->
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
<artifactId>news-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>news.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
<artifactId>setup-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>setup.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
<artifactId>referral-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>referral.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
<artifactId>seasonal-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>seasonal.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
<artifactId>faq-translations</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>faq.zip</destFileName>
</artifactItem>
@@ -531,7 +531,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>scheduling.zip</destFileName>
</artifactItem>
@@ -542,7 +542,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>core.zip</destFileName>
</artifactItem>
@@ -553,7 +553,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>assignable-roles.zip</destFileName>
</artifactItem>
@@ -564,7 +564,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>anti-raid.zip</destFileName>
</artifactItem>
@@ -575,7 +575,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>voice-channel-context.zip</destFileName>
</artifactItem>
@@ -586,21 +586,10 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>dynamic-activity.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>utility-impl</artifactId>
<version>${abstracto.version}</version>
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<destFileName>utility.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.abstracto.modules</groupId>
<artifactId>modmail-impl</artifactId>
@@ -608,7 +597,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>modmail.zip</destFileName>
</artifactItem>
@@ -619,7 +608,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>moderation.zip</destFileName>
</artifactItem>
@@ -630,7 +619,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>experience-tracking.zip</destFileName>
</artifactItem>
@@ -641,7 +630,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>entertainment.zip</destFileName>
</artifactItem>
@@ -652,7 +641,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>link-embed.zip</destFileName>
</artifactItem>
@@ -663,7 +652,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>starboard.zip</destFileName>
</artifactItem>
@@ -675,7 +664,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>utility.zip</destFileName>
</artifactItem>
@@ -686,7 +675,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>webservices.zip</destFileName>
</artifactItem>
@@ -697,7 +686,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>remind.zip</destFileName>
</artifactItem>
@@ -708,7 +697,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>suggestion.zip</destFileName>
</artifactItem>
@@ -719,7 +708,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>invite-filter.zip</destFileName>
</artifactItem>
@@ -730,7 +719,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>statistic.zip</destFileName>
</artifactItem>
@@ -741,7 +730,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>profanity-filter.zip</destFileName>
</artifactItem>
@@ -752,7 +741,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>logging.zip</destFileName>
</artifactItem>
@@ -764,7 +753,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>starboard-custom.zip</destFileName>
</artifactItem>
@@ -775,7 +764,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>moderation-custom.zip</destFileName>
</artifactItem>
@@ -786,7 +775,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>dynamic-activity-custom.zip</destFileName>
</artifactItem>
@@ -797,7 +786,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>news.zip</destFileName>
</artifactItem>
@@ -808,7 +797,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>setup.zip</destFileName>
</artifactItem>
@@ -819,7 +808,7 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>referral.zip</destFileName>
</artifactItem>
@@ -830,92 +819,92 @@
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>faq.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.application</groupId>
<artifactId>database</artifactId>
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
<artifactId>seasonal</artifactId>
<version>${project.version}</version>
<classifier>liquibase</classifier>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
<destFileName>database.zip</destFileName>
<outputDirectory>${file.basedir}/db-data/liquibase-artifacts/</outputDirectory>
<destFileName>seasonal.zip</destFileName>
</artifactItem>
<!-- overrides -->
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
<artifactId>core</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
<artifactId>core-template-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>overrides-templates-core.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
<artifactId>webservices</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
<artifactId>webservices-template-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>overrides-templates-webservices.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
<artifactId>logging</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
<artifactId>logging-template-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>overrides-templates-logging.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
<artifactId>statistic</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
<artifactId>statistic-template-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>overrides-templates-statistic.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
<artifactId>modmail</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
<artifactId>modmail-template-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>overrides-templates-modmail.zip</destFileName>
</artifactItem>
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
<artifactId>moderation</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
<artifactId>moderation-template-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/template-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/template-artifacts/</outputDirectory>
<destFileName>overrides-templates-moderation.zip</destFileName>
</artifactItem>
<!-- overrides translations -->
<artifactItem>
<groupId>dev.sheldan.oneplus.bot.templates.overrides.translations</groupId>
<artifactId>moderation</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.translations.overrides</groupId>
<artifactId>moderation-translation-overrides</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
<outputDirectory>${file.basedir}/template-data/translation-artifacts/</outputDirectory>
<destFileName>overrides-translation-moderation.zip</destFileName>
</artifactItem>

View File

@@ -0,0 +1,2 @@
REGISTRY_PREFIX=harbor.sheldan.dev/oneplus-bot/
VERSION=1.6.9

View File

@@ -1,4 +0,0 @@
FROM postgres
MAINTAINER Sheldan
VOLUME /tmp
ADD sql/init.sql /docker-entrypoint-initdb.d/init.sql

View File

@@ -1 +0,0 @@
CREATE SCHEMA abstracto

View File

@@ -0,0 +1,6 @@
FROM alpine:3.18.0
MAINTAINER Sheldan
ADD config/ /var/db-config/
ADD liquibase-artifacts /var/db-config/liquibase-zips
CMD ["/bin/sh", "/var/db-config/move.sh"]

View File

@@ -1,17 +1,4 @@
{
"template_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "remind", "logging",
"suggestion", "invite-filter", "profanity-filter", "statistic", "experience-tracking", "moderation", "modmail", "assignable-roles",
"voice-channel-context", "anti-raid",
"starboard-custom",
"overrides-templates-webservices", "overrides-templates-core", "overrides-templates-logging", "overrides-templates-statistic",
"overrides-templates-modmail", "overrides-templates-moderation",
"news", "referral", "faq"],
"translation_artifacts": ["utility", "core", "entertainment", "starboard", "link-embed", "webservices", "suggestion",
"remind", "logging", "invite-filter", "profanity-filter", "statistic", "experience-tracking", "moderation", "modmail", "assignable-roles",
"voice-channel-context", "anti-raid",
"starboard-custom", "dynamic-activity-custom-translations", "moderation-custom",
"overrides-translation-moderation",
"news", "setup", "referral", "faq"],
"liquibase_artifacts": [
{ "zip": "scheduling", "file": "scheduling-changeLog.xml" },
{ "zip": "core", "file": "core-changeLog.xml" },
@@ -34,13 +21,13 @@
{ "zip": "anti-raid", "file": "antiRaid-changeLog.xml"},
{ "zip": "dynamic-activity", "file": "dynamicActivity-changeLog.xml"},
{ "zip": "setup", "file": "setup-changeLog.xml"},
{ "zip": "database", "file": "changeLog.xml"},
{ "zip": "referral", "file": "referral-changeLog.xml"},
{ "zip": "starboard-custom", "file": "starboard-custom-changeLog.xml"},
{ "zip": "moderation-custom", "file": "moderation-custom-changeLog.xml"},
{ "zip": "dynamic-activity-custom", "file": "dynamicActivity-custom-changeLog.xml"},
{ "zip": "news", "file": "news-changeLog.xml"},
{ "zip": "faq", "file": "faq-changeLog.xml"}
{ "zip": "faq", "file": "faq-changeLog.xml"},
{ "zip": "seasonal", "file": "seasonal-changeLog.xml"}
]
}

View File

@@ -0,0 +1,2 @@
#!/bin/sh
mv /var/db-config/* /var/run-config/

View File

@@ -1,8 +0,0 @@
ARG ABSTRACTO_REGISTRY_PREFIX
ARG ABSTRACTO_VERSION=latest
FROM ${ABSTRACTO_REGISTRY_PREFIX}abstracto_deployment:${ABSTRACTO_VERSION:-latest}
MAINTAINER Sheldan
ADD template-artifacts /templates
ADD translation-artifacts /translations
ADD liquibase-artifacts /liquibase-zips
ADD config /

View File

@@ -2,24 +2,14 @@ version: "3.7"
services:
bot:
build: oneplusbot
image: ${REGISTRY_PREFIX}oneplus_bot:${VERSION:-latest}
database:
build: database
image: ${REGISTRY_PREFIX}oneplus_bot_database:${VERSION:-latest}
pg_admin:
build: pgAdmin
image: ${REGISTRY_PREFIX}oneplus_bot_pg_admin:${VERSION:-latest}
deployment_container:
build:
context: deployment
args:
ABSTRACTO_REGISTRY_PREFIX: ${ABSTRACTO_REGISTRY_PREFIX}
ABSTRACTO_VERSION: ${ABSTRACTO_VERSION}
image: ${REGISTRY_PREFIX}oneplus_bot_deployment:${VERSION:-latest}
prometheus:
build: prometheus
image: ${REGISTRY_PREFIX}oneplus_bot_prometheus:${VERSION:-latest}
grafana:
build: grafana
image: ${REGISTRY_PREFIX}oneplus_bot_grafana:${VERSION:-latest}
context: oneplusbot
image: ${REGISTRY_PREFIX}oneplus-bot-image:${VERSION:-latest}
db-data:
build:
context: db-data
image: ${REGISTRY_PREFIX}oneplus-bot-db-data:${VERSION:-latest}
template-data:
build:
context: template-data
image: ${REGISTRY_PREFIX}oneplus-bot-template-data:${VERSION:-latest}

Some files were not shown because too many files have changed in this diff Show More