Compare commits
35 Commits
1.2.1
...
2545cdfc7f
Author | SHA1 | Date | |
---|---|---|---|
2545cdfc7f | |||
d5b0801f24 | |||
9622232c33 | |||
d09a13f0ee | |||
3360baad6c | |||
0de8b9b41d | |||
0e647fabe7 | |||
76787cb180 | |||
15b2e22642 | |||
f520f4e7ec | |||
959cf33272 | |||
be174cf970 | |||
934e0e1423 | |||
0c3e298562 | |||
42eeb068e3 | |||
89199004c4 | |||
8f26835d72 | |||
4c1de9e20b | |||
9c5760e0f9 | |||
dd6b609094 | |||
3810dec927 | |||
a87380f6f8 | |||
98ac7835b6 | |||
0a76068604 | |||
f9caf59180 | |||
284318bb10 | |||
6130cac6fe | |||
3a64c51600 | |||
90fce5a79a | |||
d448ad7707 | |||
19791ff9d8 | |||
3cba8de675 | |||
b7ff070676 | |||
c88e07d743 | |||
f5b978b231 |
@@ -8,8 +8,14 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
on-push-deploy_sh-edraft:
|
on-push-deploy_sh-edraft:
|
||||||
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
||||||
container: sh-edraft.de/act-runner:latest
|
container: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup Python 3.10
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3.10.12"
|
||||||
|
- run: python -v
|
||||||
|
|
||||||
- name: Setup docker
|
- name: Setup docker
|
||||||
uses: https://github.com/papodaca/install-docker-action@main
|
uses: https://github.com/papodaca/install-docker-action@main
|
||||||
- run: docker -v
|
- run: docker -v
|
||||||
@@ -20,12 +26,21 @@ jobs:
|
|||||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
|
- name: Shutdown stack
|
||||||
|
run: docker stack rm sdb_staging
|
||||||
|
|
||||||
- name: Prepare bot build
|
- name: Prepare bot build
|
||||||
run: |
|
run: |
|
||||||
cd bot
|
cd bot
|
||||||
python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
||||||
cpl i
|
cpl i
|
||||||
|
|
||||||
|
- name: Build docker bot
|
||||||
|
run: |
|
||||||
|
cd bot
|
||||||
|
docker image prune -f
|
||||||
|
cpl docker-build
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: https://github.com/actions/setup-node@v3
|
uses: https://github.com/actions/setup-node@v3
|
||||||
|
|
||||||
@@ -33,31 +48,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
npm install -g ts-node
|
npm install -g ts-node
|
||||||
npm ci
|
npm i
|
||||||
|
|
||||||
- name: Shutdown stack
|
|
||||||
run: docker stack rm sdb_dev
|
|
||||||
|
|
||||||
- name: Build docker bot
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
docker image prune -f
|
|
||||||
cpl build
|
|
||||||
docker build -t sh-edraft.de/sdb-bot:$(cpl gv)-dev .
|
|
||||||
|
|
||||||
- name: Build docker web
|
- name: Build docker web
|
||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
cp src/favicon.dev.ico src/favicon.ico
|
npm run docker-build
|
||||||
npm run build
|
|
||||||
docker build -t sh-edraft.de/sdb-web:$(npm run -s gv)-dev .
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
cd bot/docker
|
|
||||||
chmod +x ./set-docker-compose-image-version.sh
|
|
||||||
./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-dev sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-dev
|
|
||||||
|
|
||||||
- name: Deploy Stack to sh-edraft.de
|
- name: Deploy Stack to sh-edraft.de
|
||||||
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
||||||
@@ -66,6 +63,6 @@ jobs:
|
|||||||
portainer-username: "gitea_job"
|
portainer-username: "gitea_job"
|
||||||
portainer-password: "${{ secrets.docker_job }}"
|
portainer-password: "${{ secrets.docker_job }}"
|
||||||
portainer-endpoint: 2
|
portainer-endpoint: 2
|
||||||
name: sdb_dev
|
name: sdb_staging
|
||||||
file: bot/docker/docker-compose.dev.yml
|
file: bot/docker/docker-compose.staging.yml
|
||||||
variables: '{}'
|
variables: '{}'
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name: Deploy prod on push
|
name: Deploy dev on push
|
||||||
run-name: Deploy prod on push
|
run-name: Deploy dev on push
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -8,24 +8,36 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
on-push-deploy_sh-edraft:
|
on-push-deploy_sh-edraft:
|
||||||
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
||||||
container: sh-edraft.de/act-runner:latest
|
container: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup Python 3.10
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3.10.12"
|
||||||
|
- run: python -v
|
||||||
|
|
||||||
- name: Setup docker
|
- name: Setup docker
|
||||||
uses: https://github.com/papodaca/install-docker-action@main
|
uses: https://github.com/papodaca/install-docker-action@main
|
||||||
- run: docker -v
|
- run: docker -v
|
||||||
|
|
||||||
- name: Clone Repository
|
- name: Clone Repository
|
||||||
uses: https://github.com/actions/checkout@v3
|
uses: https://github.com/actions/checkout@v3
|
||||||
with:
|
|
||||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
- name: Shutdown stack
|
||||||
submodules: true
|
run: docker stack rm sdb_prod
|
||||||
|
|
||||||
- name: Prepare bot build
|
- name: Prepare bot build
|
||||||
run: |
|
run: |
|
||||||
cd bot
|
cd bot
|
||||||
python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
||||||
cpl i
|
cpl i
|
||||||
|
|
||||||
|
- name: Build docker bot
|
||||||
|
run: |
|
||||||
|
cd bot
|
||||||
|
docker image prune -f
|
||||||
|
cpl docker-build
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: https://github.com/actions/setup-node@v3
|
uses: https://github.com/actions/setup-node@v3
|
||||||
|
|
||||||
@@ -33,30 +45,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
npm install -g ts-node
|
npm install -g ts-node
|
||||||
npm ci
|
npm i
|
||||||
|
|
||||||
- name: Shutdown stack
|
|
||||||
run: docker stack rm sdb_prod
|
|
||||||
|
|
||||||
- name: Build docker bot
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
docker image prune -f
|
|
||||||
cpl build
|
|
||||||
docker build -t sh-edraft.de/sdb-bot:$(cpl gv) .
|
|
||||||
|
|
||||||
- name: Build docker web
|
- name: Build docker web
|
||||||
run: |
|
run: |
|
||||||
cd web
|
cd web
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
npm run build
|
npm run docker-build
|
||||||
docker build -t sh-edraft.de/sdb-web:$(npm run -s gv) .
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
cd bot/docker
|
|
||||||
chmod +x ./set-docker-compose-image-version.sh
|
|
||||||
./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv) sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)
|
|
||||||
|
|
||||||
- name: Deploy Stack to sh-edraft.de
|
- name: Deploy Stack to sh-edraft.de
|
||||||
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
||||||
@@ -66,5 +61,5 @@ jobs:
|
|||||||
portainer-password: "${{ secrets.docker_job }}"
|
portainer-password: "${{ secrets.docker_job }}"
|
||||||
portainer-endpoint: 2
|
portainer-endpoint: 2
|
||||||
name: sdb_prod
|
name: sdb_prod
|
||||||
file: bot/docker/docker-compose.yml
|
file: ./docker-compose.yml
|
||||||
variables: '{}'
|
variables: '{}'
|
||||||
|
@@ -1,71 +0,0 @@
|
|||||||
name: Deploy staging on push
|
|
||||||
run-name: Deploy staging on push
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- staging
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
on-push-deploy_sh-edraft:
|
|
||||||
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
|
|
||||||
container: sh-edraft.de/act-runner:latest
|
|
||||||
steps:
|
|
||||||
- name: Setup docker
|
|
||||||
uses: https://github.com/papodaca/install-docker-action@main
|
|
||||||
- run: docker -v
|
|
||||||
|
|
||||||
- name: Clone Repository
|
|
||||||
uses: https://github.com/actions/checkout@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Prepare bot build
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
python3.10 -m pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
|
|
||||||
cpl i
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: https://github.com/actions/setup-node@v3
|
|
||||||
|
|
||||||
- name: Prepare web build
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
npm install -g ts-node
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Shutdown stack
|
|
||||||
run: docker stack rm sdb_staging
|
|
||||||
|
|
||||||
- name: Build docker bot
|
|
||||||
run: |
|
|
||||||
cd bot
|
|
||||||
docker image prune -f
|
|
||||||
cpl build
|
|
||||||
docker build -t sh-edraft.de/sdb-bot:$(cpl gv)-staging .
|
|
||||||
|
|
||||||
- name: Build docker web
|
|
||||||
run: |
|
|
||||||
cd web
|
|
||||||
docker image prune -f
|
|
||||||
cp src/favicon.staging.ico src/favicon.ico
|
|
||||||
npm run build
|
|
||||||
docker build -t sh-edraft.de/sdb-web:$(npm run -s gv)-staging .
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
cd bot/docker
|
|
||||||
chmod +x ./set-docker-compose-image-version.sh
|
|
||||||
./set-docker-compose-image-version.sh sh-edraft.de/sdb-bot:$(cd ../; cpl gv)-staging sh-edraft.de/sdb-web:$(cd ../../web; npm run -s gv;)-staging
|
|
||||||
|
|
||||||
- name: Deploy Stack to sh-edraft.de
|
|
||||||
uses: https://github.com/kgierke/portainer-stack-deployment@v1
|
|
||||||
with:
|
|
||||||
portainer-url: "https://docker.sh-edraft.de"
|
|
||||||
portainer-username: "gitea_job"
|
|
||||||
portainer-password: "${{ secrets.docker_job }}"
|
|
||||||
portainer-endpoint: 2
|
|
||||||
name: sdb_staging
|
|
||||||
file: bot/docker/docker-compose.staging.yml
|
|
||||||
variables: '{}'
|
|
Submodule bot/docker updated: 9c0dc59534...91461d3ce3
@@ -15,7 +15,7 @@ __title__ = "bot"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -11,7 +11,6 @@ from bot_api.api_thread import ApiThread
|
|||||||
from bot_core.abc.task_abc import TaskABC
|
from bot_core.abc.task_abc import TaskABC
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
from bot_core.service.data_integrity_service import DataIntegrityService
|
from bot_core.service.data_integrity_service import DataIntegrityService
|
||||||
|
|
||||||
|
|
||||||
@@ -59,9 +58,8 @@ class Application(DiscordBotApplicationABC):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._logger.info(__name__, f"Try to start {DiscordBotService.__name__}")
|
self._logger.info(__name__, f"Try to start {DiscordBotService.__name__}")
|
||||||
if not self._config.get_configuration(MAINTENANCE):
|
for task in self._tasks:
|
||||||
for task in self._tasks:
|
await self._bot.add_cog(task)
|
||||||
await self._bot.add_cog(task)
|
|
||||||
|
|
||||||
await self._bot.start_async()
|
await self._bot.start_async()
|
||||||
await self._bot.stop_async()
|
await self._bot.stop_async()
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
Submodule bot/src/bot/config updated: c11ca6f2e8...6f4414ce9d
@@ -15,7 +15,7 @@ __title__ = "bot.extension"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -9,7 +9,7 @@ from bot.application import Application
|
|||||||
from bot.extension.init_bot_extension import InitBotExtension
|
from bot.extension.init_bot_extension import InitBotExtension
|
||||||
from bot.startup import Startup
|
from bot.startup import Startup
|
||||||
from bot.startup_discord_extension import StartupDiscordExtension
|
from bot.startup_discord_extension import StartupDiscordExtension
|
||||||
from bot_data.startup_migration_extension import StartupMigrationExtension
|
from bot.startup_migration_extension import StartupMigrationExtension
|
||||||
from bot.startup_module_extension import StartupModuleExtension
|
from bot.startup_module_extension import StartupModuleExtension
|
||||||
from bot.startup_settings_extension import StartupSettingsExtension
|
from bot.startup_settings_extension import StartupSettingsExtension
|
||||||
from bot_api.app_api_extension import AppApiExtension
|
from bot_api.app_api_extension import AppApiExtension
|
||||||
|
@@ -20,8 +20,6 @@ from bot_data.migration.fix_updates_migration import FixUpdatesMigration
|
|||||||
from bot_data.migration.fix_user_history_migration import FixUserHistoryMigration
|
from bot_data.migration.fix_user_history_migration import FixUserHistoryMigration
|
||||||
from bot_data.migration.initial_migration import InitialMigration
|
from bot_data.migration.initial_migration import InitialMigration
|
||||||
from bot_data.migration.level_migration import LevelMigration
|
from bot_data.migration.level_migration import LevelMigration
|
||||||
from bot_data.migration.maintenance_mode_migration import MaintenanceModeMigration
|
|
||||||
from bot_data.migration.max_steam_offer_count_migration import MaxSteamOfferCountMigration
|
|
||||||
from bot_data.migration.remove_stats_migration import RemoveStatsMigration
|
from bot_data.migration.remove_stats_migration import RemoveStatsMigration
|
||||||
from bot_data.migration.short_role_name_migration import ShortRoleNameMigration
|
from bot_data.migration.short_role_name_migration import ShortRoleNameMigration
|
||||||
from bot_data.migration.short_role_name_only_highest_migration import (
|
from bot_data.migration.short_role_name_only_highest_migration import (
|
||||||
@@ -70,5 +68,3 @@ class StartupMigrationExtension(StartupExtensionABC):
|
|||||||
services.add_transient(MigrationABC, FixUserHistoryMigration) # 10.10.2023 #401 - 1.2.0
|
services.add_transient(MigrationABC, FixUserHistoryMigration) # 10.10.2023 #401 - 1.2.0
|
||||||
services.add_transient(MigrationABC, BirthdayMigration) # 10.10.2023 #401 - 1.2.0
|
services.add_transient(MigrationABC, BirthdayMigration) # 10.10.2023 #401 - 1.2.0
|
||||||
services.add_transient(MigrationABC, SteamSpecialOfferMigration) # 10.10.2023 #188 - 1.2.0
|
services.add_transient(MigrationABC, SteamSpecialOfferMigration) # 10.10.2023 #188 - 1.2.0
|
||||||
services.add_transient(MigrationABC, MaxSteamOfferCountMigration) # 04.11.2023 #188 - 1.2.0
|
|
||||||
services.add_transient(MigrationABC, MaintenanceModeMigration) # 06.11.2023 #424 - 1.2.0
|
|
@@ -8,7 +8,6 @@ from cpl_core.dependency_injection import ServiceCollectionABC
|
|||||||
from cpl_core.environment import ApplicationEnvironmentABC
|
from cpl_core.environment import ApplicationEnvironmentABC
|
||||||
|
|
||||||
from bot_core.configuration.bot_logging_settings import BotLoggingSettings
|
from bot_core.configuration.bot_logging_settings import BotLoggingSettings
|
||||||
from bot_core.environment_variables import MAINTENANCE, MIGRATION_ONLY
|
|
||||||
|
|
||||||
|
|
||||||
class StartupSettingsExtension(StartupExtensionABC):
|
class StartupSettingsExtension(StartupExtensionABC):
|
||||||
@@ -20,12 +19,6 @@ class StartupSettingsExtension(StartupExtensionABC):
|
|||||||
environment.set_working_directory(os.path.dirname(os.path.realpath(__file__)))
|
environment.set_working_directory(os.path.dirname(os.path.realpath(__file__)))
|
||||||
configuration.add_environment_variables("SDB_")
|
configuration.add_environment_variables("SDB_")
|
||||||
configuration.add_environment_variables("DISCORD_")
|
configuration.add_environment_variables("DISCORD_")
|
||||||
configuration.add_configuration(
|
|
||||||
MAINTENANCE, configuration.get_configuration(MAINTENANCE) in [True, "true", "True"]
|
|
||||||
)
|
|
||||||
configuration.add_configuration(
|
|
||||||
MIGRATION_ONLY, configuration.get_configuration(MIGRATION_ONLY) in [True, "true", "True"]
|
|
||||||
)
|
|
||||||
|
|
||||||
configuration.add_json_file(f"config/appsettings.json", optional=False)
|
configuration.add_json_file(f"config/appsettings.json", optional=False)
|
||||||
configuration.add_json_file(f"config/appsettings.{environment.environment_name}.json", optional=True)
|
configuration.add_json_file(f"config/appsettings.{environment.environment_name}.json", optional=True)
|
||||||
|
@@ -90,8 +90,7 @@
|
|||||||
"booting": "Ich fahre gerade hoch...",
|
"booting": "Ich fahre gerade hoch...",
|
||||||
"restart": "Muss neue Kekse holen...",
|
"restart": "Muss neue Kekse holen...",
|
||||||
"running": "Ich esse Kekse :D",
|
"running": "Ich esse Kekse :D",
|
||||||
"shutdown": "Ich werde bestimmt wieder kommen...",
|
"shutdown": "Ich werde bestimmt wieder kommen..."
|
||||||
"maintenance": "In Wartung!"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modules": {
|
"modules": {
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.abc"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
|
Submodule bot/src/bot_api/config updated: 521951b8ab...b6ffed4da1
@@ -15,7 +15,7 @@ __title__ = "bot_api.configuration"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.controller"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.event"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.exception"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.filter"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.filter.discord"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.logging"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.model"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.model.discord"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.route"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.service"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_api.transformer"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.abc"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -75,7 +75,3 @@ class ClientUtilsABC(ABC):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def check_default_role(self, member: Union[discord.User, discord.Member]):
|
async def check_default_role(self, member: Union[discord.User, discord.Member]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
async def set_maintenance_mode(self, state: bool):
|
|
||||||
pass
|
|
||||||
|
@@ -6,7 +6,6 @@ from cpl_core.dependency_injection import ServiceProviderABC
|
|||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
from bot_core.logging.task_logger import TaskLogger
|
from bot_core.logging.task_logger import TaskLogger
|
||||||
|
|
||||||
|
|
||||||
@@ -15,18 +14,14 @@ class TaskABC(commands.Cog):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
commands.Cog.__init__(self)
|
commands.Cog.__init__(self)
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def _is_maintenance(self, config: ConfigurationABC) -> bool:
|
|
||||||
return config.get_configuration(MAINTENANCE) is True
|
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
@ServiceProviderABC.inject
|
||||||
async def _wait_until_ready(self, config: ConfigurationABC, logger: TaskLogger, bot: DiscordBotServiceABC):
|
async def _wait_until_ready(self, config: ConfigurationABC, logger: TaskLogger, bot: DiscordBotServiceABC):
|
||||||
logger.debug(__name__, f"Waiting before {type(self).__name__}")
|
logger.debug(__name__, f"Waiting before {type(self).__name__}")
|
||||||
await bot.wait_until_ready()
|
await bot.wait_until_ready()
|
||||||
|
|
||||||
async def wait():
|
async def wait():
|
||||||
is_ready = config.get_configuration("IS_READY") is True
|
is_ready = config.get_configuration("IS_READY")
|
||||||
if not is_ready:
|
if is_ready != "true":
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
await wait()
|
await wait()
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.configuration"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.core_extension"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -1,19 +1,16 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.logging import LoggerABC
|
from cpl_core.logging import LoggerABC
|
||||||
from cpl_discord.events import OnReadyABC
|
from cpl_discord.events import OnReadyABC
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
from cpl_translation import TranslatePipe
|
from cpl_translation import TranslatePipe
|
||||||
|
|
||||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
|
|
||||||
|
|
||||||
class CoreExtensionOnReadyEvent(OnReadyABC):
|
class CoreExtensionOnReadyEvent(OnReadyABC):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: ConfigurationABC,
|
|
||||||
logger: LoggerABC,
|
logger: LoggerABC,
|
||||||
bot: DiscordBotServiceABC,
|
bot: DiscordBotServiceABC,
|
||||||
client_utils: ClientUtilsABC,
|
client_utils: ClientUtilsABC,
|
||||||
@@ -21,7 +18,6 @@ class CoreExtensionOnReadyEvent(OnReadyABC):
|
|||||||
):
|
):
|
||||||
OnReadyABC.__init__(self)
|
OnReadyABC.__init__(self)
|
||||||
|
|
||||||
self._config = config
|
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._bot = bot
|
self._bot = bot
|
||||||
self._client_utils = client_utils
|
self._client_utils = client_utils
|
||||||
@@ -31,5 +27,5 @@ class CoreExtensionOnReadyEvent(OnReadyABC):
|
|||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
self._logger.debug(__name__, f"Module {type(self)} started")
|
self._logger.debug(__name__, f"Module {type(self)} started")
|
||||||
await self._client_utils.set_maintenance_mode(self._config.get_configuration(MAINTENANCE))
|
await self._client_utils.presence_game("common.presence.running")
|
||||||
self._logger.trace(__name__, f"Module {type(self)} stopped")
|
self._logger.trace(__name__, f"Module {type(self)} stopped")
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
MIGRATION_ONLY = "MIGRATION_ONLY"
|
|
||||||
MAINTENANCE = "MAINTENANCE"
|
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.events"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.exception"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.helper"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import inspect
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
@@ -18,18 +17,11 @@ class EventChecks:
|
|||||||
cls._client_utils = client_utils
|
cls._client_utils = client_utils
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_is_ready(cls, func):
|
def check_is_ready(cls):
|
||||||
async def check_if_bot_is_ready(*args, **kwargs):
|
async def check_if_bot_is_ready() -> bool:
|
||||||
result = await cls._client_utils.check_if_bot_is_ready_yet()
|
result = await cls._client_utils.check_if_bot_is_ready_yet()
|
||||||
if not result:
|
if not result:
|
||||||
|
raise CheckError(f"Bot is not ready")
|
||||||
|
return result
|
||||||
|
|
||||||
def empty(*args, **kwargs):
|
return commands.check(check_if_bot_is_ready)
|
||||||
return
|
|
||||||
|
|
||||||
return empty
|
|
||||||
return await func(*args, **kwargs)
|
|
||||||
|
|
||||||
check_if_bot_is_ready.__name__ = func.__name__
|
|
||||||
sig = inspect.signature(func)
|
|
||||||
check_if_bot_is_ready.__signature__ = sig.replace(parameters=tuple(sig.parameters.values())[1:])
|
|
||||||
return check_if_bot_is_ready
|
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.logging"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.pipes"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_core.service"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -16,7 +16,6 @@ from bot_core.abc.client_utils_abc import ClientUtilsABC
|
|||||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
from bot_data.abc.client_repository_abc import ClientRepositoryABC
|
from bot_data.abc.client_repository_abc import ClientRepositoryABC
|
||||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||||
from bot_data.abc.user_joined_voice_channel_repository_abc import (
|
from bot_data.abc.user_joined_voice_channel_repository_abc import (
|
||||||
@@ -88,14 +87,7 @@ class ClientUtilsService(ClientUtilsABC):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
async def check_if_bot_is_ready_yet(self) -> bool:
|
async def check_if_bot_is_ready_yet(self) -> bool:
|
||||||
if self._config.get_configuration(MAINTENANCE):
|
if self._config.get_configuration("IS_READY") == "true":
|
||||||
self._logger.warn(
|
|
||||||
__name__,
|
|
||||||
f"Bot is in maintenance mode",
|
|
||||||
)
|
|
||||||
return False
|
|
||||||
|
|
||||||
if self._config.get_configuration("IS_READY") is True:
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self._logger.debug(
|
self._logger.debug(
|
||||||
@@ -247,10 +239,3 @@ class ClientUtilsService(ClientUtilsABC):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._logger.error(__name__, f"Cannot check for default role for member {member.id}", e)
|
self._logger.error(__name__, f"Cannot check for default role for member {member.id}", e)
|
||||||
|
|
||||||
async def set_maintenance_mode(self, state: bool):
|
|
||||||
self._config.add_configuration(MAINTENANCE, state)
|
|
||||||
if state:
|
|
||||||
await self.presence_game("common.presence.maintenance")
|
|
||||||
else:
|
|
||||||
await self.presence_game("common.presence.running")
|
|
||||||
|
@@ -7,7 +7,6 @@ from bot_data.abc.technician_config_repository_abc import TechnicianConfigReposi
|
|||||||
from bot_data.model.server import Server
|
from bot_data.model.server import Server
|
||||||
from bot_data.model.technician_config import TechnicianConfig
|
from bot_data.model.technician_config import TechnicianConfig
|
||||||
from bot_data.service.server_config_seeder import ServerConfigSeeder
|
from bot_data.service.server_config_seeder import ServerConfigSeeder
|
||||||
from bot_data.service.technician_config_seeder import TechnicianConfigSeeder
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigService:
|
class ConfigService:
|
||||||
@@ -17,24 +16,17 @@ class ConfigService:
|
|||||||
services: ServiceProviderABC,
|
services: ServiceProviderABC,
|
||||||
technician_config_repo: TechnicianConfigRepositoryABC,
|
technician_config_repo: TechnicianConfigRepositoryABC,
|
||||||
server_config_repo: ServerConfigRepositoryABC,
|
server_config_repo: ServerConfigRepositoryABC,
|
||||||
technician_seeder: TechnicianConfigSeeder,
|
|
||||||
server_seeder: ServerConfigSeeder,
|
server_seeder: ServerConfigSeeder,
|
||||||
):
|
):
|
||||||
self._config = config
|
self._config = config
|
||||||
self._services = services
|
self._services = services
|
||||||
self._technician_config_repo = technician_config_repo
|
self._technician_config_repo = technician_config_repo
|
||||||
self._technician_seeder = technician_seeder
|
|
||||||
self._server_config_repo = server_config_repo
|
self._server_config_repo = server_config_repo
|
||||||
|
|
||||||
self._server_seeder = server_seeder
|
self._server_seeder = server_seeder
|
||||||
|
|
||||||
async def reload_technician_config(self):
|
def reload_technician_config(self):
|
||||||
try:
|
technician_config = self._technician_config_repo.get_technician_config()
|
||||||
technician_config = self._technician_config_repo.get_technician_config()
|
|
||||||
except Exception as e:
|
|
||||||
await self._technician_seeder.seed()
|
|
||||||
technician_config = self._technician_config_repo.get_technician_config()
|
|
||||||
|
|
||||||
self._config.add_configuration(TechnicianConfig, technician_config)
|
self._config.add_configuration(TechnicianConfig, technician_config)
|
||||||
self._config.add_configuration(
|
self._config.add_configuration(
|
||||||
FeatureFlagsSettings,
|
FeatureFlagsSettings,
|
||||||
|
@@ -389,22 +389,6 @@ class DataIntegrityService:
|
|||||||
for member in guild.members:
|
for member in guild.members:
|
||||||
await self._client_utils.check_default_role(member)
|
await self._client_utils.check_default_role(member)
|
||||||
|
|
||||||
def _check_for_bots(self):
|
|
||||||
for guild in self._bot.guilds:
|
|
||||||
server = self._servers.get_server_by_discord_id(guild.id)
|
|
||||||
|
|
||||||
for member in guild.members.where(lambda x: x.bot):
|
|
||||||
user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id)
|
|
||||||
if user is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
for join in self._user_joins.get_user_joined_servers_by_user_id(user.id):
|
|
||||||
self._user_joins.delete_user_joined_server(join)
|
|
||||||
|
|
||||||
self._user_joins_vc.delete_user_joined_voice_channel_by_user_id(user.id)
|
|
||||||
self._users.delete_user(user)
|
|
||||||
self._db_context.save_changes()
|
|
||||||
|
|
||||||
async def check_data_integrity(self, is_for_shutdown=False):
|
async def check_data_integrity(self, is_for_shutdown=False):
|
||||||
if is_for_shutdown != self._is_for_shutdown:
|
if is_for_shutdown != self._is_for_shutdown:
|
||||||
self._is_for_shutdown = is_for_shutdown
|
self._is_for_shutdown = is_for_shutdown
|
||||||
@@ -418,4 +402,3 @@ class DataIntegrityService:
|
|||||||
self._check_user_joins_vc()
|
self._check_user_joins_vc()
|
||||||
self._check_user_joined_gs()
|
self._check_user_joined_gs()
|
||||||
await self._check_for_user_achievements()
|
await self._check_for_user_achievements()
|
||||||
self._check_for_bots()
|
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_data"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_data.abc"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_data.migration"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -5,8 +5,6 @@ CREATE TABLE IF NOT EXISTS `CFG_TechnicianHistory`
|
|||||||
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
|
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
|
||||||
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
|
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
|
||||||
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
|
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
|
||||||
`MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250,
|
|
||||||
`Maintenance` BOOLEAN DEFAULT FALSE,
|
|
||||||
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
`FeatureFlags` JSON NULL DEFAULT ('{}'),
|
||||||
`Deleted` BOOL DEFAULT FALSE,
|
`Deleted` BOOL DEFAULT FALSE,
|
||||||
`DateFrom` DATETIME(6) NOT NULL,
|
`DateFrom` DATETIME(6) NOT NULL,
|
||||||
@@ -25,8 +23,6 @@ BEGIN
|
|||||||
`WaitForRestart`,
|
`WaitForRestart`,
|
||||||
`WaitForShutdown`,
|
`WaitForShutdown`,
|
||||||
`CacheMaxMessages`,
|
`CacheMaxMessages`,
|
||||||
`MaxSteamOfferCount`,
|
|
||||||
`Maintenance`,
|
|
||||||
`FeatureFlags`,
|
`FeatureFlags`,
|
||||||
`DateFrom`,
|
`DateFrom`,
|
||||||
`DateTo`)
|
`DateTo`)
|
||||||
@@ -35,8 +31,6 @@ BEGIN
|
|||||||
OLD.WaitForRestart,
|
OLD.WaitForRestart,
|
||||||
OLD.WaitForShutdown,
|
OLD.WaitForShutdown,
|
||||||
OLD.CacheMaxMessages,
|
OLD.CacheMaxMessages,
|
||||||
OLD.MaxSteamOfferCount,
|
|
||||||
OLD.Maintenance,
|
|
||||||
OLD.FeatureFlags,
|
OLD.FeatureFlags,
|
||||||
OLD.LastModifiedAt,
|
OLD.LastModifiedAt,
|
||||||
CURRENT_TIMESTAMP(6));
|
CURRENT_TIMESTAMP(6));
|
||||||
@@ -54,8 +48,6 @@ BEGIN
|
|||||||
`WaitForRestart`,
|
`WaitForRestart`,
|
||||||
`WaitForShutdown`,
|
`WaitForShutdown`,
|
||||||
`CacheMaxMessages`,
|
`CacheMaxMessages`,
|
||||||
`MaxSteamOfferCount`,
|
|
||||||
`Maintenance`,
|
|
||||||
`FeatureFlags`,
|
`FeatureFlags`,
|
||||||
`Deleted`,
|
`Deleted`,
|
||||||
`DateFrom`,
|
`DateFrom`,
|
||||||
@@ -65,8 +57,6 @@ BEGIN
|
|||||||
OLD.WaitForRestart,
|
OLD.WaitForRestart,
|
||||||
OLD.WaitForShutdown,
|
OLD.WaitForShutdown,
|
||||||
OLD.CacheMaxMessages,
|
OLD.CacheMaxMessages,
|
||||||
OLD.MaxSteamOfferCount,
|
|
||||||
OLD.Maintenance,
|
|
||||||
OLD.FeatureFlags,
|
OLD.FeatureFlags,
|
||||||
TRUE,
|
TRUE,
|
||||||
OLD.LastModifiedAt,
|
OLD.LastModifiedAt,
|
||||||
|
@@ -17,10 +17,14 @@ class FixUserHistoryMigration(MigrationABC):
|
|||||||
|
|
||||||
# fix 1.1.0_AchievementsMigration
|
# fix 1.1.0_AchievementsMigration
|
||||||
self._cursor.execute(
|
self._cursor.execute(
|
||||||
str(f"""ALTER TABLE UsersHistory ADD COLUMN ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;""")
|
str(
|
||||||
|
f"""ALTER TABLE UsersHistory ADD COLUMN IF NOT EXISTS ReactionCount BIGINT NOT NULL DEFAULT 0 AFTER XP;"""
|
||||||
|
)
|
||||||
)
|
)
|
||||||
self._cursor.execute(
|
self._cursor.execute(
|
||||||
str(f"""ALTER TABLE UsersHistory ADD COLUMN MessageCount BIGINT NOT NULL DEFAULT 0 AFTER ReactionCount;""")
|
str(
|
||||||
|
f"""ALTER TABLE UsersHistory ADD COLUMN IF NOT EXISTS MessageCount BIGINT NOT NULL DEFAULT 0 AFTER ReactionCount;"""
|
||||||
|
)
|
||||||
)
|
)
|
||||||
self._exec(__file__, "users.sql")
|
self._exec(__file__, "users.sql")
|
||||||
|
|
||||||
|
@@ -1,51 +0,0 @@
|
|||||||
from bot_core.logging.database_logger import DatabaseLogger
|
|
||||||
from bot_data.abc.migration_abc import MigrationABC
|
|
||||||
from bot_data.db_context import DBContext
|
|
||||||
|
|
||||||
|
|
||||||
class MaintenanceModeMigration(MigrationABC):
|
|
||||||
name = "1.2.0_MaintenanceModeMigration"
|
|
||||||
|
|
||||||
def __init__(self, logger: DatabaseLogger, db: DBContext):
|
|
||||||
MigrationABC.__init__(self)
|
|
||||||
self._logger = logger
|
|
||||||
self._db = db
|
|
||||||
self._cursor = db.cursor
|
|
||||||
|
|
||||||
def upgrade(self):
|
|
||||||
self._logger.debug(__name__, "Running upgrade")
|
|
||||||
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_Technician
|
|
||||||
ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self._exec(__file__, "config/technician.sql")
|
|
||||||
|
|
||||||
def downgrade(self):
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_Technician DROP COLUMN Maintenance;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_TechnicianHistory DROP COLUMN Maintenance;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
@@ -1,51 +0,0 @@
|
|||||||
from bot_core.logging.database_logger import DatabaseLogger
|
|
||||||
from bot_data.abc.migration_abc import MigrationABC
|
|
||||||
from bot_data.db_context import DBContext
|
|
||||||
|
|
||||||
|
|
||||||
class MaxSteamOfferCountMigration(MigrationABC):
|
|
||||||
name = "1.2.0_MaxSteamOfferCountMigration"
|
|
||||||
|
|
||||||
def __init__(self, logger: DatabaseLogger, db: DBContext):
|
|
||||||
MigrationABC.__init__(self)
|
|
||||||
self._logger = logger
|
|
||||||
self._db = db
|
|
||||||
self._cursor = db.cursor
|
|
||||||
|
|
||||||
def upgrade(self):
|
|
||||||
self._logger.debug(__name__, "Running upgrade")
|
|
||||||
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_Technician
|
|
||||||
ADD MaxSteamOfferCount BIGINT NOT NULL DEFAULT 250 AFTER CacheMaxMessages;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_TechnicianHistory
|
|
||||||
ADD MaxSteamOfferCount BIGINT NOT NULL DEFAULT 250 AFTER CacheMaxMessages;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self._exec(__file__, "config/technician.sql")
|
|
||||||
|
|
||||||
def downgrade(self):
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_Technician DROP COLUMN MaxSteamOfferCount;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self._cursor.execute(
|
|
||||||
str(
|
|
||||||
f"""
|
|
||||||
ALTER TABLE CFG_TechnicianHistory DROP COLUMN MaxSteamOfferCount;
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
)
|
|
@@ -36,7 +36,7 @@ class SteamSpecialOfferMigration(MigrationABC):
|
|||||||
str(
|
str(
|
||||||
f"""
|
f"""
|
||||||
ALTER TABLE CFG_Server
|
ALTER TABLE CFG_Server
|
||||||
ADD COLUMN GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
|
ADD COLUMN IF NOT EXISTS GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -45,7 +45,7 @@ class SteamSpecialOfferMigration(MigrationABC):
|
|||||||
str(
|
str(
|
||||||
f"""
|
f"""
|
||||||
ALTER TABLE CFG_ServerHistory
|
ALTER TABLE CFG_ServerHistory
|
||||||
ADD COLUMN GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
|
ADD COLUMN IF NOT EXISTS GameOfferNotificationChatId BIGINT NULL AFTER ShortRoleNameSetOnlyHighest;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_data.model"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,8 +15,6 @@ class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|||||||
wait_for_restart: int,
|
wait_for_restart: int,
|
||||||
wait_for_shutdown: int,
|
wait_for_shutdown: int,
|
||||||
cache_max_messages: int,
|
cache_max_messages: int,
|
||||||
max_steam_offer_count: int,
|
|
||||||
maintenance: bool,
|
|
||||||
feature_flags: dict[FeatureFlagsEnum],
|
feature_flags: dict[FeatureFlagsEnum],
|
||||||
technician_ids: List[int],
|
technician_ids: List[int],
|
||||||
ping_urls: List[str],
|
ping_urls: List[str],
|
||||||
@@ -29,9 +27,6 @@ class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|||||||
self._wait_for_restart = wait_for_restart
|
self._wait_for_restart = wait_for_restart
|
||||||
self._wait_for_shutdown = wait_for_shutdown
|
self._wait_for_shutdown = wait_for_shutdown
|
||||||
self._cache_max_messages = cache_max_messages
|
self._cache_max_messages = cache_max_messages
|
||||||
self._max_steam_offer_count = max_steam_offer_count
|
|
||||||
self._maintenance = maintenance
|
|
||||||
|
|
||||||
self._feature_flags = feature_flags
|
self._feature_flags = feature_flags
|
||||||
self._technician_ids = technician_ids
|
self._technician_ids = technician_ids
|
||||||
self._ping_urls = ping_urls
|
self._ping_urls = ping_urls
|
||||||
@@ -76,14 +71,6 @@ class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|||||||
def cache_max_messages(self, value: int):
|
def cache_max_messages(self, value: int):
|
||||||
self._cache_max_messages = value
|
self._cache_max_messages = value
|
||||||
|
|
||||||
@property
|
|
||||||
def max_steam_offer_count(self) -> int:
|
|
||||||
return self._max_steam_offer_count
|
|
||||||
|
|
||||||
@max_steam_offer_count.setter
|
|
||||||
def max_steam_offer_count(self, value: int):
|
|
||||||
self._max_steam_offer_count = value
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def feature_flags(self) -> dict[FeatureFlagsEnum]:
|
def feature_flags(self) -> dict[FeatureFlagsEnum]:
|
||||||
return self._feature_flags
|
return self._feature_flags
|
||||||
@@ -108,14 +95,6 @@ class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|||||||
def ping_urls(self, value: List[str]):
|
def ping_urls(self, value: List[str]):
|
||||||
self._ping_urls = value
|
self._ping_urls = value
|
||||||
|
|
||||||
@property
|
|
||||||
def maintenance(self) -> bool:
|
|
||||||
return self._maintenance
|
|
||||||
|
|
||||||
@maintenance.setter
|
|
||||||
def maintenance(self, value: bool):
|
|
||||||
self._maintenance = value
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_select_all_string() -> str:
|
def get_select_all_string() -> str:
|
||||||
return str(
|
return str(
|
||||||
@@ -138,13 +117,12 @@ class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
INSERT INTO `CFG_Technician` (
|
INSERT INTO `CFG_Technician` (
|
||||||
`HelpCommandReferenceUrl`, `WaitForRestart`, `WaitForShutdown`, `CacheMaxMessages`, `MaxSteamOfferCount`, `FeatureFlags`
|
`HelpCommandReferenceUrl`, `WaitForRestart`, `WaitForShutdown`, `CacheMaxMessages`, `FeatureFlags`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
'{self._help_command_reference_url}',
|
'{self._help_command_reference_url}',
|
||||||
{self._wait_for_restart},
|
{self._wait_for_restart},
|
||||||
{self._wait_for_shutdown},
|
{self._wait_for_shutdown},
|
||||||
{self._cache_max_messages},
|
{self._cache_max_messages},
|
||||||
{self._max_steam_offer_count},
|
|
||||||
'{json.dumps(self._feature_flags)}'
|
'{json.dumps(self._feature_flags)}'
|
||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
@@ -159,7 +137,6 @@ class TechnicianConfig(TableABC, ConfigurationModelABC):
|
|||||||
`WaitForRestart` = {self._wait_for_restart},
|
`WaitForRestart` = {self._wait_for_restart},
|
||||||
`WaitForShutdown` = {self._wait_for_shutdown},
|
`WaitForShutdown` = {self._wait_for_shutdown},
|
||||||
`CacheMaxMessages` = {self._cache_max_messages},
|
`CacheMaxMessages` = {self._cache_max_messages},
|
||||||
`MaxSteamOfferCount` = {self._max_steam_offer_count},
|
|
||||||
`FeatureFlags` = '{json.dumps(self._feature_flags)}'
|
`FeatureFlags` = '{json.dumps(self._feature_flags)}'
|
||||||
WHERE `Id` = {self._id};
|
WHERE `Id` = {self._id};
|
||||||
"""
|
"""
|
||||||
|
@@ -82,11 +82,11 @@ class User(TableABC):
|
|||||||
self._reaction_count = value
|
self._reaction_count = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def birthday(self) -> Optional[date]:
|
def birthday(self) -> Optional[datetime]:
|
||||||
return self._birthday
|
return self._birthday
|
||||||
|
|
||||||
@birthday.setter
|
@birthday.setter
|
||||||
def birthday(self, value: Optional[date]):
|
def birthday(self, value: Optional[datetime]):
|
||||||
self._birthday = value
|
self._birthday = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@@ -1,6 +1,3 @@
|
|||||||
from datetime import date
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
from cpl_query.extension import List
|
from cpl_query.extension import List
|
||||||
|
|
||||||
@@ -14,7 +11,6 @@ class UserHistory(HistoryTableABC):
|
|||||||
xp: int,
|
xp: int,
|
||||||
message_count: int,
|
message_count: int,
|
||||||
reaction_count: int,
|
reaction_count: int,
|
||||||
birthday: Optional[date],
|
|
||||||
server: int,
|
server: int,
|
||||||
deleted: bool,
|
deleted: bool,
|
||||||
date_from: str,
|
date_from: str,
|
||||||
@@ -28,7 +24,6 @@ class UserHistory(HistoryTableABC):
|
|||||||
self._xp = xp
|
self._xp = xp
|
||||||
self._message_count = message_count
|
self._message_count = message_count
|
||||||
self._reaction_count = reaction_count
|
self._reaction_count = reaction_count
|
||||||
self._birthday = birthday
|
|
||||||
self._server = server
|
self._server = server
|
||||||
|
|
||||||
self._deleted = deleted
|
self._deleted = deleted
|
||||||
@@ -55,10 +50,6 @@ class UserHistory(HistoryTableABC):
|
|||||||
def reaction_count(self) -> int:
|
def reaction_count(self) -> int:
|
||||||
return self._reaction_count
|
return self._reaction_count
|
||||||
|
|
||||||
@property
|
|
||||||
def birthday(self) -> Optional[date]:
|
|
||||||
return self._birthday
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def server(self) -> int:
|
def server(self) -> int:
|
||||||
return self._server
|
return self._server
|
||||||
|
@@ -124,6 +124,6 @@ class UserJoinedServer(TableABC):
|
|||||||
return str(
|
return str(
|
||||||
f"""
|
f"""
|
||||||
DELETE FROM `UserJoinedServers`
|
DELETE FROM `UserJoinedServers`
|
||||||
WHERE `JoinId` = {self._join_id};
|
WHERE `Id` = {self._join_id};
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_data.service"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -46,13 +46,11 @@ class TechnicianConfigRepositoryService(TechnicianConfigRepositoryABC):
|
|||||||
result[2],
|
result[2],
|
||||||
result[3],
|
result[3],
|
||||||
result[4],
|
result[4],
|
||||||
result[5],
|
json.loads(result[5]),
|
||||||
bool(result[6]),
|
|
||||||
json.loads(result[7]),
|
|
||||||
self._get_technician_ids(),
|
self._get_technician_ids(),
|
||||||
self._get_technician_ping_urls(),
|
self._get_technician_ping_urls(),
|
||||||
result[8],
|
result[6],
|
||||||
result[9],
|
result[7],
|
||||||
id=result[0],
|
id=result[0],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql.abc"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from ariadne import ObjectType
|
from ariadne import ObjectType
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.dependency_injection import ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
from cpl_core.type import T
|
from cpl_core.type import T
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
@@ -11,7 +10,6 @@ from bot_api.exception.service_error_code_enum import ServiceErrorCode
|
|||||||
from bot_api.exception.service_exception import ServiceException
|
from bot_api.exception.service_exception import ServiceException
|
||||||
from bot_api.route.route import Route
|
from bot_api.route.route import Route
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
from bot_data.model.achievement import Achievement
|
from bot_data.model.achievement import Achievement
|
||||||
from bot_data.model.auth_role_enum import AuthRoleEnum
|
from bot_data.model.auth_role_enum import AuthRoleEnum
|
||||||
from bot_data.model.auth_user import AuthUser
|
from bot_data.model.auth_user import AuthUser
|
||||||
@@ -77,14 +75,9 @@ class QueryABC(ObjectType):
|
|||||||
def get_services(services: ServiceProviderABC) -> ServiceProviderABC:
|
def get_services(services: ServiceProviderABC) -> ServiceProviderABC:
|
||||||
return services
|
return services
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
|
||||||
def get_config(config: ConfigurationABC) -> ConfigurationABC:
|
|
||||||
return config
|
|
||||||
|
|
||||||
services = get_services()
|
services = get_services()
|
||||||
permissions: PermissionService = services.get_service(PermissionService)
|
permissions: PermissionService = services.get_service(PermissionService)
|
||||||
bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
|
bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
|
||||||
config = get_config()
|
|
||||||
|
|
||||||
if user.auth_role == AuthRoleEnum.admin:
|
if user.auth_role == AuthRoleEnum.admin:
|
||||||
return True
|
return True
|
||||||
@@ -94,9 +87,6 @@ class QueryABC(ObjectType):
|
|||||||
if permissions.is_member_technician(guild.get_member(u.discord_id)):
|
if permissions.is_member_technician(guild.get_member(u.discord_id)):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if config.get_configuration(MAINTENANCE):
|
|
||||||
return False
|
|
||||||
|
|
||||||
access = False
|
access = False
|
||||||
if type(element) == Achievement:
|
if type(element) == Achievement:
|
||||||
element: Achievement = element
|
element: Achievement = element
|
||||||
@@ -225,9 +215,7 @@ class QueryABC(ObjectType):
|
|||||||
return access
|
return access
|
||||||
|
|
||||||
@ServiceProviderABC.inject
|
@ServiceProviderABC.inject
|
||||||
def _can_user_mutate_data(
|
def _can_user_mutate_data(self, server: Server, permission: UserRoleEnum, services: ServiceProviderABC):
|
||||||
self, server: Server, permission: UserRoleEnum, services: ServiceProviderABC, config: ConfigurationABC
|
|
||||||
):
|
|
||||||
permissions: PermissionService = services.get_service(PermissionService)
|
permissions: PermissionService = services.get_service(PermissionService)
|
||||||
bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
|
bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
|
||||||
|
|
||||||
@@ -239,20 +227,16 @@ class QueryABC(ObjectType):
|
|||||||
auth_user.users.where(lambda x: x.server.id == server.id).single().discord_id
|
auth_user.users.where(lambda x: x.server.id == server.id).single().discord_id
|
||||||
)
|
)
|
||||||
|
|
||||||
can_edit = lambda x: False
|
check_perm = lambda x: True
|
||||||
match permission:
|
match permission:
|
||||||
case UserRoleEnum.moderator:
|
case UserRoleEnum.moderator:
|
||||||
can_edit = permissions.is_member_moderator
|
check_perm = lambda x: permissions.is_member_moderator(x)
|
||||||
if config.get_configuration(MAINTENANCE):
|
|
||||||
can_edit = lambda x: False
|
|
||||||
case UserRoleEnum.admin:
|
case UserRoleEnum.admin:
|
||||||
can_edit = permissions.is_member_admin
|
check_perm = lambda x: permissions.is_member_admin(x)
|
||||||
if config.get_configuration(MAINTENANCE):
|
|
||||||
can_edit = lambda x: False
|
|
||||||
case UserRoleEnum.technician:
|
case UserRoleEnum.technician:
|
||||||
can_edit = permissions.is_member_technician
|
check_perm = lambda x: permissions.is_member_technician(x)
|
||||||
|
|
||||||
if not can_edit(member):
|
if not check_perm(member):
|
||||||
ex = ServiceException(ServiceErrorCode.Forbidden, f"User not allowed to mutate data")
|
ex = ServiceException(ServiceErrorCode.Forbidden, f"User not allowed to mutate data")
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql.filter"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -26,7 +26,6 @@ type Server implements TableWithHistoryQuery {
|
|||||||
gameServers: [GameServer]
|
gameServers: [GameServer]
|
||||||
|
|
||||||
userCount: Int
|
userCount: Int
|
||||||
activeUserCount: Int
|
|
||||||
users(filter: UserFilter, page: Page, sort: Sort): [User]
|
users(filter: UserFilter, page: Page, sort: Sort): [User]
|
||||||
|
|
||||||
achievementCount: Int
|
achievementCount: Int
|
||||||
@@ -38,8 +37,6 @@ type Server implements TableWithHistoryQuery {
|
|||||||
config: ServerConfig
|
config: ServerConfig
|
||||||
hasFeatureFlag(flag: String): FeatureFlag
|
hasFeatureFlag(flag: String): FeatureFlag
|
||||||
|
|
||||||
statistic(date: String): ServerStatistic
|
|
||||||
|
|
||||||
createdAt: String
|
createdAt: String
|
||||||
modifiedAt: String
|
modifiedAt: String
|
||||||
|
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
type ServerStatistic {
|
|
||||||
achievementsAchieved: Int
|
|
||||||
messageCount: Int
|
|
||||||
|
|
||||||
userCount: Int
|
|
||||||
activeUserCount: Int
|
|
||||||
|
|
||||||
userJoinedVoiceChannelCount: Int
|
|
||||||
userJoinedVoiceChannelOntime: Float
|
|
||||||
|
|
||||||
userJoinedGameServerCount: Int
|
|
||||||
userJoinedGameServerOntime: Float
|
|
||||||
|
|
||||||
userWarningCount: Int
|
|
||||||
|
|
||||||
activityScore: Int
|
|
||||||
}
|
|
@@ -4,8 +4,6 @@ type TechnicianConfig implements TableWithHistoryQuery {
|
|||||||
waitForRestart: Int
|
waitForRestart: Int
|
||||||
waitForShutdown: Int
|
waitForShutdown: Int
|
||||||
cacheMaxMessages: Int
|
cacheMaxMessages: Int
|
||||||
maxSteamOfferCount: Int
|
|
||||||
maintenance: Boolean
|
|
||||||
featureFlagCount: Int
|
featureFlagCount: Int
|
||||||
featureFlags: [FeatureFlag]
|
featureFlags: [FeatureFlag]
|
||||||
pingURLs: [String]
|
pingURLs: [String]
|
||||||
@@ -25,8 +23,6 @@ type TechnicianConfigHistory implements HistoryTableQuery {
|
|||||||
waitForRestart: Int
|
waitForRestart: Int
|
||||||
waitForShutdown: Int
|
waitForShutdown: Int
|
||||||
cacheMaxMessages: Int
|
cacheMaxMessages: Int
|
||||||
maxSteamOfferCount: Int
|
|
||||||
maintenance: Boolean
|
|
||||||
featureFlagCount: Int
|
featureFlagCount: Int
|
||||||
featureFlags: [FeatureFlag]
|
featureFlags: [FeatureFlag]
|
||||||
|
|
||||||
@@ -63,8 +59,6 @@ input TechnicianConfigInput {
|
|||||||
waitForRestart: Int
|
waitForRestart: Int
|
||||||
waitForShutdown: Int
|
waitForShutdown: Int
|
||||||
cacheMaxMessages: Int
|
cacheMaxMessages: Int
|
||||||
maxSteamOfferCount: Int
|
|
||||||
maintenance: Boolean
|
|
||||||
featureFlags: [FeatureFlagInput]
|
featureFlags: [FeatureFlagInput]
|
||||||
pingURLs: [String]
|
pingURLs: [String]
|
||||||
technicianIds: [String]
|
technicianIds: [String]
|
||||||
|
@@ -37,9 +37,6 @@ type UserHistory implements HistoryTableQuery {
|
|||||||
id: ID
|
id: ID
|
||||||
discordId: String
|
discordId: String
|
||||||
xp: Int
|
xp: Int
|
||||||
messageCount: Int
|
|
||||||
reactionCount: Int
|
|
||||||
birthday: String
|
|
||||||
|
|
||||||
server: ID
|
server: ID
|
||||||
|
|
||||||
|
@@ -57,7 +57,6 @@ from bot_graphql.queries.level_query import LevelQuery
|
|||||||
from bot_graphql.queries.server_config_query import ServerConfigQuery
|
from bot_graphql.queries.server_config_query import ServerConfigQuery
|
||||||
from bot_graphql.queries.server_history_query import ServerHistoryQuery
|
from bot_graphql.queries.server_history_query import ServerHistoryQuery
|
||||||
from bot_graphql.queries.server_query import ServerQuery
|
from bot_graphql.queries.server_query import ServerQuery
|
||||||
from bot_graphql.queries.server_statistic_query import ServerStatisticQuery
|
|
||||||
from bot_graphql.queries.short_role_name_history_query import ShortRoleNameHistoryQuery
|
from bot_graphql.queries.short_role_name_history_query import ShortRoleNameHistoryQuery
|
||||||
from bot_graphql.queries.short_role_name_query import ShortRoleNameQuery
|
from bot_graphql.queries.short_role_name_query import ShortRoleNameQuery
|
||||||
from bot_graphql.queries.technician_config_history_query import (
|
from bot_graphql.queries.technician_config_history_query import (
|
||||||
@@ -139,7 +138,6 @@ class GraphQLModule(ModuleABC):
|
|||||||
services.add_transient(QueryABC, ShortRoleNameQuery)
|
services.add_transient(QueryABC, ShortRoleNameQuery)
|
||||||
services.add_transient(QueryABC, UserWarningHistoryQuery)
|
services.add_transient(QueryABC, UserWarningHistoryQuery)
|
||||||
services.add_transient(QueryABC, UserWarningQuery)
|
services.add_transient(QueryABC, UserWarningQuery)
|
||||||
services.add_transient(QueryABC, ServerStatisticQuery)
|
|
||||||
|
|
||||||
services.add_transient(QueryABC, DiscordQuery)
|
services.add_transient(QueryABC, DiscordQuery)
|
||||||
services.add_transient(QueryABC, GuildQuery)
|
services.add_transient(QueryABC, GuildQuery)
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql.model"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
from bot_data.model.server import Server
|
|
||||||
|
|
||||||
|
|
||||||
class ServerStatistics:
|
|
||||||
def __init__(self, server: Server, kwargs: dict):
|
|
||||||
self.server = server
|
|
||||||
self.kwargs = kwargs
|
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql.mutations"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -41,9 +41,6 @@ class LevelMutation(QueryABC):
|
|||||||
int(input["permissions"]),
|
int(input["permissions"]),
|
||||||
server,
|
server,
|
||||||
)
|
)
|
||||||
levels = self._levels.get_levels_by_server_id(server.id)
|
|
||||||
if levels.where(lambda x: x.name == level.name).count() > 0:
|
|
||||||
raise ValueError(f"Level with name {level.name} already exists")
|
|
||||||
self._levels.add_level(level)
|
self._levels.add_level(level)
|
||||||
self._db.save_changes()
|
self._db.save_changes()
|
||||||
|
|
||||||
|
@@ -1,12 +1,9 @@
|
|||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.database.context import DatabaseContextABC
|
from cpl_core.database.context import DatabaseContextABC
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
from cpl_query.extension import List
|
from cpl_query.extension import List
|
||||||
|
|
||||||
from bot_api.logging.api_logger import ApiLogger
|
from bot_api.logging.api_logger import ApiLogger
|
||||||
from bot_api.route.route import Route
|
from bot_api.route.route import Route
|
||||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
|
||||||
from bot_core.environment_variables import MAINTENANCE
|
|
||||||
from bot_core.service.config_service import ConfigService
|
from bot_core.service.config_service import ConfigService
|
||||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||||
from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC
|
from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC
|
||||||
@@ -21,7 +18,6 @@ from bot_graphql.abc.query_abc import QueryABC
|
|||||||
class TechnicianConfigMutation(QueryABC):
|
class TechnicianConfigMutation(QueryABC):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: ConfigurationABC,
|
|
||||||
logger: ApiLogger,
|
logger: ApiLogger,
|
||||||
bot: DiscordBotServiceABC,
|
bot: DiscordBotServiceABC,
|
||||||
servers: ServerRepositoryABC,
|
servers: ServerRepositoryABC,
|
||||||
@@ -29,11 +25,9 @@ class TechnicianConfigMutation(QueryABC):
|
|||||||
db: DatabaseContextABC,
|
db: DatabaseContextABC,
|
||||||
config_service: ConfigService,
|
config_service: ConfigService,
|
||||||
tech_seeder: TechnicianConfigSeeder,
|
tech_seeder: TechnicianConfigSeeder,
|
||||||
client_utils: ClientUtilsABC,
|
|
||||||
):
|
):
|
||||||
QueryABC.__init__(self, "TechnicianConfigMutation")
|
QueryABC.__init__(self, "TechnicianConfigMutation")
|
||||||
|
|
||||||
self._config = config
|
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._bot = bot
|
self._bot = bot
|
||||||
self._servers = servers
|
self._servers = servers
|
||||||
@@ -41,7 +35,6 @@ class TechnicianConfigMutation(QueryABC):
|
|||||||
self._db = db
|
self._db = db
|
||||||
self._config_service = config_service
|
self._config_service = config_service
|
||||||
self._tech_seeder = tech_seeder
|
self._tech_seeder = tech_seeder
|
||||||
self._client_utils = client_utils
|
|
||||||
|
|
||||||
self.set_field("updateTechnicianConfig", self.resolve_update_technician_config)
|
self.set_field("updateTechnicianConfig", self.resolve_update_technician_config)
|
||||||
|
|
||||||
@@ -66,12 +59,6 @@ class TechnicianConfigMutation(QueryABC):
|
|||||||
technician_config.cache_max_messages = (
|
technician_config.cache_max_messages = (
|
||||||
input["cacheMaxMessages"] if "cacheMaxMessages" in input else technician_config.cache_max_messages
|
input["cacheMaxMessages"] if "cacheMaxMessages" in input else technician_config.cache_max_messages
|
||||||
)
|
)
|
||||||
technician_config.max_steam_offer_count = (
|
|
||||||
input["maxSteamOfferCount"] if "maxSteamOfferCount" in input else technician_config.max_steam_offer_count
|
|
||||||
)
|
|
||||||
technician_config.maintenance = (
|
|
||||||
input["maintenance"] if "maintenance" in input else technician_config.maintenance
|
|
||||||
)
|
|
||||||
old_feature_flags = technician_config.feature_flags
|
old_feature_flags = technician_config.feature_flags
|
||||||
technician_config.feature_flags = (
|
technician_config.feature_flags = (
|
||||||
dict(
|
dict(
|
||||||
@@ -104,10 +91,7 @@ class TechnicianConfigMutation(QueryABC):
|
|||||||
self._update_technician_ids(technician_config)
|
self._update_technician_ids(technician_config)
|
||||||
|
|
||||||
self._db.save_changes()
|
self._db.save_changes()
|
||||||
if technician_config.maintenance != self._config.get_configuration(MAINTENANCE):
|
self._config_service.reload_technician_config()
|
||||||
self._bot.loop.create_task(self._client_utils.set_maintenance_mode(technician_config.maintenance))
|
|
||||||
|
|
||||||
self._bot.loop.create_task(self._config_service.reload_technician_config())
|
|
||||||
return technician_config
|
return technician_config
|
||||||
|
|
||||||
def _update_ping_urls(self, new_config: TechnicianConfig):
|
def _update_ping_urls(self, new_config: TechnicianConfig):
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries.discord"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -25,7 +25,7 @@ class GuildQuery(QueryABC):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _resolve_channels(self, g: Guild, *_, filter=None):
|
def _resolve_channels(self, g: Guild, *_, filter=None):
|
||||||
channels = List(any).extend(g.channels).order_by(lambda x: x.position)
|
channels = List(any).extend(g.channels)
|
||||||
|
|
||||||
if filter is None:
|
if filter is None:
|
||||||
return channels
|
return channels
|
||||||
@@ -39,4 +39,4 @@ class GuildQuery(QueryABC):
|
|||||||
if "type" in filter:
|
if "type" in filter:
|
||||||
channels = channels.where(lambda c: type(c).__name__ == filter["type"])
|
channels = channels.where(lambda c: type(c).__name__ == filter["type"])
|
||||||
|
|
||||||
return channels
|
return channels.order_by(lambda x: x.position)
|
||||||
|
@@ -26,7 +26,6 @@ from bot_graphql.filter.client_filter import ClientFilter
|
|||||||
from bot_graphql.filter.level_filter import LevelFilter
|
from bot_graphql.filter.level_filter import LevelFilter
|
||||||
from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter
|
from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter
|
||||||
from bot_graphql.filter.user_filter import UserFilter
|
from bot_graphql.filter.user_filter import UserFilter
|
||||||
from bot_graphql.model.server_statistics import ServerStatistics
|
|
||||||
|
|
||||||
|
|
||||||
class ServerQuery(DataQueryWithHistoryABC):
|
class ServerQuery(DataQueryWithHistoryABC):
|
||||||
@@ -77,10 +76,6 @@ class ServerQuery(DataQueryWithHistoryABC):
|
|||||||
lambda server, *_: self._levels.get_levels_by_server_id(server.id),
|
lambda server, *_: self._levels.get_levels_by_server_id(server.id),
|
||||||
LevelFilter,
|
LevelFilter,
|
||||||
)
|
)
|
||||||
self.set_field(
|
|
||||||
"activeUserCount",
|
|
||||||
lambda server, *_: self._users.get_users_by_server_id(server.id).where(lambda x: not x.left_server).count(),
|
|
||||||
)
|
|
||||||
self.add_collection(
|
self.add_collection(
|
||||||
"user",
|
"user",
|
||||||
lambda server, *_: self._users.get_users_by_server_id(server.id),
|
lambda server, *_: self._users.get_users_by_server_id(server.id),
|
||||||
@@ -108,7 +103,6 @@ class ServerQuery(DataQueryWithHistoryABC):
|
|||||||
"hasFeatureFlag",
|
"hasFeatureFlag",
|
||||||
lambda server, *_, **kwargs: self._resolve_has_feature_flag(server, *_, **kwargs),
|
lambda server, *_, **kwargs: self._resolve_has_feature_flag(server, *_, **kwargs),
|
||||||
)
|
)
|
||||||
self.set_field("statistic", lambda server, *_, **kwargs: ServerStatistics(server, kwargs))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_id(server: Server, *_):
|
def resolve_id(server: Server, *_):
|
||||||
|
@@ -1,174 +0,0 @@
|
|||||||
import datetime
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from cpl_core.configuration import ConfigurationABC
|
|
||||||
from cpl_core.database.context import DatabaseContextABC
|
|
||||||
from cpl_core.type import R, T
|
|
||||||
|
|
||||||
from bot_data.abc.achievement_repository_abc import AchievementRepositoryABC
|
|
||||||
from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC
|
|
||||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
|
||||||
from bot_data.abc.user_message_count_per_hour_repository_abc import UserMessageCountPerHourRepositoryABC
|
|
||||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
|
||||||
from bot_data.abc.user_warnings_repository_abc import UserWarningsRepositoryABC
|
|
||||||
from bot_graphql.abc.query_abc import QueryABC
|
|
||||||
|
|
||||||
|
|
||||||
class ServerStatisticQuery(QueryABC):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
config: ConfigurationABC,
|
|
||||||
users: UserRepositoryABC,
|
|
||||||
user_joined_voice_channels: UserJoinedVoiceChannelRepositoryABC,
|
|
||||||
user_joined_game_servers: UserJoinedGameServerRepositoryABC,
|
|
||||||
user_messages: UserMessageCountPerHourRepositoryABC,
|
|
||||||
user_warnings: UserWarningsRepositoryABC,
|
|
||||||
achievements: AchievementRepositoryABC,
|
|
||||||
db: DatabaseContextABC,
|
|
||||||
):
|
|
||||||
QueryABC.__init__(self, "ServerStatistic")
|
|
||||||
|
|
||||||
self._config = config
|
|
||||||
self._db = db
|
|
||||||
|
|
||||||
self._users = users
|
|
||||||
self._user_joined_voice_channels = user_joined_voice_channels
|
|
||||||
self._user_joined_game_servers = user_joined_game_servers
|
|
||||||
self._user_messages = user_messages
|
|
||||||
self._user_warnings = user_warnings
|
|
||||||
self._achievements = achievements
|
|
||||||
|
|
||||||
self.set_field(
|
|
||||||
"achievementsAchieved",
|
|
||||||
self._resolve_achievements,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.set_field(
|
|
||||||
"messageCount",
|
|
||||||
self._resolve_message_count,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.set_field("userCount", lambda server, *_: self._users.get_users_by_server_id(server.server.id).count())
|
|
||||||
self.set_field("activeUserCount", self._resolve_active_user_count)
|
|
||||||
|
|
||||||
self.set_field("userJoinedVoiceChannelCount", self._resolve_voice_channel_count)
|
|
||||||
self.set_field("userJoinedVoiceChannelOntime", self._resolve_voice_channel_ontime)
|
|
||||||
|
|
||||||
self.set_field("userJoinedGameServerCount", self._resolve_game_server_count)
|
|
||||||
self.set_field("userJoinedGameServerOntime", self._resolve_game_server_ontime)
|
|
||||||
|
|
||||||
self.set_field("userWarningCount", self._resolve_user_warning_count)
|
|
||||||
|
|
||||||
self.set_field("activityScore", self._resolve_activity_score)
|
|
||||||
|
|
||||||
def _resolve_active_user_count(self, server, *_):
|
|
||||||
return self._users.get_users_by_server_id(server.server.id).where(lambda x: not x.left_server).count()
|
|
||||||
|
|
||||||
def _cast_query_result(self, query: str, r_type: T) -> Optional[R]:
|
|
||||||
results = self._db.select(query)
|
|
||||||
if len(results) == 0 or len(results[0]) == 0:
|
|
||||||
return None
|
|
||||||
result = results[0][0]
|
|
||||||
default = None
|
|
||||||
if r_type is int or r_type is float:
|
|
||||||
default = 0
|
|
||||||
elif r_type is str:
|
|
||||||
default = ""
|
|
||||||
|
|
||||||
return r_type(result) if result is not None else default
|
|
||||||
|
|
||||||
def _resolve_achievements(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT Count(UserGotAchievements.CreatedAt) FROM UserGotAchievements
|
|
||||||
INNER JOIN Achievements ON UserGotAchievements.AchievementId = Achievements.Id
|
|
||||||
INNER JOIN Users ON UserGotAchievements.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserGotAchievements.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, int)
|
|
||||||
|
|
||||||
def _resolve_message_count(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT SUM(
|
|
||||||
UserMessageCountPerHour.XPCount / (
|
|
||||||
SELECT XpPerMessage
|
|
||||||
FROM CFG_Server
|
|
||||||
WHERE ServerId = {server.server.id}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FROM UserMessageCountPerHour
|
|
||||||
INNER JOIN Users ON UserMessageCountPerHour.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserMessageCountPerHour.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, int)
|
|
||||||
|
|
||||||
def _resolve_voice_channel_count(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT Count(UserJoinedVoiceChannel.CreatedAt) FROM UserJoinedVoiceChannel
|
|
||||||
INNER JOIN Users ON UserJoinedVoiceChannel.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserJoinedVoiceChannel.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, int)
|
|
||||||
|
|
||||||
def _resolve_voice_channel_ontime(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT ROUND(SUM(TIME_TO_SEC(TIMEDIFF(UserJoinedVoiceChannel.LeavedOn, UserJoinedVoiceChannel.JoinedOn)) / 3600),{server.server.id}) FROM UserJoinedVoiceChannel
|
|
||||||
INNER JOIN Users ON UserJoinedVoiceChannel.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserJoinedVoiceChannel.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, float)
|
|
||||||
|
|
||||||
def _resolve_game_server_count(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT Count(UserJoinedGameServer.CreatedAt) FROM UserJoinedGameServer
|
|
||||||
INNER JOIN Users ON UserJoinedGameServer.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserJoinedGameServer.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, int)
|
|
||||||
|
|
||||||
def _resolve_game_server_ontime(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT ROUND(SUM(TIME_TO_SEC(TIMEDIFF(UserJoinedGameServer.LeavedOn, UserJoinedGameServer.JoinedOn)) / 3600),{server.server.id}) FROM UserJoinedGameServer
|
|
||||||
INNER JOIN Users ON UserJoinedGameServer.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserJoinedGameServer.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, float)
|
|
||||||
|
|
||||||
def _resolve_user_warning_count(self, server, *_):
|
|
||||||
query = f"""
|
|
||||||
SELECT COUNT(UserWarnings.CreatedAt) FROM UserWarnings
|
|
||||||
INNER JOIN Users ON UserWarnings.UserId = Users.UserId
|
|
||||||
WHERE Users.ServerId = {server.server.id}
|
|
||||||
AND UserWarnings.CreatedAt >= "{self._get_date(**server.kwargs)}";
|
|
||||||
"""
|
|
||||||
return self._cast_query_result(query, int)
|
|
||||||
|
|
||||||
def _resolve_activity_score(self, server, *_):
|
|
||||||
days = (datetime.date.today() - self._get_date(**server.kwargs)).days
|
|
||||||
return int(
|
|
||||||
(
|
|
||||||
(
|
|
||||||
self._resolve_achievements(server, *_)
|
|
||||||
+ self._resolve_message_count(server, *_)
|
|
||||||
+ self._resolve_voice_channel_count(server, *_)
|
|
||||||
+ self._resolve_voice_channel_ontime(server, *_)
|
|
||||||
+ self._resolve_game_server_count(server, *_)
|
|
||||||
+ self._resolve_game_server_ontime(server, *_)
|
|
||||||
- self._resolve_user_warning_count(server, *_)
|
|
||||||
)
|
|
||||||
/ self._resolve_active_user_count(server, *_)
|
|
||||||
)
|
|
||||||
/ days
|
|
||||||
* 1000
|
|
||||||
)
|
|
||||||
|
|
||||||
def _get_date(self, **kwargs) -> datetime.date:
|
|
||||||
if "date" not in kwargs:
|
|
||||||
return datetime.date.today() - datetime.timedelta(days=7)
|
|
||||||
|
|
||||||
return datetime.datetime.strptime(kwargs["date"], "%d.%m.%Y").date()
|
|
@@ -14,8 +14,6 @@ class TechnicianConfigHistoryQuery(HistoryQueryABC):
|
|||||||
self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart)
|
self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart)
|
||||||
self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown)
|
self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown)
|
||||||
self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages)
|
self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages)
|
||||||
self.set_field("maxSteamOfferCount", lambda config, *_: config.max_steam_offer_count)
|
|
||||||
self.set_field("maintenance", lambda config, *_: config.maintenance)
|
|
||||||
self.add_collection(
|
self.add_collection(
|
||||||
"featureFlag",
|
"featureFlag",
|
||||||
lambda config, *_: List(
|
lambda config, *_: List(
|
||||||
|
@@ -27,8 +27,6 @@ class TechnicianConfigQuery(DataQueryWithHistoryABC):
|
|||||||
self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart)
|
self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart)
|
||||||
self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown)
|
self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown)
|
||||||
self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages)
|
self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages)
|
||||||
self.set_field("maxSteamOfferCount", lambda config, *_: config.max_steam_offer_count)
|
|
||||||
self.set_field("maintenance", lambda config, *_: config.maintenance)
|
|
||||||
self.add_collection(
|
self.add_collection(
|
||||||
"featureFlag",
|
"featureFlag",
|
||||||
lambda config, *_: List(
|
lambda config, *_: List(
|
||||||
|
@@ -9,9 +9,6 @@ class UserHistoryQuery(HistoryQueryABC):
|
|||||||
self.set_field("id", self.resolve_id)
|
self.set_field("id", self.resolve_id)
|
||||||
self.set_field("discordId", self.resolve_discord_id)
|
self.set_field("discordId", self.resolve_discord_id)
|
||||||
self.set_field("xp", self.resolve_xp)
|
self.set_field("xp", self.resolve_xp)
|
||||||
self.set_field("messageCount", lambda x, *_: x.message_count)
|
|
||||||
self.set_field("reactionCount", lambda x, *_: x.reaction_count)
|
|
||||||
self.set_field("birthday", lambda x, *_: None if x.birthday is None else x.birthday.strftime("%d.%m.%Y"))
|
|
||||||
self.set_field("server", self.resolve_server)
|
self.set_field("server", self.resolve_server)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.achievements"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=1.2.1"
|
"cpl-core>=1.2.0"
|
||||||
],
|
],
|
||||||
"DevDependencies": [
|
"DevDependencies": [
|
||||||
"cpl-cli>=1.2.1"
|
"cpl-cli>=1.2.0"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {},
|
"PythonPath": {},
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.achievements.commands"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.achievements.events"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -35,7 +35,7 @@ class AchievementOnMessageEvent(OnMessageABC):
|
|||||||
self._servers = servers
|
self._servers = servers
|
||||||
self._users = users
|
self._users = users
|
||||||
|
|
||||||
@EventChecks.check_is_ready
|
@EventChecks.check_is_ready()
|
||||||
async def on_message(self, message: discord.Message):
|
async def on_message(self, message: discord.Message):
|
||||||
if message.guild is None:
|
if message.guild is None:
|
||||||
return
|
return
|
||||||
|
@@ -9,7 +9,6 @@ from cpl_discord.service import DiscordBotServiceABC
|
|||||||
|
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||||
from bot_core.helper.event_checks import EventChecks
|
|
||||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||||
from bot_data.model.server_config import ServerConfig
|
from bot_data.model.server_config import ServerConfig
|
||||||
@@ -37,7 +36,6 @@ class AchievementOnReactionAddEvent(OnReactionAddABC):
|
|||||||
self._servers = servers
|
self._servers = servers
|
||||||
self._users = users
|
self._users = users
|
||||||
|
|
||||||
@EventChecks.check_is_ready
|
|
||||||
async def on_reaction_add(
|
async def on_reaction_add(
|
||||||
self,
|
self,
|
||||||
reaction: discord.reaction.Reaction,
|
reaction: discord.reaction.Reaction,
|
||||||
|
@@ -9,7 +9,6 @@ from cpl_discord.service import DiscordBotServiceABC
|
|||||||
|
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||||
from bot_core.helper.event_checks import EventChecks
|
|
||||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||||
from bot_data.model.server_config import ServerConfig
|
from bot_data.model.server_config import ServerConfig
|
||||||
@@ -37,7 +36,6 @@ class AchievementOnReactionRemoveEvent(OnReactionRemoveABC):
|
|||||||
self._servers = servers
|
self._servers = servers
|
||||||
self._users = users
|
self._users = users
|
||||||
|
|
||||||
@EventChecks.check_is_ready
|
|
||||||
async def on_reaction_remove(
|
async def on_reaction_remove(
|
||||||
self,
|
self,
|
||||||
reaction: discord.reaction.Reaction,
|
reaction: discord.reaction.Reaction,
|
||||||
|
@@ -7,7 +7,6 @@ from cpl_discord.service import DiscordBotServiceABC
|
|||||||
|
|
||||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||||
from bot_core.helper.event_checks import EventChecks
|
|
||||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||||
from bot_data.model.server_config import ServerConfig
|
from bot_data.model.server_config import ServerConfig
|
||||||
@@ -35,7 +34,6 @@ class AchievementOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
|
|||||||
self._servers = servers
|
self._servers = servers
|
||||||
self._users = users
|
self._users = users
|
||||||
|
|
||||||
@EventChecks.check_is_ready
|
|
||||||
async def on_voice_state_update(
|
async def on_voice_state_update(
|
||||||
self,
|
self,
|
||||||
member: discord.member.Member,
|
member: discord.member.Member,
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.achievements.model"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports
|
# imports
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.auto_role"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "1",
|
"Major": "1",
|
||||||
"Minor": "2",
|
"Minor": "2",
|
||||||
"Micro": "1"
|
"Micro": "0"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.auto_role.command"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
@@ -15,7 +15,7 @@ __title__ = "modules.auto_role.events"
|
|||||||
__author__ = "Sven Heidemann"
|
__author__ = "Sven Heidemann"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.0"
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ from collections import namedtuple
|
|||||||
# imports:
|
# imports:
|
||||||
|
|
||||||
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
VersionInfo = namedtuple("VersionInfo", "major minor micro")
|
||||||
version_info = VersionInfo(major="1", minor="2", micro="1")
|
version_info = VersionInfo(major="1", minor="2", micro="0")
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user