mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-05 00:53:50 +00:00
Compare commits
184 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
629cafc902 | ||
|
|
58632bcf9d | ||
|
|
592ac01bfa | ||
|
|
732535850b | ||
|
|
cd3378df32 | ||
|
|
87d8338d51 | ||
|
|
a371993c87 | ||
|
|
77b97507b3 | ||
|
|
e952727849 | ||
|
|
909a08d3d2 | ||
|
|
e02236145f | ||
|
|
1d810bdc07 | ||
|
|
f9334d5210 | ||
|
|
0a7e30cace | ||
|
|
d91091d149 | ||
|
|
2690b1a5d9 | ||
|
|
ed42940e29 | ||
|
|
2c3b16879e | ||
|
|
bd7fc6aa65 | ||
|
|
6dfcebb25b | ||
|
|
0eaccb4b0f | ||
|
|
4ae6a154c7 | ||
|
|
3ad8369ab3 | ||
|
|
6be1b7df04 | ||
|
|
df8eb399f7 | ||
|
|
3b7157714d | ||
|
|
ef7e5b4a46 | ||
|
|
c28286bf3f | ||
|
|
15e998e05d | ||
|
|
cdbdb395ac | ||
|
|
8819c12b81 | ||
|
|
a4e0971c27 | ||
|
|
726fc27331 | ||
|
|
a9d6a1221e | ||
|
|
84cc32e3b3 | ||
|
|
983c747bc3 | ||
|
|
a901d8a3ba | ||
|
|
fed2d24a55 | ||
|
|
aa359f60f3 | ||
|
|
353fda7770 | ||
|
|
b88ae377b1 | ||
|
|
3d915b96e7 | ||
|
|
9a1e0f330a | ||
|
|
afeef80878 | ||
|
|
453378f0b6 | ||
|
|
0e95ddf198 | ||
|
|
90816649e2 | ||
|
|
5b90d429c2 | ||
|
|
7b1774b73e | ||
|
|
618155a464 | ||
|
|
feabe6426e | ||
|
|
2dc21ce996 | ||
|
|
5643a41fd8 | ||
|
|
08d0561998 | ||
|
|
879c1b0173 | ||
|
|
d5bf70f586 | ||
|
|
4525fbc861 | ||
|
|
4671a78ff9 | ||
|
|
c4174562c6 | ||
|
|
bfaa5d6140 | ||
|
|
d2e8398fa4 | ||
|
|
c67209925a | ||
|
|
f3ac7895eb | ||
|
|
6d893e39bb | ||
|
|
94140104de | ||
|
|
6d80423244 | ||
|
|
27040e506a | ||
|
|
3bbf5a2391 | ||
|
|
11cb3b9ee1 | ||
|
|
dccf314e53 | ||
|
|
a0daeee3a1 | ||
|
|
1b7c383ced | ||
|
|
087dd266cc | ||
|
|
beda17f672 | ||
|
|
5c234295aa | ||
|
|
9cfe4bf353 | ||
|
|
75c45541c9 | ||
|
|
11ac33ad4a | ||
|
|
a37a0f87a0 | ||
|
|
69353d32db | ||
|
|
b973c4660c | ||
|
|
34692d22eb | ||
|
|
33268cded6 | ||
|
|
40d66df9b0 | ||
|
|
92508d7a1d | ||
|
|
ccbf6147e9 | ||
|
|
a3545c4af0 | ||
|
|
fa187f8817 | ||
|
|
c39b7ebeec | ||
|
|
5cbad801ff | ||
|
|
826bee1f81 | ||
|
|
99bf9a9be0 | ||
|
|
5b5e4973a7 | ||
|
|
65e956827c | ||
|
|
b258a8bc54 | ||
|
|
9864b7d875 | ||
|
|
27466b7333 | ||
|
|
bfb8969d1f | ||
|
|
0097ff801a | ||
|
|
b6a188c04d | ||
|
|
2fa1adde02 | ||
|
|
cb8b64cc01 | ||
|
|
3b3dd0dbb7 | ||
|
|
388fead2a6 | ||
|
|
336c3d0bd8 | ||
|
|
4991ad8f1c | ||
|
|
c5136a1808 | ||
|
|
446d882eec | ||
|
|
b3e207a967 | ||
|
|
5c25345cf8 | ||
|
|
a01a5055a0 | ||
|
|
234aae3783 | ||
|
|
ca45137cc6 | ||
|
|
bc3d16b40e | ||
|
|
66e212d30c | ||
|
|
b69811479f | ||
|
|
43c5d041ef | ||
|
|
dfe9792330 | ||
|
|
250df57bd0 | ||
|
|
02b8ed2b5d | ||
|
|
71c1445439 | ||
|
|
d86299cdf6 | ||
|
|
1b86fba3e0 | ||
|
|
3ee7c92cdd | ||
|
|
6c6cd130aa | ||
|
|
65a1d44069 | ||
|
|
11312a5e27 | ||
|
|
6b13958ac0 | ||
|
|
3142daafd3 | ||
|
|
4bef78f847 | ||
|
|
82be86e086 | ||
|
|
bff505ef25 | ||
|
|
533f5671c2 | ||
|
|
8c7547b485 | ||
|
|
741c194bb8 | ||
|
|
d2bdfd8dac | ||
|
|
36c67fbe20 | ||
|
|
8fd1aede2a | ||
|
|
287ae1f0b1 | ||
|
|
903361cb58 | ||
|
|
c8cf412a4a | ||
|
|
affc249012 | ||
|
|
653671ea79 | ||
|
|
7185908682 | ||
|
|
675da8d5d8 | ||
|
|
e91becee0d | ||
|
|
18732efe75 | ||
|
|
63897fd914 | ||
|
|
9b865af43b | ||
|
|
b78275734c | ||
|
|
00a6b0d1f8 | ||
|
|
13fe6f5e51 | ||
|
|
bc0c3a18d7 | ||
|
|
8f9b7eba16 | ||
|
|
48eacb2e1c | ||
|
|
2168814814 | ||
|
|
972a2829d7 | ||
|
|
dbf5d99622 | ||
|
|
f45721ba42 | ||
|
|
9034968868 | ||
|
|
bcb9bacea5 | ||
|
|
4b922da294 | ||
|
|
6d90314492 | ||
|
|
93b02d37ed | ||
|
|
c11ddd84ab | ||
|
|
518355a68a | ||
|
|
74ebeb4844 | ||
|
|
7d872c815c | ||
|
|
4ebcbeb753 | ||
|
|
53b0c91360 | ||
|
|
59575e0b49 | ||
|
|
94a18559d3 | ||
|
|
b0c90ee8e2 | ||
|
|
c20c7321ea | ||
|
|
11914d1be5 | ||
|
|
1689fcdae9 | ||
|
|
fc887d2f36 | ||
|
|
485782ff16 | ||
|
|
6460d2c5b7 | ||
|
|
e92b7320bd | ||
|
|
4af47ce086 | ||
|
|
3f2f3a9c1b | ||
|
|
fe1f03833b | ||
|
|
f2522d5a47 |
2
.env
2
.env
@@ -1,2 +1,2 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/abstracto/
|
||||
VERSION=1.5.22
|
||||
VERSION=1.6.0
|
||||
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
@@ -16,7 +16,7 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -25,17 +25,16 @@ jobs:
|
||||
with:
|
||||
distribution: 'corretto'
|
||||
java-version: 17
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '21.x'
|
||||
- name: Build with Maven
|
||||
run: mvn -B install --file abstracto-application/pom.xml
|
||||
- uses: actions/setup-ruby@v1
|
||||
- name: Send Webhook Notification
|
||||
if: always()
|
||||
env:
|
||||
JOB_STATUS: ${{ job.status }}
|
||||
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
||||
HOOK_OS_NAME: ${{ runner.os }}
|
||||
WORKFLOW_NAME: ${{ github.workflow }}
|
||||
run: |
|
||||
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
|
||||
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
|
||||
shell: bash
|
||||
- name: Install node dependencies and build
|
||||
working-directory: ./ui/experience-tracking
|
||||
run: npm ci
|
||||
- name: Build ui application
|
||||
working-directory: ./ui/experience-tracking
|
||||
run: npm run build
|
||||
|
||||
|
||||
55
.github/workflows/release.yml
vendored
55
.github/workflows/release.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Publish package to GitHub Packages and deploy documentation to GitHub pages
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Java for publishing to GitHub Packages
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'corretto'
|
||||
java-version: 17
|
||||
- name: Load current version
|
||||
id: version
|
||||
run: echo "version=$(mvn --file abstracto-application/pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_ENV
|
||||
- name: Publish to GitHub Packages
|
||||
run: mvn --file abstracto-application/pom.xml -B deploy -P documentation,javadoc -Dmaven.wagon.http.pool=false -DskipTests=true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Deploy documentation to GitHub pages
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
repository-name: Sheldan/abstracto-docs
|
||||
target-folder: docs/${{ env.version }}
|
||||
branch: master
|
||||
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
folder: abstracto-application/documentation/target/generated-docs
|
||||
- name: Deploy documentation to GitHub pages latest
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
repository-name: Sheldan/abstracto-docs
|
||||
target-folder: docs/current
|
||||
branch: master
|
||||
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
folder: abstracto-application/documentation/target/generated-docs
|
||||
- name: Login to Harbor
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
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: .env
|
||||
- name: Push container
|
||||
run: docker-compose build && docker-compose push
|
||||
env:
|
||||
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
|
||||
VERSION: ${{ steps.dotenv.outputs.version }}
|
||||
79
.github/workflows/release_manual.yml
vendored
Normal file
79
.github/workflows/release_manual.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
name: Publishes a new version of abstracto
|
||||
on: workflow_dispatch
|
||||
permissions:
|
||||
packages: write
|
||||
contents: write
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'corretto'
|
||||
java-version: 17
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '21.x'
|
||||
- name: Load current version
|
||||
id: version
|
||||
working-directory: ./abstracto-application
|
||||
run: echo "version=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec | cut -d- -f1)" >> $GITHUB_ENV
|
||||
- name: Create a Release
|
||||
uses: elgohr/Github-Release-Action@v5
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
title: Release of version ${{ env.version }}
|
||||
- name: Release maven packages
|
||||
uses: qcastel/github-actions-maven-release@v1.12.41
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
maven-project-folder: "abstracto-application/"
|
||||
git-release-bot-name: "release-bot"
|
||||
git-release-bot-email: "release-bot@sheldan.dev"
|
||||
release-branch-name: master
|
||||
version-minor: true
|
||||
maven-args: "-Dmaven.javadoc.skip=true -s settings.xml -DskipTests"
|
||||
access-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Install node dependencies and build
|
||||
working-directory: ./ui/experience-tracking
|
||||
run: npm ci
|
||||
- name: Build ui application
|
||||
working-directory: ./ui/experience-tracking
|
||||
run: npm run build
|
||||
- name: Copy built UI
|
||||
run: cp -R ui/experience-tracking/build/* python/components/experience-tracking/resources/templates/experience/leaderboards/
|
||||
- name: Login to Harbor
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: harbor.sheldan.dev
|
||||
username: ${{ secrets.HARBOR_USERNAME }}
|
||||
password: ${{ secrets.HARBOR_TOKEN }}
|
||||
- name: Update .env version
|
||||
run:
|
||||
sed -i '2s/.*/VERSION=${{ env.version }}/' .env
|
||||
- name: Load env file
|
||||
id: dotenv
|
||||
uses: falti/dotenv-action@v1.0.4
|
||||
with:
|
||||
path: .env
|
||||
- name: Build and push Docker containers
|
||||
run: docker compose build && docker compose push
|
||||
env:
|
||||
REGISTRY_PREFIX: ${{ steps.dotenv.outputs.registry_prefix }}
|
||||
VERSION: ${{ steps.dotenv.outputs.version }}
|
||||
- name: Fix file permissions
|
||||
run:
|
||||
sudo chmod -R ugo+rwX . # https://github.com/actions/checkout/issues/164
|
||||
- name: Commit updated versions
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
author_name: "release-bot"
|
||||
author_email: "release-bot@sheldan.dev"
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -14,9 +14,7 @@ target/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Sheldan
|
||||
Copyright (c) 2024 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
|
||||
|
||||
@@ -8,11 +8,10 @@ Abstracto represents a framework to be used as a basis for a Discord bot. It use
|
||||
and provides an extensive tool set to create new commands and a wide range of commands out of the box.
|
||||
|
||||
This repository does not provide the full functionality in order to start a discord bot, because it requires a Main class.
|
||||
An example implementation of this bot can be seen [here](https://github.com/Sheldan/Crimson). This repository contains the required configuration in order to run a bot and example customizations.
|
||||
|
||||
|
||||
## Technologies
|
||||
* [JDA](https://github.com/DV8FromTheWorld/JDA/) The Discord API Wrapper in the version 5.0.0-beta.13
|
||||
* [JDA](https://github.com/DV8FromTheWorld/JDA/) The Discord API Wrapper in the version 5.0.0-beta.21
|
||||
* [Spring boot](https://github.com/spring-projects/spring-boot) is used as a framework to create standalone application in Java with Java EE methods. (including dependency injection and more)
|
||||
* [Hibernate](https://github.com/hibernate/hibernate-orm) is used as a reference implementation of JPA.
|
||||
* [Freemarker](https://github.com/apache/freemarker) is used as a templating engine. This is used to provide internationalization for user facing text and enable dynamic embed configuration.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>anti-raid</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="anti_raid-feature-insertion">
|
||||
<insert tableName="feature">
|
||||
<column name="key" value="antiRaid"/>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
</databaseChangeLog>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="1.3.3/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>anti-raid</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>assignable-roles</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ShowAssignableRolePlaceConfig extends AbstractConditionableCommand
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
String name = (String) parameters.get(0);
|
||||
AssignableRolePlaceConfig config = service.getAssignableRolePlaceConfig(commandContext.getGuild(), name);
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(ASSIGNABLE_ROLES_CONFIG_POST_TEMPLATE_KEY, config, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(ASSIGNABLE_ROLES_CONFIG_POST_TEMPLATE_KEY, config, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ShowAssignableRolePlaces extends AbstractConditionableCommand {
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
AssignablePlaceOverview model = service.getAssignableRolePlaceOverview(commandContext.getGuild());
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(ASSIGNABLE_ROLE_PLACES_OVERVIEW_TEMPLATE_KEY, model, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(ASSIGNABLE_ROLE_PLACES_OVERVIEW_TEMPLATE_KEY, model, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<property name="assignableRoleModule" value="(SELECT id FROM module WHERE name = 'assignableRoles')"/>
|
||||
<property name="assignableRoleFeature" value="(SELECT id FROM feature WHERE key = 'assignableRole')"/>
|
||||
<changeSet author="Sheldan" id="assignable_roles-commands">
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||
<include file="module.xml" relativeToChangelogFile="true"/>
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assignable_role-feature-insertion">
|
||||
<insert tableName="feature">
|
||||
<column name="key" value="assignableRole"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assignable_role-module-insertion">
|
||||
<insert tableName="module">
|
||||
<column name="name" value="assignableRoles"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assignable_role-table">
|
||||
<createTable tableName="assignable_role">
|
||||
<column autoIncrement="true" name="id" type="BIGINT">
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assignable_role_condition-table">
|
||||
<createTable tableName="assignable_role_condition">
|
||||
<column autoIncrement="true" name="id" type="BIGINT">
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assignable_role_place-table">
|
||||
<createTable tableName="assignable_role_place">
|
||||
<column autoIncrement="true" name="id" type="BIGINT">
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assigned_role_user-table">
|
||||
<createTable tableName="assigned_role_user">
|
||||
<column name="id" type="BIGINT">
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="assignable_role_place.xml" relativeToChangelogFile="true"/>
|
||||
<include file="assignable_role.xml" relativeToChangelogFile="true"/>
|
||||
<include file="assignable_role_condition.xml" relativeToChangelogFile="true"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="assignableRoles-tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
<include file="assignableRoles-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="assignable_role_place-add_type">
|
||||
<addColumn tableName="assignable_role_place">
|
||||
<column name="type" type="VARCHAR2(128)" defaultValue="DEFAULT"/>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="assignable_role_place.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="1.0-assignableRoles/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.3.4/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>assignable-roles</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>assignable-roles-int</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>custom-command</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,11 +5,13 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandFeatureDefinition;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandSlashCommandNames;
|
||||
import dev.sheldan.abstracto.customcommand.service.management.CustomCommandService;
|
||||
@@ -44,8 +46,11 @@ public class CreateCustomCommand extends AbstractConditionableCommand {
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
String name = slashCommandParameterService.getCommandOption(CUSTOM_COMMAND_NAME_PARAMETER, event, String.class);
|
||||
String content = slashCommandParameterService.getCommandOption(CUSTOM_COMMAND_CONTENT_PARAMETER, event, String.class);
|
||||
|
||||
customCommandService.createCustomCommand(name, content, event.getMember());
|
||||
if(ContextUtils.isUserCommand(event)) {
|
||||
customCommandService.createUserCustomCommand(name, content, event.getUser());
|
||||
} else {
|
||||
customCommandService.createCustomCommand(name, content, event.getMember());
|
||||
}
|
||||
return interactionService.replyEmbed(CREATE_CUSTOM_COMMAND_RESPONSE_TEMPLATE_KEY, event)
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
@@ -80,6 +85,8 @@ public class CreateCustomCommand extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND)
|
||||
.commandName("create")
|
||||
.build();
|
||||
|
||||
@@ -5,11 +5,13 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandFeatureDefinition;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandSlashCommandNames;
|
||||
import dev.sheldan.abstracto.customcommand.service.management.CustomCommandService;
|
||||
@@ -42,8 +44,11 @@ public class DeleteCustomCommand extends AbstractConditionableCommand {
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
String name = slashCommandParameterService.getCommandOption(CUSTOM_COMMAND_NAME_PARAMETER, event, String.class);
|
||||
|
||||
customCommandService.deleteCustomCommand(name, event.getGuild());
|
||||
if(ContextUtils.isUserCommand(event)) {
|
||||
customCommandService.deleteUserCustomCommand(name, event.getUser());
|
||||
} else {
|
||||
customCommandService.deleteCustomCommand(name, event.getGuild());
|
||||
}
|
||||
return interactionService.replyEmbed(DELETE_CUSTOM_COMMAND_RESPONSE_TEMPLATE_KEY, event)
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
@@ -66,6 +71,8 @@ public class DeleteCustomCommand extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND)
|
||||
.commandName("delete")
|
||||
.build();
|
||||
|
||||
@@ -5,12 +5,14 @@ import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandAutoCompleteService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandFeatureDefinition;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandSlashCommandNames;
|
||||
import dev.sheldan.abstracto.customcommand.model.command.CustomCommandResponseModel;
|
||||
@@ -48,7 +50,12 @@ public class GetCustomCommand extends AbstractConditionableCommand {
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
String name = slashCommandParameterService.getCommandOption(CUSTOM_COMMAND_NAME_PARAMETER, event, String.class);
|
||||
CustomCommand customCommand = customCommandService.getCustomCommand(name, event.getGuild());
|
||||
CustomCommand customCommand;
|
||||
if(ContextUtils.isUserCommand(event)) {
|
||||
customCommand = customCommandService.getUserCustomCommand(name, event.getUser());
|
||||
} else {
|
||||
customCommand = customCommandService.getCustomCommand(name, event.getGuild());
|
||||
}
|
||||
CustomCommandResponseModel model = CustomCommandResponseModel
|
||||
.builder()
|
||||
.additionalText(customCommand.getAdditionalMessage())
|
||||
@@ -61,11 +68,17 @@ public class GetCustomCommand extends AbstractConditionableCommand {
|
||||
public List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) {
|
||||
if(slashCommandAutoCompleteService.matchesParameter(event.getFocusedOption(), CUSTOM_COMMAND_NAME_PARAMETER)) {
|
||||
String input = event.getFocusedOption().getValue();
|
||||
return customCommandService.getCustomCommandsStartingWith(input, event.getGuild())
|
||||
.stream()
|
||||
.map(CustomCommand::getName)
|
||||
.limit(25)
|
||||
.toList();
|
||||
if(ContextUtils.isNotUserCommand(event)) {
|
||||
return customCommandService.getCustomCommandsStartingWith(input, event.getGuild())
|
||||
.stream()
|
||||
.map(CustomCommand::getName)
|
||||
.toList();
|
||||
} else {
|
||||
return customCommandService.getUserCustomCommandsStartingWith(input, event.getUser())
|
||||
.stream()
|
||||
.map(CustomCommand::getName)
|
||||
.toList();
|
||||
}
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -95,7 +108,10 @@ public class GetCustomCommand extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND_PUBLIC)
|
||||
.userRootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND)
|
||||
.commandName("get")
|
||||
.build();
|
||||
|
||||
|
||||
@@ -4,11 +4,13 @@ import dev.sheldan.abstracto.core.command.UtilityModuleDefinition;
|
||||
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.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.service.PaginatorService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandFeatureDefinition;
|
||||
import dev.sheldan.abstracto.customcommand.config.CustomCommandSlashCommandNames;
|
||||
import dev.sheldan.abstracto.customcommand.model.command.ListCustomCommandsResponseModel;
|
||||
@@ -42,7 +44,12 @@ public class ListCustomCommands extends AbstractConditionableCommand {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
List<CustomCommand> customCommands = customCommandService.getCustomCommands(event.getGuild());
|
||||
List<CustomCommand> customCommands;
|
||||
if(ContextUtils.isUserCommand(event)) {
|
||||
customCommands = customCommandService.getUserCustomCommands(event.getUser());
|
||||
} else {
|
||||
customCommands = customCommandService.getCustomCommands(event.getGuild());
|
||||
}
|
||||
if(customCommands.isEmpty()) {
|
||||
return interactionService.replyEmbed(NO_CUSTOM_COMMANDS_TEMPLATE_KEY, event)
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
@@ -67,7 +74,10 @@ public class ListCustomCommands extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND_PUBLIC)
|
||||
.userRootCommandName(CustomCommandSlashCommandNames.CUSTOM_COMMAND)
|
||||
.commandName("list")
|
||||
.build();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.sheldan.abstracto.customcommand.repository;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUser;
|
||||
import dev.sheldan.abstracto.customcommand.model.database.CustomCommand;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -11,7 +12,12 @@ import java.util.Optional;
|
||||
@Repository
|
||||
public interface CustomCommandRepository extends JpaRepository<CustomCommand, Long> {
|
||||
Optional<CustomCommand> getByNameIgnoreCaseAndServer(String name, AServer server);
|
||||
Optional<CustomCommand> getByNameIgnoreCaseAndCreatorUser(String name, AUser creator);
|
||||
Optional<CustomCommand> getByNameIgnoreCaseAndCreatorUser_IdAndUserSpecific(String name, Long userId, Boolean userSpecific);
|
||||
void deleteByNameAndServer(String name, AServer server);
|
||||
void deleteByNameAndCreatorUserAndUserSpecific(String name, AUser aUser, Boolean userSpecific);
|
||||
List<CustomCommand> findByServer(AServer server);
|
||||
List<CustomCommand> findByCreatorUserAndUserSpecific(AUser user, Boolean userSpecific);
|
||||
List<CustomCommand> findByNameStartsWithIgnoreCaseAndServer(String prefix, AServer server);
|
||||
List<CustomCommand> findByNameStartsWithIgnoreCaseAndCreatorUserAndUserSpecific(String prefix, AUser aUser, Boolean userSpecific);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package dev.sheldan.abstracto.customcommand.service;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUser;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||
import dev.sheldan.abstracto.core.service.management.UserManagementService;
|
||||
import dev.sheldan.abstracto.customcommand.exception.CustomCommandExistsException;
|
||||
import dev.sheldan.abstracto.customcommand.exception.CustomCommandNotFoundException;
|
||||
import dev.sheldan.abstracto.customcommand.model.database.CustomCommand;
|
||||
@@ -11,6 +13,7 @@ import dev.sheldan.abstracto.customcommand.service.management.CustomCommandManag
|
||||
import dev.sheldan.abstracto.customcommand.service.management.CustomCommandService;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -28,6 +31,9 @@ public class CustomCommandServiceBean implements CustomCommandService {
|
||||
@Autowired
|
||||
private ServerManagementService serverManagementService;
|
||||
|
||||
@Autowired
|
||||
private UserManagementService userManagementService;
|
||||
|
||||
@Override
|
||||
public CustomCommand createCustomCommand(String name, String content, Member creator) {
|
||||
if(customCommandManagementService.getCustomCommandByName(name, creator.getGuild().getIdLong()).isPresent()) {
|
||||
@@ -37,6 +43,15 @@ public class CustomCommandServiceBean implements CustomCommandService {
|
||||
return customCommandManagementService.createCustomCommand(name, content, creatorUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCommand createUserCustomCommand(String name, String content, User user) {
|
||||
AUser aUser = userManagementService.loadOrCreateUser(user.getIdLong());
|
||||
if(customCommandManagementService.getUserCustomCommandByName(name, aUser).isPresent()) {
|
||||
throw new CustomCommandExistsException();
|
||||
}
|
||||
return customCommandManagementService.createUserCustomCommand(name, content, aUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCustomCommand(String name, Guild guild) {
|
||||
if(customCommandManagementService.getCustomCommandByName(name, guild.getIdLong()).isEmpty()) {
|
||||
@@ -46,21 +61,48 @@ public class CustomCommandServiceBean implements CustomCommandService {
|
||||
customCommandManagementService.deleteCustomCommand(name, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserCustomCommand(String name, User user) {
|
||||
if(customCommandManagementService.getUserCustomCommandByName(name, user.getIdLong()).isEmpty()) {
|
||||
throw new CustomCommandNotFoundException();
|
||||
}
|
||||
AUser aUser = userManagementService.loadOrCreateUser(user.getIdLong());
|
||||
customCommandManagementService.deleteCustomCommand(name, aUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getCustomCommands(Guild guild) {
|
||||
AServer server = serverManagementService.loadServer(guild);
|
||||
return customCommandManagementService.getCustomCommands(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getUserCustomCommands(User user) {
|
||||
AUser aUser = userManagementService.loadOrCreateUser(user.getIdLong());
|
||||
return customCommandManagementService.getUserCustomCommands(aUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCommand getCustomCommand(String name, Guild guild) {
|
||||
return customCommandManagementService.getCustomCommandByName(name, guild.getIdLong())
|
||||
.orElseThrow(CustomCommandNotFoundException::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCommand getUserCustomCommand(String name, User user) {
|
||||
return customCommandManagementService.getUserCustomCommandByName(name, user.getIdLong())
|
||||
.orElseThrow(CustomCommandNotFoundException::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getCustomCommandsStartingWith(String prefix, Guild guild) {
|
||||
AServer server = serverManagementService.loadServer(guild);
|
||||
return customCommandManagementService.getCustomCommandsStartingWith(prefix, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getUserCustomCommandsStartingWith(String prefix, User user) {
|
||||
AUser aUser = userManagementService.loadOrCreateUser(user.getIdLong());
|
||||
return customCommandManagementService.getUserCustomCommandsStartingWith(prefix, aUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.sheldan.abstracto.customcommand.service.management;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUser;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||
import dev.sheldan.abstracto.customcommand.model.database.CustomCommand;
|
||||
@@ -26,6 +27,16 @@ public class CustomCommandManagementServiceBean implements CustomCommandManageme
|
||||
return repository.getByNameIgnoreCaseAndServer(name, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<CustomCommand> getUserCustomCommandByName(String name, AUser user) {
|
||||
return repository.getByNameIgnoreCaseAndCreatorUser(name, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<CustomCommand> getUserCustomCommandByName(String name, Long userId) {
|
||||
return repository.getByNameIgnoreCaseAndCreatorUser_IdAndUserSpecific(name, userId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCommand createCustomCommand(String name, String content, AUserInAServer creator) {
|
||||
CustomCommand customCommand = CustomCommand
|
||||
@@ -34,6 +45,20 @@ public class CustomCommandManagementServiceBean implements CustomCommandManageme
|
||||
.additionalMessage(content)
|
||||
.server(creator.getServerReference())
|
||||
.creator(creator)
|
||||
.userSpecific(false)
|
||||
.creatorUser(creator.getUserReference())
|
||||
.build();
|
||||
return repository.save(customCommand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCommand createUserCustomCommand(String name, String content, AUser user) {
|
||||
CustomCommand customCommand = CustomCommand
|
||||
.builder()
|
||||
.name(name)
|
||||
.additionalMessage(content)
|
||||
.creatorUser(user)
|
||||
.userSpecific(true)
|
||||
.build();
|
||||
return repository.save(customCommand);
|
||||
}
|
||||
@@ -43,14 +68,29 @@ public class CustomCommandManagementServiceBean implements CustomCommandManageme
|
||||
repository.deleteByNameAndServer(name, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCustomCommand(String name, AUser user) {
|
||||
repository.deleteByNameAndCreatorUserAndUserSpecific(name, user, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getCustomCommands(AServer server) {
|
||||
return repository.findByServer(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getUserCustomCommands(AUser aUser) {
|
||||
return repository.findByCreatorUserAndUserSpecific(aUser, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getCustomCommandsStartingWith(String prefix, AServer server) {
|
||||
return repository.findByNameStartsWithIgnoreCaseAndServer(prefix, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomCommand> getUserCustomCommandsStartingWith(String prefix, AUser aUser) {
|
||||
return repository.findByNameStartsWithIgnoreCaseAndCreatorUserAndUserSpecific(prefix, aUser, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="custom_command-feature-insertion">
|
||||
<insert tableName="feature">
|
||||
<column name="key" value="customCommand"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="custom_command-table">
|
||||
<createTable tableName="custom_command">
|
||||
<column name="id" type="BIGINT">
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="custom_command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="custom_command-add_user_installable_support">
|
||||
<addColumn tableName="custom_command">
|
||||
<column name="creator_id" type="BIGINT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="user_specific" type="BOOLEAN" value="false">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
<sql>
|
||||
update custom_command set creator_id = (select ua.user_id from user_in_server ua where ua.user_in_server_id = creator_user_in_server_id order by ua.server_id limit 1)
|
||||
</sql>
|
||||
<addNotNullConstraint columnName="creator_id"
|
||||
tableName="custom_command"
|
||||
validate="true"/>
|
||||
<sql>
|
||||
ALTER TABLE custom_command ALTER COLUMN server_id DROP NOT NULL;
|
||||
ALTER TABLE custom_command ALTER COLUMN creator_user_in_server_id DROP NOT NULL;
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="custom_command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<property name="utilityModule" value="(SELECT id FROM module WHERE name = 'utility')"/>
|
||||
<property name="customCommandFeature" value="(SELECT id FROM feature WHERE key = 'customCommand')"/>
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="custom_command-add_auto_increment">
|
||||
<sql>
|
||||
create sequence custom_command_id_seq;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="custom_command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,8 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="1.4.0/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.5.8/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.5.37/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>custom-command</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -13,11 +13,18 @@ public class ListCustomCommandModel {
|
||||
private MemberDisplay creator;
|
||||
|
||||
public static ListCustomCommandModel fromCustomCommand(CustomCommand customCommand) {
|
||||
MemberDisplay creatorObj;
|
||||
if(customCommand.getUserSpecific()) {
|
||||
creatorObj = MemberDisplay.fromAUser(customCommand.getCreatorUser());
|
||||
} else {
|
||||
creatorObj = MemberDisplay.fromAUserInAServer(customCommand.getCreator());
|
||||
}
|
||||
|
||||
return ListCustomCommandModel
|
||||
.builder()
|
||||
.name(customCommand.getName())
|
||||
.content(customCommand.getAdditionalMessage())
|
||||
.creator(MemberDisplay.fromAUserInAServer(customCommand.getCreator()))
|
||||
.creator(creatorObj)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,20 @@ public class CustomCommand implements Serializable {
|
||||
private String name;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "server_id", nullable = false)
|
||||
@JoinColumn(name = "server_id")
|
||||
private AServer server;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "creator_user_in_server_id", nullable = false)
|
||||
@JoinColumn(name = "creator_user_in_server_id")
|
||||
private AUserInAServer creator;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "creator_id", nullable = false)
|
||||
private AUser creatorUser;
|
||||
|
||||
@Column(name = "user_specific")
|
||||
private Boolean userSpecific;
|
||||
|
||||
@Column(name = "created", nullable = false, insertable = false, updatable = false)
|
||||
private Instant created;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.sheldan.abstracto.customcommand.service.management;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUser;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.customcommand.model.database.CustomCommand;
|
||||
|
||||
@@ -9,8 +10,14 @@ import java.util.Optional;
|
||||
|
||||
public interface CustomCommandManagementService {
|
||||
Optional<CustomCommand> getCustomCommandByName(String name, Long serverId);
|
||||
Optional<CustomCommand> getUserCustomCommandByName(String name, AUser user);
|
||||
Optional<CustomCommand> getUserCustomCommandByName(String name, Long userId);
|
||||
CustomCommand createCustomCommand(String name, String content, AUserInAServer creator);
|
||||
CustomCommand createUserCustomCommand(String name, String content, AUser user);
|
||||
void deleteCustomCommand(String name, AServer server);
|
||||
void deleteCustomCommand(String name, AUser user);
|
||||
List<CustomCommand> getCustomCommands(AServer server);
|
||||
List<CustomCommand> getUserCustomCommands(AUser aUser);
|
||||
List<CustomCommand> getCustomCommandsStartingWith(String prefix, AServer server);
|
||||
List<CustomCommand> getUserCustomCommandsStartingWith(String prefix, AUser aUser);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,19 @@ package dev.sheldan.abstracto.customcommand.service.management;
|
||||
import dev.sheldan.abstracto.customcommand.model.database.CustomCommand;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CustomCommandService {
|
||||
CustomCommand createCustomCommand(String name, String content, Member creator);
|
||||
CustomCommand createUserCustomCommand(String name, String content, User user);
|
||||
void deleteCustomCommand(String name, Guild guild);
|
||||
void deleteUserCustomCommand(String name, User user);
|
||||
List<CustomCommand> getCustomCommands(Guild guild);
|
||||
List<CustomCommand> getUserCustomCommands(User user);
|
||||
CustomCommand getCustomCommand(String name, Guild guild);
|
||||
CustomCommand getUserCustomCommand(String name, User user);
|
||||
List<CustomCommand> getCustomCommandsStartingWith(String prefix, Guild guild);
|
||||
List<CustomCommand> getUserCustomCommandsStartingWith(String prefix, User user);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>dynamic-activity</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="activity_job-insert">
|
||||
<insert tableName="scheduler_job">
|
||||
<column name="name" value="activityJob"/>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="activity_job.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="activity-table">
|
||||
<createTable tableName="activity">
|
||||
<column autoIncrement="true" name="id" type="BIGINT">
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="activity.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="1.3.1/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>dynamic-activity</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>abstracto-modules</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>entertainment</artifactId>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<version>1.5.22</version>
|
||||
<version>1.5.61</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
@@ -53,7 +54,7 @@ public class Choose extends AbstractConditionableCommand {
|
||||
.builder()
|
||||
.chosenValue(choice)
|
||||
.build();
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(CHOOSE_RESPONSE_TEMPLATE_KEY, responseModel, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(CHOOSE_RESPONSE_TEMPLATE_KEY, responseModel, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromIgnored());
|
||||
}
|
||||
|
||||
@@ -96,6 +97,8 @@ public class Choose extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.UTILITY)
|
||||
.commandName(CHOOSE_COMMAND)
|
||||
.build();
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
@@ -12,6 +13,7 @@ import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.entertainment.config.EntertainmentFeatureDefinition;
|
||||
@@ -60,7 +62,7 @@ public class EightBall extends AbstractConditionableCommand {
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
String text = slashCommandParameterService.getCommandOption(TEXT_PARAMETER, event, String.class);
|
||||
MessageToSend messageToSend = getMessageToSend(text, event.getGuild().getIdLong());
|
||||
MessageToSend messageToSend = getMessageToSend(text, ContextUtils.serverIdOrNull(event));
|
||||
return interactionService.replyMessageToSend(messageToSend, event)
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
@@ -93,6 +95,8 @@ public class EightBall extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.UTILITY)
|
||||
.commandName(BALL_COMMAND)
|
||||
.build();
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
@@ -13,6 +14,7 @@ import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.entertainment.config.EntertainmentFeatureDefinition;
|
||||
import dev.sheldan.abstracto.entertainment.config.EntertainmentModuleDefinition;
|
||||
@@ -64,7 +66,7 @@ public class LoveCalc extends AbstractConditionableCommand {
|
||||
public CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) {
|
||||
String firstPart = slashCommandParameterService.getCommandOption(FIRST_SUBJECT_PARAMETER, event, String.class);
|
||||
String secondPart = slashCommandParameterService.getCommandOption(SECOND_SUBJECT_PARAMETER, event, String.class);
|
||||
MessageToSend messageToSend = getMessageToSend(event.getGuild().getIdLong(), firstPart, secondPart);
|
||||
MessageToSend messageToSend = getMessageToSend(ContextUtils.serverIdOrNull(event), firstPart, secondPart);
|
||||
return interactionService.replyMessageToSend(messageToSend, event.getInteraction())
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
}
|
||||
@@ -105,6 +107,8 @@ public class LoveCalc extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.UTILITY)
|
||||
.commandName(LOVE_CALC_COMMAND)
|
||||
.build();
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package dev.sheldan.abstracto.entertainment.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.config.*;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.command.handler.parameter.CombinedParameter;
|
||||
@@ -65,7 +63,7 @@ public class Mock extends AbstractConditionableCommand {
|
||||
.originalText(messageText)
|
||||
.mockingText(mockingText)
|
||||
.build();
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(MOCK_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(MOCK_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
@@ -86,7 +84,7 @@ public class Mock extends AbstractConditionableCommand {
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<Parameter> parameters = new ArrayList<>();
|
||||
Map<String, Object> parameterAlternatives = new HashMap<>();
|
||||
parameterAlternatives.put(ADDITIONAL_TYPES_KEY, Arrays.asList(Message.class, String.class));
|
||||
parameterAlternatives.put(ADDITIONAL_TYPES_KEY, Arrays.asList(CombinedParameterEntry.messageParameter(Message.class), CombinedParameterEntry.parameter(String.class)));
|
||||
|
||||
Parameter messageParameter = Parameter
|
||||
.builder()
|
||||
@@ -107,6 +105,8 @@ public class Mock extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.ENTERTAINMENT)
|
||||
.commandName(MOCK_COMMAND)
|
||||
.build();
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PressFCommand extends AbstractConditionableCommand {
|
||||
Long defaultDurationSeconds = configService.getLongValueOrConfigDefault(PRESS_F_DEFAULT_DURATION_SECONDS, commandContext.getGuild().getIdLong());
|
||||
Duration duration = Duration.ofSeconds(defaultDurationSeconds);
|
||||
PressFPromptModel pressFModel = entertainmentService.getPressFModel(text);
|
||||
List<CompletableFuture<Message>> messages = channelService.sendEmbedTemplateInMessageChannelList(RESPONSE_TEMPLATE, pressFModel, commandContext.getChannel());
|
||||
List<CompletableFuture<Message>> messages = channelService.sendEmbedTemplateInMessageChannel(RESPONSE_TEMPLATE, pressFModel, commandContext.getChannel());
|
||||
return FutureUtils.toSingleFutureGeneric(messages)
|
||||
.thenAccept(unused -> entertainmentService.persistPressF(text, duration, commandContext.getAuthor(),
|
||||
pressFModel.getPressFComponentId(), commandContext.getChannel(), messages.get(0).join().getIdLong()))
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.config.validator.MinIntegerValueValidator;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
@@ -69,7 +70,7 @@ public class Roll extends AbstractConditionableCommand {
|
||||
.builder()
|
||||
.rolled(rolled)
|
||||
.build();
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(ROLL_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(ROLL_RESPONSE_TEMPLATE_KEY, model, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromIgnored());
|
||||
}
|
||||
|
||||
@@ -125,6 +126,8 @@ public class Roll extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.UTILITY)
|
||||
.commandName(ROLL_COMMAND)
|
||||
.build();
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
@@ -45,7 +46,7 @@ public class Roulette extends AbstractConditionableCommand {
|
||||
.builder()
|
||||
.result(rouletteResult)
|
||||
.build();
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(ROULETTE_RESPONSE_TEMPLATE_KEY, responseModel, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(ROULETTE_RESPONSE_TEMPLATE_KEY, responseModel, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromIgnored());
|
||||
}
|
||||
|
||||
@@ -71,6 +72,8 @@ public class Roulette extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.UTILITY)
|
||||
.commandName(ROULETTE_COMMAND)
|
||||
.build();
|
||||
|
||||
@@ -65,7 +65,7 @@ public class TransferCredits extends AbstractConditionableCommand {
|
||||
.targetMember(MemberDisplay.fromMember(targetMember))
|
||||
.credits(amount)
|
||||
.build();
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInTextChannelList(TRANSFER_CREDITS_RESPONSE, responseModel, commandContext.getChannel()))
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendEmbedTemplateInMessageChannel(TRANSFER_CREDITS_RESPONSE, responseModel, commandContext.getChannel()))
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.config.UserCommandConfig;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
@@ -15,6 +16,7 @@ import dev.sheldan.abstracto.core.service.ChannelService;
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.entertainment.config.EntertainmentFeatureDefinition;
|
||||
import dev.sheldan.abstracto.entertainment.config.EntertainmentModuleDefinition;
|
||||
@@ -81,33 +83,39 @@ public class Mines extends AbstractConditionableCommand {
|
||||
mines = slashCommandParameterService.getCommandOption(MINES_PARAMETER, event, Integer.class);
|
||||
}
|
||||
Integer credit = null;
|
||||
long serverId = event.getGuild().getIdLong();
|
||||
boolean economyEnabled = featureFlagService.getFeatureFlagValue(EntertainmentFeatureDefinition.ECONOMY, serverId);
|
||||
if(economyEnabled){
|
||||
credit = 50;
|
||||
if(slashCommandParameterService.hasCommandOption(CREDITS_PARAMETER, event)) {
|
||||
credit = slashCommandParameterService.getCommandOption(CREDITS_PARAMETER, event, Integer.class);
|
||||
}
|
||||
Long serverId;
|
||||
boolean economyEnabled = false;
|
||||
if(ContextUtils.isNotUserCommand(event)) {
|
||||
serverId = event.getGuild().getIdLong();
|
||||
economyEnabled = featureFlagService.getFeatureFlagValue(EntertainmentFeatureDefinition.ECONOMY, serverId);
|
||||
if(economyEnabled){
|
||||
credit = 50;
|
||||
if(slashCommandParameterService.hasCommandOption(CREDITS_PARAMETER, event)) {
|
||||
credit = slashCommandParameterService.getCommandOption(CREDITS_PARAMETER, event, Integer.class);
|
||||
}
|
||||
|
||||
Optional<EconomyUser> userOptional = economyUserManagementService.getUser(ServerUser.fromMember(event.getMember()));
|
||||
if(!userOptional.isPresent()) {
|
||||
throw new NotEnoughCreditsException();
|
||||
}
|
||||
EconomyUser user = userOptional.get();
|
||||
if(user.getCredits() < credit) {
|
||||
throw new NotEnoughCreditsException();
|
||||
Optional<EconomyUser> userOptional = economyUserManagementService.getUser(ServerUser.fromMember(event.getMember()));
|
||||
if(!userOptional.isPresent()) {
|
||||
throw new NotEnoughCreditsException();
|
||||
}
|
||||
EconomyUser user = userOptional.get();
|
||||
if(user.getCredits() < credit) {
|
||||
throw new NotEnoughCreditsException();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
serverId = null;
|
||||
}
|
||||
MineBoard board = gameService.createBoard(width, height, mines, serverId);
|
||||
board.setCreditsEnabled(economyEnabled);
|
||||
board.setUserId(event.getMember().getIdLong());
|
||||
board.setUserId(event.getUser().getIdLong());
|
||||
board.setServerId(serverId);
|
||||
board.setCredits(credit);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(MINE_BOARD_TEMPLATE_KEY, board);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(MINE_BOARD_TEMPLATE_KEY, board, serverId);
|
||||
return interactionService.replyMessageToSend(messageToSend, event)
|
||||
.thenCompose(interactionHook -> interactionHook.retrieveOriginal().submit())
|
||||
.thenApply(message -> {
|
||||
gameService.persistMineBoardMessage(board, message);
|
||||
gameService.persistMineBoardMessage(board, message, serverId);
|
||||
return CommandResult.fromSuccess();
|
||||
});
|
||||
}
|
||||
@@ -129,7 +137,7 @@ public class Mines extends AbstractConditionableCommand {
|
||||
mines = (Integer) parameters.get(2);
|
||||
}
|
||||
Integer credit = null;
|
||||
long serverId = commandContext.getGuild().getIdLong();
|
||||
Long serverId = commandContext.getGuild().getIdLong();
|
||||
boolean economyEnabled = featureFlagService.getFeatureFlagValue(EntertainmentFeatureDefinition.ECONOMY, serverId);
|
||||
if(economyEnabled){
|
||||
credit = 50;
|
||||
@@ -151,10 +159,10 @@ public class Mines extends AbstractConditionableCommand {
|
||||
board.setUserId(commandContext.getAuthor().getIdLong());
|
||||
board.setServerId(serverId);
|
||||
board.setCredits(credit);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(MINE_BOARD_TEMPLATE_KEY, board);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(MINE_BOARD_TEMPLATE_KEY, board, serverId);
|
||||
List<CompletableFuture<Message>> futures = channelService.sendMessageToSendToChannel(messageToSend, commandContext.getChannel());
|
||||
return FutureUtils.toSingleFutureGeneric(futures)
|
||||
.thenAccept(unused -> gameService.persistMineBoardMessage(board, futures.get(0).join()))
|
||||
.thenAccept(unused -> gameService.persistMineBoardMessage(board, futures.get(0).join(), serverId))
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
|
||||
}
|
||||
@@ -207,6 +215,8 @@ public class Mines extends AbstractConditionableCommand {
|
||||
SlashCommandConfig slashCommandConfig = SlashCommandConfig
|
||||
.builder()
|
||||
.enabled(true)
|
||||
.userInstallable(true)
|
||||
.userCommandConfig(UserCommandConfig.all())
|
||||
.rootCommandName(EntertainmentSlashCommandNames.GAME)
|
||||
.commandName(MINES_COMMAND_NAME)
|
||||
.build();
|
||||
|
||||
@@ -9,6 +9,7 @@ import dev.sheldan.abstracto.core.interaction.button.listener.ButtonClickedListe
|
||||
import dev.sheldan.abstracto.core.service.FeatureFlagService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.ContextUtils;
|
||||
import dev.sheldan.abstracto.entertainment.command.games.Mines;
|
||||
import dev.sheldan.abstracto.entertainment.config.EntertainmentFeatureDefinition;
|
||||
import dev.sheldan.abstracto.entertainment.model.command.games.MineBoard;
|
||||
@@ -49,13 +50,15 @@ public class MinesButtonClickedListener implements ButtonClickedListener {
|
||||
GameService.MineResult mineResult = gameService.uncoverField(mineBoard, payload.getX(), payload.getY());
|
||||
mineBoard.setState(mineResult);
|
||||
if(mineBoard.getState() != GameService.MineResult.CONTINUE) {
|
||||
if(featureFlagService.getFeatureFlagValue(EntertainmentFeatureDefinition.ECONOMY, model.getServerId())){
|
||||
gameService.evaluateCreditChanges(mineBoard);
|
||||
if(ContextUtils.isNotUserCommand(model.getEvent())) {
|
||||
if(featureFlagService.getFeatureFlagValue(EntertainmentFeatureDefinition.ECONOMY, model.getServerId())){
|
||||
gameService.evaluateCreditChanges(mineBoard);
|
||||
}
|
||||
}
|
||||
gameService.uncoverBoard(mineBoard);
|
||||
}
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(Mines.MINE_BOARD_TEMPLATE_KEY, mineBoard);
|
||||
interactionService.editOriginal(messageToSend, model.getEvent().getHook()).thenAccept(message -> {
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(Mines.MINE_BOARD_TEMPLATE_KEY, mineBoard, model.getServerId());
|
||||
interactionService.replaceOriginal(messageToSend, model.getEvent().getHook()).thenAccept(message -> {
|
||||
gameService.updateMineBoard(mineBoard);
|
||||
log.info("Updated original mineboard for board {}.", mineBoard.getBoardId());
|
||||
});
|
||||
|
||||
@@ -105,7 +105,9 @@ public class EntertainmentServiceBean implements EntertainmentService {
|
||||
|
||||
@Override
|
||||
public Integer getLoveCalcValue(String firstPart, String secondPart) {
|
||||
return secureRandom.nextInt(100);
|
||||
String fullInput = firstPart.toLowerCase() + secondPart.toLowerCase();
|
||||
Random random = new Random(fullInput.hashCode());
|
||||
return random.nextInt(100);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,8 +193,8 @@ public class EntertainmentServiceBean implements EntertainmentService {
|
||||
.text(pressF.getText())
|
||||
.messageId(pressF.getMessageId())
|
||||
.build();
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(PRESS_F_RESULT_TEMPLATE_KEY, model);
|
||||
Long serverId = pressF.getServer().getId();
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(PRESS_F_RESULT_TEMPLATE_KEY, model, serverId);
|
||||
Long channelId = pressF.getPressFChannel().getId();
|
||||
Long messageId = pressF.getMessageId();
|
||||
return FutureUtils.toSingleFutureGeneric(channelService.sendMessageEmbedToSendToAChannel(messageToSend, pressF.getPressFChannel()))
|
||||
|
||||
@@ -70,10 +70,16 @@ public class GameServiceBean implements GameService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void persistMineBoardMessage(MineBoard mineBoard, Message message) {
|
||||
public void persistMineBoardMessage(MineBoard mineBoard, Message message, Long serverId) {
|
||||
mineBoard.setMessageId(message.getIdLong());
|
||||
mineBoard.setChannelId(message.getChannel().getIdLong());
|
||||
AServer server = serverManagementService.loadServer(message.getGuild());
|
||||
|
||||
AServer server;
|
||||
if(serverId != null) {
|
||||
server = serverManagementService.loadServer(serverId);
|
||||
} else {
|
||||
server = null;
|
||||
}
|
||||
mineBoard.getFields().forEach(mineBoardField -> {
|
||||
MineBoardPayload payload = MineBoardPayload
|
||||
.builder()
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="entertainment-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<property name="entertainmentModule" value="(SELECT id FROM module WHERE name = 'entertainment')"/>
|
||||
<property name="entertainmentFeature" value="(SELECT id FROM feature WHERE key = 'entertainment')"/>
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||
<include file="module.xml" relativeToChangelogFile="true"/>
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="entertainment_feature-insertion">
|
||||
<insert tableName="feature">
|
||||
<column name="key" value="entertainment"/>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<changeSet author="Sheldan" id="entertainment-module-insertion">
|
||||
<insert tableName="module">
|
||||
<column name="name" value="entertainment"/>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="entertainment-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<property name="entertainmentModule" value="(SELECT id FROM module WHERE name = 'entertainment')"/>
|
||||
<property name="entertainmentFeature" value="(SELECT id FROM feature WHERE key = 'entertainment')"/>
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="entertainment-seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<property name="entertainmentModule" value="(SELECT id FROM module WHERE name = 'entertainment')"/>
|
||||
<property name="entertainmentFeature" value="(SELECT id FROM feature WHERE key = 'entertainment')"/>
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,11 +1,7 @@
|
||||
<?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" >
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.26.xsd" >
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user