Moved bot to kdb-bot #70
This commit is contained in:
26
kdb-bot/src/bot/__init__.py
Normal file
26
kdb-bot/src/bot/__init__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
bot Keksdose bot
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Discord bot for the Keksdose discord Server
|
||||
|
||||
:copyright: (c) 2022 sh-edraft.de
|
||||
:license: MIT, see LICENSE for more details.
|
||||
|
||||
"""
|
||||
|
||||
__title__ = 'bot'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
|
||||
__version__ = '0.2.3'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='0', minor='2', micro='3')
|
74
kdb-bot/src/bot/application.py
Normal file
74
kdb-bot/src/bot/application.py
Normal file
@@ -0,0 +1,74 @@
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.application import DiscordBotApplicationABC
|
||||
from cpl_discord.configuration import DiscordBotSettings
|
||||
from cpl_discord.service import DiscordBotServiceABC, DiscordBotService
|
||||
from cpl_translation import TranslatePipe, TranslationServiceABC, TranslationSettings
|
||||
|
||||
from bot_api.api_thread import ApiThread
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
|
||||
|
||||
class Application(DiscordBotApplicationABC):
|
||||
|
||||
def __init__(self, config: ConfigurationABC, services: ServiceProviderABC):
|
||||
DiscordBotApplicationABC.__init__(self, config, services)
|
||||
|
||||
self._services = services
|
||||
self._config = config
|
||||
|
||||
# cpl-core
|
||||
self._logger: LoggerABC = services.get_service(LoggerABC)
|
||||
# cpl-discord
|
||||
self._bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
|
||||
self._bot_settings: DiscordBotSettings = config.get_configuration(DiscordBotSettings)
|
||||
# cpl-translation
|
||||
self._translation: TranslationServiceABC = services.get_service(TranslationServiceABC)
|
||||
self._t: TranslatePipe = services.get_service(TranslatePipe)
|
||||
|
||||
self._feature_flags: FeatureFlagsSettings = config.get_configuration(FeatureFlagsSettings)
|
||||
|
||||
# api
|
||||
if self._feature_flags.get_flag(FeatureFlagsEnum.api_module):
|
||||
self._api: ApiThread = services.get_service(ApiThread)
|
||||
|
||||
self._is_stopping = False
|
||||
|
||||
async def configure(self):
|
||||
self._translation.load_by_settings(self._configuration.get_configuration(TranslationSettings))
|
||||
|
||||
async def main(self):
|
||||
try:
|
||||
self._logger.debug(__name__, f'Starting...')
|
||||
if self._feature_flags.get_flag(FeatureFlagsEnum.api_module):
|
||||
self._api.start()
|
||||
|
||||
if self._feature_flags.get_flag(FeatureFlagsEnum.api_only) and self._environment.environment_name == 'development':
|
||||
self._api.join()
|
||||
return
|
||||
|
||||
self._logger.trace(__name__, f'Try to start {DiscordBotService.__name__}')
|
||||
await self._bot.start_async()
|
||||
await self._bot.stop_async()
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'Start failed', e)
|
||||
|
||||
async def stop_async(self):
|
||||
if self._is_stopping:
|
||||
return
|
||||
|
||||
self._is_stopping = True
|
||||
try:
|
||||
self._logger.trace(__name__, f'Try to stop {DiscordBotService.__name__}')
|
||||
await self._bot.close()
|
||||
self._logger.trace(__name__, f'Stopped {DiscordBotService.__name__}')
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'stop failed', e)
|
||||
|
||||
Console.write_line()
|
||||
|
||||
def is_restart(self):
|
||||
return True if self._configuration.get_configuration('IS_RESTART') == 'true' else False #
|
24
kdb-bot/src/bot/bot
Normal file
24
kdb-bot/src/bot/bot
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
path="`dirname \"$0\"`" # relative
|
||||
path="`( cd \"$path\" && pwd)`" # absolutized and normalized
|
||||
|
||||
cd "$path/../"
|
||||
|
||||
if [[ $1 == "-dev" ]]; then
|
||||
export KDB_ENVIRONMENT=development
|
||||
export KDB_NAME=KDB-dev
|
||||
elif [[ $1 == "-stage" ]]; then
|
||||
export KDB_ENVIRONMENT=staging
|
||||
export KDB_NAME=KDB-test
|
||||
elif [[ $1 == "-prod" ]]; then
|
||||
export KDB_ENVIRONMENT=production
|
||||
export KDB_NAME=KDB
|
||||
else
|
||||
export KDB_ENVIRONMENT=production
|
||||
export KDB_NAME=KDB-prod
|
||||
fi
|
||||
|
||||
export PYTHONPATH=./:$PYTHONPATH
|
||||
|
||||
python3.10 bot/main.py
|
61
kdb-bot/src/bot/bot.json
Normal file
61
kdb-bot/src/bot/bot.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "bot",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "2",
|
||||
"Micro": "3"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
"Description": "Keksdose bot",
|
||||
"LongDescription": "Discord bot for the Keksdose discord Server",
|
||||
"URL": "https://www.sh-edraft.de",
|
||||
"CopyrightDate": "2022",
|
||||
"CopyrightName": "sh-edraft.de",
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core==2022.10.0.post6",
|
||||
"cpl-translation==2022.10.0.post1",
|
||||
"cpl-query==2022.10.0.post2",
|
||||
"cpl-discord==2022.10.0.post5"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli==2022.10.0"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "console",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "bot.main",
|
||||
"EntryPoint": "bot",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": [
|
||||
"../bot_api/bot-api.json",
|
||||
"../bot_core/bot-core.json",
|
||||
"../bot_data/bot-data.json",
|
||||
"../modules/base/base.json",
|
||||
"../modules/admin/admin.json",
|
||||
"../modules/auto_role/auto-role.json",
|
||||
"../modules/base/base.json",
|
||||
"../modules/boot_log/boot-log.json",
|
||||
"../modules/database/database.json",
|
||||
"../modules/moderator/moderator.json",
|
||||
"../modules/permission/permission.json"
|
||||
]
|
||||
}
|
||||
}
|
86
kdb-bot/src/bot/config/appsettings.PC-Nick.json
Normal file
86
kdb-bot/src/bot/config/appsettings.PC-Nick.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Command": {
|
||||
"Path": "logs/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
}
|
||||
},
|
||||
"DatabaseSettings": {
|
||||
"Host": "localhost",
|
||||
"User": "root",
|
||||
"Password": "MTAwNjE5OTdOaWNrLko=",
|
||||
"Database": "kd_kdb",
|
||||
"Charset": "utf8mb4",
|
||||
"UseUnicode": "true",
|
||||
"Buffered": "true",
|
||||
"AuthPlugin": "mysql_native_password"
|
||||
},
|
||||
"DiscordBot": {
|
||||
"Token": "MTAyOTgxMjE0Mjk4NTE5MTYxNA.G4ArAJ.sZh6pE-mwO2qDAr1mfHEoo7EwbJb-TZT8h6nGg",
|
||||
"Prefix": "!kn "
|
||||
},
|
||||
"Bot": {
|
||||
"910199451145076828": {
|
||||
"MessageDeleteTimer": 2
|
||||
},
|
||||
"Technicians": [
|
||||
240160344557879316
|
||||
],
|
||||
"WaitForRestart": 4,
|
||||
"WaitForShutdown": 4
|
||||
},
|
||||
"Base": {
|
||||
"910199451145076828": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
910199452915093593,
|
||||
910199452915093594
|
||||
],
|
||||
"AFKCommandChannelId": 910199452915093594,
|
||||
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
|
||||
}
|
||||
},
|
||||
"BootLog": {
|
||||
"910199451145076828": {
|
||||
"LoginMessageChannelId": "910199452915093588"
|
||||
}
|
||||
},
|
||||
"Permission": {
|
||||
"910199451145076828": {
|
||||
"AdminRoleIds": [
|
||||
925072155203477584
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
925072209884635167
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
83
kdb-bot/src/bot/config/appsettings.development.json
Normal file
83
kdb-bot/src/bot/config/appsettings.development.json
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "DEBUG"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Command": {
|
||||
"Path": "logs/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "DEBUG"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "DEBUG"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "DEBUG"
|
||||
}
|
||||
},
|
||||
"Translation": {
|
||||
"DefaultLanguage": "de",
|
||||
"Languages": [
|
||||
"de"
|
||||
]
|
||||
},
|
||||
"DiscordBot": {
|
||||
"Token": "OTk4MTU5NjczODkzMDYwNzM4.GN3QyA.yvWO6L7Eu36gXQ7ARDs0Jg2J1VqIDnHLou5lT4",
|
||||
"Prefix": "!kd "
|
||||
},
|
||||
"Bot": {
|
||||
"910199451145076828": {
|
||||
"MessageDeleteTimer": 6
|
||||
},
|
||||
"Technicians": [
|
||||
240160344557879316,
|
||||
236592458664902657
|
||||
],
|
||||
"WaitForRestart": 4,
|
||||
"WaitForShutdown": 4
|
||||
},
|
||||
"Base": {
|
||||
"910199451145076828": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
910199452915093593,
|
||||
910199452915093594
|
||||
],
|
||||
"AFKCommandChannelId": 910199452915093594,
|
||||
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
|
||||
}
|
||||
},
|
||||
"BootLog": {
|
||||
"910199451145076828": {
|
||||
"LoginMessageChannelId": "910199452915093588"
|
||||
}
|
||||
},
|
||||
"Permission": {
|
||||
"910199451145076828": {
|
||||
"AdminRoleIds": [
|
||||
925072155203477584
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
925072209884635167
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
92
kdb-bot/src/bot/config/appsettings.edrafts-lapi.json
Normal file
92
kdb-bot/src/bot/config/appsettings.edrafts-lapi.json
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Api": {
|
||||
"Path": "logs/",
|
||||
"Filename": "api.log",
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Command": {
|
||||
"Path": "logs/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
}
|
||||
},
|
||||
"DatabaseSettings": {
|
||||
"Host": "localhost",
|
||||
"User": "kd_kdb",
|
||||
"Password": "VGpZcihrb0N2T2MyZUlURQ==",
|
||||
"Database": "keksdose_bot_dev",
|
||||
"Charset": "utf8mb4",
|
||||
"UseUnicode": "true",
|
||||
"Buffered": "true",
|
||||
"AuthPlugin": "mysql_native_password"
|
||||
},
|
||||
"DiscordBot": {
|
||||
"Token": "OTk4MTYwNDI3Njg5MTgxMjM3.GI7h67.BqD6Lu1Tz0MuG8iktYrcLnHi1pNozyMiWFGTKI",
|
||||
"Prefix": "!ke "
|
||||
},
|
||||
"Bot": {
|
||||
"910199451145076828": {
|
||||
"MessageDeleteTimer": 2
|
||||
},
|
||||
"Technicians": [
|
||||
240160344557879316
|
||||
],
|
||||
"WaitForRestart": 4,
|
||||
"WaitForShutdown": 4
|
||||
},
|
||||
"Base": {
|
||||
"910199451145076828": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
910199452915093593,
|
||||
910199452915093594
|
||||
],
|
||||
"AFKCommandChannelId": 910199452915093594,
|
||||
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
|
||||
}
|
||||
},
|
||||
"BootLog": {
|
||||
"910199451145076828": {
|
||||
"LoginMessageChannelId": "910199452915093588"
|
||||
}
|
||||
},
|
||||
"Permission": {
|
||||
"910199451145076828": {
|
||||
"AdminRoleIds": [
|
||||
925072155203477584
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
925072209884635167
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
86
kdb-bot/src/bot/config/appsettings.edrafts-pc-ubuntu.json
Normal file
86
kdb-bot/src/bot/config/appsettings.edrafts-pc-ubuntu.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "TRACE",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Command": {
|
||||
"Path": "logs/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "DEBUG",
|
||||
"FileLogLevel": "TRACE"
|
||||
}
|
||||
},
|
||||
"DatabaseSettings": {
|
||||
"Host": "localhost",
|
||||
"User": "kd_kdb",
|
||||
"Password": "VGpZcihrb0N2T2MyZUlURQ==",
|
||||
"Database": "keksdose_bot_dev",
|
||||
"Charset": "utf8mb4",
|
||||
"UseUnicode": "true",
|
||||
"Buffered": "true",
|
||||
"AuthPlugin": "mysql_native_password"
|
||||
},
|
||||
"DiscordBot": {
|
||||
"Token": "OTk4MTYwNDI3Njg5MTgxMjM3.GI7h67.BqD6Lu1Tz0MuG8iktYrcLnHi1pNozyMiWFGTKI",
|
||||
"Prefix": "!ke "
|
||||
},
|
||||
"Bot": {
|
||||
"910199451145076828": {
|
||||
"MessageDeleteTimer": 2
|
||||
},
|
||||
"Technicians": [
|
||||
240160344557879316
|
||||
],
|
||||
"WaitForRestart": 4,
|
||||
"WaitForShutdown": 4
|
||||
},
|
||||
"Base": {
|
||||
"910199451145076828": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
910199452915093593,
|
||||
910199452915093594
|
||||
],
|
||||
"AFKCommandChannelId": 910199452915093594,
|
||||
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
|
||||
}
|
||||
},
|
||||
"BootLog": {
|
||||
"910199451145076828": {
|
||||
"LoginMessageChannelId": "910199452915093588"
|
||||
}
|
||||
},
|
||||
"Permission": {
|
||||
"910199451145076828": {
|
||||
"AdminRoleIds": [
|
||||
925072155203477584
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
925072209884635167
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
18
kdb-bot/src/bot/config/appsettings.example.json
Normal file
18
kdb-bot/src/bot/config/appsettings.example.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/",
|
||||
"Filename": "log_$start_time.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
},
|
||||
"DiscordBot": {
|
||||
"Token": "",
|
||||
"Prefix": "! "
|
||||
}
|
||||
}
|
34
kdb-bot/src/bot/config/appsettings.json
Normal file
34
kdb-bot/src/bot/config/appsettings.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Command": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "WARN"
|
||||
}
|
||||
}
|
||||
}
|
114
kdb-bot/src/bot/config/appsettings.production.json
Normal file
114
kdb-bot/src/bot/config/appsettings.production.json
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "INFO"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Command": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "INFO"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "INFO"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "ERROR",
|
||||
"FileLogLevel": "INFO"
|
||||
}
|
||||
},
|
||||
"Translation": {
|
||||
"DefaultLanguage": "de",
|
||||
"Languages": [
|
||||
"de"
|
||||
]
|
||||
},
|
||||
"DatabaseSettings": {
|
||||
"Host": "kdb_db_1",
|
||||
"User": "kd_kdb",
|
||||
"Password": "a2Rfa2Ri",
|
||||
"Database": "kd_kdb",
|
||||
"Port": "3306",
|
||||
"Charset": "utf8mb4",
|
||||
"UseUnicode": "true",
|
||||
"Buffered": "true",
|
||||
"AuthPlugin": "mysql_native_password"
|
||||
},
|
||||
"Bot": {
|
||||
"650366049023295514": {
|
||||
"MessageDeleteTimer": 2
|
||||
},
|
||||
"910199451145076828": {
|
||||
"MessageDeleteTimer": 2
|
||||
},
|
||||
"Technicians": [
|
||||
240160344557879316,
|
||||
236592458664902657
|
||||
],
|
||||
"WaitForRestart": 4,
|
||||
"WaitForShutdown": 4
|
||||
},
|
||||
"Base": {
|
||||
"650366049023295514": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
784530469290246145
|
||||
],
|
||||
"AFKCommandChannelId": 784530469290246145,
|
||||
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
|
||||
},
|
||||
"910199451145076828": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
910199452915093593,
|
||||
910199452915093594
|
||||
],
|
||||
"AFKCommandChannelId": 910199452915093594,
|
||||
"HelpCommandReferenceUrl": "https://docs.sh-edraft.de/kdb/"
|
||||
}
|
||||
},
|
||||
"BootLog": {
|
||||
"650366049023295514": {
|
||||
"LoginMessageChannelId": "998544927094997093"
|
||||
},
|
||||
"910199451145076828": {
|
||||
"LoginMessageChannelId": "910199452915093588"
|
||||
}
|
||||
},
|
||||
"Permission": {
|
||||
"650366049023295514": {
|
||||
"AdminRoleIds": [
|
||||
666129320481128479
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
998161580669804565
|
||||
]
|
||||
},
|
||||
"910199451145076828": {
|
||||
"AdminRoleIds": [
|
||||
925072155203477584
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
925072209884635167
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
90
kdb-bot/src/bot/config/appsettings.staging.json
Normal file
90
kdb-bot/src/bot/config/appsettings.staging.json
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"TimeFormatSettings": {
|
||||
"DateFormat": "%Y-%m-%d",
|
||||
"TimeFormat": "%H:%M:%S",
|
||||
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
|
||||
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
|
||||
},
|
||||
"LoggingSettings": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "bot.log",
|
||||
"ConsoleLogLevel": "INFO",
|
||||
"FileLogLevel": "DEBUG"
|
||||
},
|
||||
"BotLoggingSettings": {
|
||||
"Command": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "commands.log",
|
||||
"ConsoleLogLevel": "INFO",
|
||||
"FileLogLevel": "DEBUG"
|
||||
},
|
||||
"Database": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "database.log",
|
||||
"ConsoleLogLevel": "INFO",
|
||||
"FileLogLevel": "DEBUG"
|
||||
},
|
||||
"Message": {
|
||||
"Path": "logs/$date_now/",
|
||||
"Filename": "message.log",
|
||||
"ConsoleLogLevel": "INFO",
|
||||
"FileLogLevel": "DEBUG"
|
||||
}
|
||||
},
|
||||
"Translation": {
|
||||
"DefaultLanguage": "de",
|
||||
"Languages": [
|
||||
"de"
|
||||
]
|
||||
},
|
||||
"DatabaseSettings": {
|
||||
"Host": "kdb_db_2",
|
||||
"User": "kd_kdb",
|
||||
"Password": "a2Rfa2Ri",
|
||||
"Database": "kd_kdb",
|
||||
"Port": "3306",
|
||||
"Charset": "utf8mb4",
|
||||
"UseUnicode": "true",
|
||||
"Buffered": "true",
|
||||
"AuthPlugin": "mysql_native_password"
|
||||
},
|
||||
"Bot": {
|
||||
"910199451145076828": {
|
||||
"MessageDeleteTimer": 4
|
||||
},
|
||||
"Technicians": [
|
||||
240160344557879316,
|
||||
236592458664902657
|
||||
],
|
||||
"WaitForRestart": 4,
|
||||
"WaitForShutdown": 4
|
||||
},
|
||||
"Base": {
|
||||
"910199451145076828": {
|
||||
"MaxVoiceStateHours": 24,
|
||||
"XpPerMessage": 2,
|
||||
"XpPerOntimeHour": 4,
|
||||
"AFKChannelIds": [
|
||||
910199452915093593,
|
||||
910199452915093594
|
||||
],
|
||||
"AFKCommandChannelId": 910199452915093594,
|
||||
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
|
||||
}
|
||||
},
|
||||
"BootLog": {
|
||||
"910199451145076828": {
|
||||
"LoginMessageChannelId": "910199452915093588"
|
||||
}
|
||||
},
|
||||
"Permission": {
|
||||
"910199451145076828": {
|
||||
"AdminRoleIds": [
|
||||
925072155203477584
|
||||
],
|
||||
"ModeratorRoleIds": [
|
||||
925072209884635167
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
16
kdb-bot/src/bot/config/feature-flags.json
Normal file
16
kdb-bot/src/bot/config/feature-flags.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"FeatureFlags": {
|
||||
"ApiModule": true,
|
||||
"AdminModule": true,
|
||||
"AutoRoleModule": true,
|
||||
"BaseModule": true,
|
||||
"BootLogModule": true,
|
||||
"CoreModule": true,
|
||||
"CoreExtensionModule": true,
|
||||
"DatabaseModule": true,
|
||||
"ModeratorModule": true,
|
||||
"PermissionModule": true,
|
||||
"PresenceModule": true,
|
||||
"ApiOnly": true
|
||||
}
|
||||
}
|
72
kdb-bot/src/bot/main.py
Normal file
72
kdb-bot/src/bot/main.py
Normal file
@@ -0,0 +1,72 @@
|
||||
import asyncio
|
||||
import traceback
|
||||
from typing import Optional
|
||||
|
||||
from cpl_core.application import ApplicationBuilder
|
||||
from cpl_core.console import Console
|
||||
|
||||
from bot.application import Application
|
||||
from bot.startup import Startup
|
||||
from bot.startup_discord_extension import StartupDiscordExtension
|
||||
from bot.startup_migration_extension import StartupMigrationExtension
|
||||
from bot.startup_module_extension import StartupModuleExtension
|
||||
from bot.startup_settings_extension import StartupSettingsExtension
|
||||
from modules.boot_log.boot_log_extension import BootLogExtension
|
||||
from modules.database.database_extension import DatabaseExtension
|
||||
|
||||
|
||||
class Program:
|
||||
|
||||
def __init__(self):
|
||||
self.app: Optional[Application] = None
|
||||
|
||||
async def start(self):
|
||||
# discord extension has to be loaded before modules (modules depends on discord stuff)
|
||||
app_builder = ApplicationBuilder(Application) \
|
||||
.use_extension(StartupSettingsExtension) \
|
||||
.use_extension(StartupDiscordExtension) \
|
||||
.use_extension(StartupModuleExtension) \
|
||||
.use_extension(StartupMigrationExtension) \
|
||||
.use_extension(BootLogExtension) \
|
||||
.use_extension(DatabaseExtension) \
|
||||
.use_startup(Startup)
|
||||
self.app: Application = await app_builder.build_async()
|
||||
await self.app.run_async()
|
||||
|
||||
async def stop(self):
|
||||
if self.app is None:
|
||||
return
|
||||
await self.app.stop_async()
|
||||
|
||||
|
||||
def main():
|
||||
program = Program()
|
||||
try:
|
||||
asyncio.run(program.start())
|
||||
except KeyboardInterrupt:
|
||||
asyncio.run(program.stop())
|
||||
except Exception as e:
|
||||
Console.error(f'[ ERROR ] [ {__name__} ]: Cannot start the bot', f'{e} -> {traceback.format_exc()}')
|
||||
finally:
|
||||
try:
|
||||
asyncio.run(program.stop())
|
||||
except Exception as e:
|
||||
Console.error(f'[ ERROR ] [ {__name__} ]: Cannot stop the bot', f'{e} -> {traceback.format_exc()}')
|
||||
|
||||
if program.app is not None and program.app.is_restart():
|
||||
del program
|
||||
main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# ((
|
||||
# ( `)
|
||||
# ; / ,
|
||||
# / \/
|
||||
# / |
|
||||
# / ~/
|
||||
# / ) ) ~ edraft
|
||||
# ___// | /
|
||||
# `--' \_~-,
|
34
kdb-bot/src/bot/module_list.py
Normal file
34
kdb-bot/src/bot/module_list.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_api.api_module import ApiModule
|
||||
from bot_core.core_extension.core_extension_module import CoreExtensionModule
|
||||
from bot_core.core_module import CoreModule
|
||||
from bot_data.data_module import DataModule
|
||||
from modules.admin.admin_module import AdminModule
|
||||
from modules.auto_role.auto_role_module import AutoRoleModule
|
||||
from modules.base.base_module import BaseModule
|
||||
from modules.boot_log.boot_log_module import BootLogModule
|
||||
from modules.database.database_module import DatabaseModule
|
||||
from modules.moderator.moderator_module import ModeratorModule
|
||||
from modules.permission.permission_module import PermissionModule
|
||||
|
||||
|
||||
class ModuleList:
|
||||
|
||||
@staticmethod
|
||||
def get_modules():
|
||||
# core modules (modules out of modules folder) should be loaded first!
|
||||
return List(type, [
|
||||
CoreModule, # has to be first!
|
||||
DataModule,
|
||||
ApiModule,
|
||||
AdminModule,
|
||||
AutoRoleModule,
|
||||
BaseModule,
|
||||
DatabaseModule,
|
||||
ModeratorModule,
|
||||
PermissionModule,
|
||||
# has to be last!
|
||||
BootLogModule,
|
||||
CoreExtensionModule,
|
||||
])
|
60
kdb-bot/src/bot/startup.py
Normal file
60
kdb-bot/src/bot/startup.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from cpl_core.application import StartupABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.database import DatabaseSettings
|
||||
from cpl_core.dependency_injection import ServiceCollectionABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
from cpl_core.logging import LoggerABC
|
||||
|
||||
from bot_api.logging.api_logger import ApiLogger
|
||||
from bot_core.abc.custom_file_logger_abc import CustomFileLoggerABC
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from bot_core.logging.database_logger import DatabaseLogger
|
||||
from bot_core.logging.message_logger import MessageLogger
|
||||
from bot_data.db_context import DBContext
|
||||
|
||||
|
||||
class Startup(StartupABC):
|
||||
|
||||
def __init__(self):
|
||||
StartupABC.__init__(self)
|
||||
self._start_time = datetime.now()
|
||||
|
||||
self._config: Optional[ConfigurationABC] = None
|
||||
self._feature_flags: Optional[FeatureFlagsSettings] = None
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
|
||||
self._config = configuration
|
||||
self._feature_flags = configuration.get_configuration(FeatureFlagsSettings)
|
||||
return configuration
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||
services.add_logging()
|
||||
if self._feature_flags.get_flag(FeatureFlagsEnum.core_module):
|
||||
# custom logging
|
||||
services.add_singleton(CustomFileLoggerABC, CommandLogger)
|
||||
services.add_singleton(CustomFileLoggerABC, DatabaseLogger)
|
||||
services.add_singleton(CustomFileLoggerABC, MessageLogger)
|
||||
|
||||
if self._feature_flags.get_flag(FeatureFlagsEnum.api_module):
|
||||
services.add_singleton(CustomFileLoggerABC, ApiLogger)
|
||||
|
||||
services.add_translation()
|
||||
services.add_db_context(DBContext, self._config.get_configuration(DatabaseSettings))
|
||||
|
||||
provider = services.build_service_provider()
|
||||
# instantiate custom logger
|
||||
for c in CustomFileLoggerABC.__subclasses__():
|
||||
i: LoggerABC = provider.get_service(c)
|
||||
|
||||
|
||||
logger: LoggerABC = provider.get_service(LoggerABC)
|
||||
for flag in [f for f in FeatureFlagsEnum]:
|
||||
logger.debug(__name__, f'Loaded feature-flag: {flag} = {self._feature_flags.get_flag(flag)}')
|
||||
|
||||
return provider
|
18
kdb-bot/src/bot/startup_discord_extension.py
Normal file
18
kdb-bot/src/bot/startup_discord_extension.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from cpl_core.application import StartupExtensionABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from cpl_discord import get_discord_collection
|
||||
|
||||
|
||||
class StartupDiscordExtension(StartupExtensionABC):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
pass
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
services.add_discord()
|
||||
dcc = get_discord_collection(services)
|
25
kdb-bot/src/bot/startup_migration_extension.py
Normal file
25
kdb-bot/src/bot/startup_migration_extension.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from cpl_core.application import StartupExtensionABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
|
||||
from bot_data.abc.migration_abc import MigrationABC
|
||||
from bot_data.migration.api_migration import ApiMigration
|
||||
from bot_data.migration.auto_role_migration import AutoRoleMigration
|
||||
from bot_data.migration.initial_migration import InitialMigration
|
||||
from bot_data.service.migration_service import MigrationService
|
||||
|
||||
|
||||
class StartupMigrationExtension(StartupExtensionABC):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
pass
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
services.add_transient(MigrationService)
|
||||
services.add_transient(MigrationABC, InitialMigration)
|
||||
services.add_transient(MigrationABC, AutoRoleMigration) # 03.10.2022 #54 - 0.2.2
|
||||
services.add_transient(MigrationABC, ApiMigration) # 15.10.2022 #70 - 0.3.0
|
39
kdb-bot/src/bot/startup_module_extension.py
Normal file
39
kdb-bot/src/bot/startup_module_extension.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from typing import Optional
|
||||
|
||||
from cpl_core.application import StartupExtensionABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console, ForegroundColorEnum
|
||||
from cpl_core.dependency_injection import ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from cpl_discord.service.discord_collection_abc import DiscordCollectionABC
|
||||
|
||||
from bot.module_list import ModuleList
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
|
||||
|
||||
class StartupModuleExtension(StartupExtensionABC):
|
||||
|
||||
def __init__(self):
|
||||
self._config: Optional[ConfigurationABC] = None
|
||||
self._feature_flags: Optional[FeatureFlagsSettings] = None
|
||||
|
||||
self._modules = ModuleList.get_modules()
|
||||
|
||||
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC):
|
||||
self._config = config
|
||||
self._feature_flags = config.get_configuration(FeatureFlagsSettings)
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
provider = services.build_service_provider()
|
||||
dc_collection: DiscordCollectionABC = provider.get_service(DiscordCollectionABC)
|
||||
|
||||
for module_type in self._modules:
|
||||
module = module_type(dc_collection)
|
||||
if not self._feature_flags.get_flag(module.feature_flag):
|
||||
continue
|
||||
|
||||
Console.set_foreground_color(ForegroundColorEnum.green)
|
||||
Console.write_line(f'[{__name__}] Loaded module: {module_type}')
|
||||
Console.color_reset()
|
||||
module.configure_configuration(self._config, env)
|
||||
module.configure_services(services, env)
|
51
kdb-bot/src/bot/startup_settings_extension.py
Normal file
51
kdb-bot/src/bot/startup_settings_extension.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
from datetime import datetime
|
||||
from typing import Callable, Type, Optional
|
||||
|
||||
from cpl_core.application import StartupExtensionABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceCollectionABC
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
|
||||
from bot_core.configuration.bot_logging_settings import BotLoggingSettings
|
||||
from bot_core.configuration.bot_settings import BotSettings
|
||||
from modules.base.configuration.base_settings import BaseSettings
|
||||
from modules.boot_log.configuration.boot_log_settings import BootLogSettings
|
||||
from modules.permission.configuration.permission_settings import PermissionSettings
|
||||
|
||||
|
||||
class StartupSettingsExtension(StartupExtensionABC):
|
||||
|
||||
def __init__(self):
|
||||
self._start_time = datetime.now()
|
||||
|
||||
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironmentABC):
|
||||
# this shit has to be done here because we need settings in subsequent startup extensions
|
||||
environment.set_working_directory(os.path.dirname(os.path.realpath(__file__)))
|
||||
configuration.add_environment_variables('KDB_')
|
||||
configuration.add_environment_variables('DISCORD_')
|
||||
|
||||
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.host_name}.json', optional=True)
|
||||
# load feature-flags
|
||||
configuration.add_json_file(f'config/feature-flags.json', optional=False)
|
||||
|
||||
configuration.add_configuration('Startup_StartTime', str(self._start_time))
|
||||
self._configure_settings_with_sub_settings(configuration, BotSettings, lambda x: x.servers, lambda x: x.id)
|
||||
self._configure_settings_with_sub_settings(configuration, BaseSettings, lambda x: x.servers, lambda x: x.id)
|
||||
self._configure_settings_with_sub_settings(configuration, BootLogSettings, lambda x: x.servers, lambda x: x.id)
|
||||
self._configure_settings_with_sub_settings(configuration, PermissionSettings, lambda x: x.servers, lambda x: x.id)
|
||||
self._configure_settings_with_sub_settings(configuration, BotLoggingSettings, lambda x: x.files, lambda x: x.key)
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _configure_settings_with_sub_settings(config: ConfigurationABC, settings: Type, list_atr: Callable, atr: Callable):
|
||||
settings: Optional[settings] = config.get_configuration(settings)
|
||||
if settings is None:
|
||||
return
|
||||
|
||||
for sub_settings in list_atr(settings):
|
||||
config.add_configuration(f'{type(sub_settings).__name__}_{atr(sub_settings)}', sub_settings)
|
174
kdb-bot/src/bot/translation/de.json
Normal file
174
kdb-bot/src/bot/translation/de.json
Normal file
@@ -0,0 +1,174 @@
|
||||
{
|
||||
"common": {
|
||||
"hello_world": "Hallo Welt",
|
||||
"bot_has_no_permission_message": "Ey!!!\nWas soll das?\nIch habe keine Berechtigungen :(\nScheiß System...",
|
||||
"no_permission_message": "Nein!\nIch höre nicht auf dich ¯\\_(ツ)_/¯",
|
||||
"not_implemented_yet": "Ey Alter, das kann ich noch nicht...",
|
||||
"presence": {
|
||||
"booting": "{} Ich fahre gerade hoch...",
|
||||
"running": "{} Behalte Ruhe und iss Kekse :D",
|
||||
"restart": "{} Muss neue Kekse holen...",
|
||||
"shutdown": "{} Ich werde bestimmt wieder kommen..."
|
||||
},
|
||||
"errors": {
|
||||
"error": "Es gab einen Fehler. Meld dich bitte bei einem Admin.",
|
||||
"command_error": "Es gab einen Fehler beim bearbeiten des Befehls. Meld dich bitte bei einem Admin.",
|
||||
"missing_required_argument": "Fehler: Ein benötigter Parameter fehlt!",
|
||||
"argument_parsing_error": "Fehler: Parameter konnte nicht gelesen werden!",
|
||||
"unexpected_quote_error": "Fehler: Unerwarteter Zitat Fehler!",
|
||||
"invalid_end_of_quoted_string_error": "Fehler: Ungültiges Zitatende!",
|
||||
"expected_closing_quote_error": "Fehler: Erwarte Zitatende!",
|
||||
"bad_argument": "Fehler: Ungültiger Parameter!",
|
||||
"bad_union_argument": "Fehler: Ungültiger Union Parameter!",
|
||||
"private_message_only": "Fehler: Nur private Nachrichten sind erlaubt!",
|
||||
"no_private_message": "Fehler: Private Nachrichten sind nicht erlaubt!",
|
||||
"check_failure": "Fehler: Du hast nicht die benötigte Berechtigung!",
|
||||
"check_any_failure": "Fehler: Alle checks sind Fehlgeschlagen!",
|
||||
"command_not_found": "Fehler: Befehl konnte nicht gefunden werden!",
|
||||
"disabled_command": "Fehler: Befehl wurde deaktiviert!",
|
||||
"command_invoke_error": "Fehler: Befehl konnte nicht aufgerufen werden!",
|
||||
"too_many_arguments": "Fehler: Zu viele Parameter!",
|
||||
"user_input_error": "Fehler: Eingabefehler!",
|
||||
"command_on_cooldown": "Fehler: Befehl befindet sich im cooldown!",
|
||||
"max_concurrency_reached": "Fehler: Maximale Parallelität erreicht!",
|
||||
"not_owner": "Fehler: Du bist nicht mein besitzer!",
|
||||
"missing_permissions": "Fehler: Berechtigungen fehlen!",
|
||||
"bot_missing_permissions": "Fehler: Mir fehlen Berechtigungen!",
|
||||
"missing_role": "Fehler: Benötigte Rolle fehlt!",
|
||||
"bot_missing_role": "Fehler: Mir fehlt eine benötigte Rolle!",
|
||||
"missing_any_role": "Fehler: Alle benötigten Rollen fehlen!",
|
||||
"bot_missing_any_role": "Fehler: Mir fehlen alle benötigten Rollen!",
|
||||
"nsfw_channel_required": "Fehler: NSFW Kanal benötigt!",
|
||||
"extension_error": "Fehler: Erweiterungsfehler!",
|
||||
"extension_already_loaded": "Fehler: Erweiterung wurde bereits geladen!",
|
||||
"extension_not_loaded": "Fehler: Erweiterung wurde nicht geladen!",
|
||||
"no_entry_point_error": "Fehler: Kein Eintrittspunkt!",
|
||||
"extension_failed": "Fehler: Erweiterung ist fehlgeschlagen!",
|
||||
"bot_not_ready_yet": "Ey Alter! Gedulde dich doch mal! ..."
|
||||
}
|
||||
},
|
||||
"modules": {
|
||||
"admin": {
|
||||
"restart_message": "Bin gleich wieder da :D",
|
||||
"shutdown_message": "Trauert nicht um mich, es war eine logische Entscheidung. Das Wohl von Vielen, es wiegt schwerer als das Wohl von Wenigen oder eines Einzelnen. Ich war es und ich werde es immer sein, Euer Freund. Lebt lange und in Frieden :)",
|
||||
"deploy_message": "Der neue Stand wurde hochgeladen."
|
||||
},
|
||||
"auto_role": {
|
||||
"list": {
|
||||
"title": "Beobachtete Nachrichten:",
|
||||
"description": "Von auto-role beobachtete Nachrichten:",
|
||||
"auto_role_id": "auto-role Id",
|
||||
"message_id": "Nachricht-Id"
|
||||
},
|
||||
"add": {
|
||||
"success": "auto-role für die Nachricht {} wurde hinzugefügt :D",
|
||||
"error": {
|
||||
"not_found": "Nachricht {} in {} nicht gefunden!",
|
||||
"already_exists": "auto-role für die Nachricht {} existiert bereits!"
|
||||
}
|
||||
},
|
||||
"remove": {
|
||||
"success": "auto-role {} wurde entfernt :D",
|
||||
"error": {
|
||||
"not_found": "auto-role {} nicht gefunden!"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"nothing_found": "Keine auto-role Einträge gefunden."
|
||||
},
|
||||
"rule": {
|
||||
"list": {
|
||||
"title": "auto-role Regeln:",
|
||||
"description": "Von auto-role angewendete Regeln:",
|
||||
"auto_role_rule_id": "auto-role Regel Id",
|
||||
"emoji": "Emoji",
|
||||
"role": "Rolle"
|
||||
},
|
||||
"add": {
|
||||
"success": "Regel {} -> {} für auto-role {} wurde hinzugefügt :D",
|
||||
"error": {
|
||||
"not_found": "Regel für auto-role {} nicht gefunden!",
|
||||
"emoji_not_found": "Emoji {} für auto-role Regel {} nicht gefunden!",
|
||||
"rule_not_found": "Rolle {} für auto-role Regel {} nicht gefunden!",
|
||||
"already_exists": "Regel für auto-role {} existiert bereits!"
|
||||
}
|
||||
},
|
||||
"remove": {
|
||||
"success": "Regel für auto-role {} wurde entfernt :D",
|
||||
"error": {
|
||||
"not_found": "Regel für auto-role {} nicht gefunden!"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"id_not_found": "Kein auto-role Eintrag mit der Id gefunden!"
|
||||
}
|
||||
}
|
||||
},
|
||||
"moderator": {
|
||||
"purge_message": "Na gut..., ich lösche alle Nachrichten wenns sein muss."
|
||||
},
|
||||
"base": {
|
||||
"technician_error_message": "Es gab ein Fehler mit dem Event: {}\nDatum und Zeit: {}\nSchau bitte ins log für Details.UUID: {}",
|
||||
"technician_command_error_message": "Es gab ein Fehler mit dem Befehl: {} ausgelöst von {} -> {}\nDatum und Zeit: {}\nSchau bitte ins log für Details.UUID: {}",
|
||||
"welcome_message": "Hello There!\nIch heiße dich bei {} herzlichst willkommen!",
|
||||
"welcome_message_for_team": "{} hat gerade das Irrenhaus betreten.",
|
||||
"goodbye_message": "Schade das du uns so schnell verlässt :(",
|
||||
"afk_command_channel_missing_message": "Zu unfähig einem Sprachkanal beizutreten?",
|
||||
"afk_command_move_message": "Ich verschiebe dich ja schon... (◔_◔)",
|
||||
"pong": "Pong",
|
||||
"info": {
|
||||
"title": "Gismo",
|
||||
"description": "Informationen über mich",
|
||||
"fields": {
|
||||
"version": "Version",
|
||||
"ontime": "Ontime",
|
||||
"sent_message_count": "Gesendete Nachrichten",
|
||||
"received_message_count": "Empfangene Nachrichten",
|
||||
"deleted_message_count": "Gelöschte Nachrichten",
|
||||
"received_command_count": "Empfangene Befehle",
|
||||
"moved_users_count": "Verschobene Benutzer",
|
||||
"modules": "Module"
|
||||
},
|
||||
"footer": ""
|
||||
},
|
||||
"user_info": {
|
||||
"fields": {
|
||||
"id": "Id",
|
||||
"name": "Name",
|
||||
"discord_join": "Discord beigetreten am",
|
||||
"last_join": "Server beigetreten am",
|
||||
"xp": "XP",
|
||||
"roles": "Rollen",
|
||||
"joins": "Beitritte",
|
||||
"lefts": "Abgänge",
|
||||
"warnings": "Verwarnungen"
|
||||
},
|
||||
"footer": ""
|
||||
}
|
||||
},
|
||||
"boot_log": {
|
||||
"login_message": "Ich bin on the line :D\nDer Scheiß hat {} Sekunden gedauert"
|
||||
},
|
||||
"database": {},
|
||||
"permission": {
|
||||
}
|
||||
},
|
||||
"api": {
|
||||
"api": {
|
||||
"test_mail": {
|
||||
"subject": "Krümmelmonster Web Interface Test-Mail",
|
||||
"message": "Dies ist eine Test-Mail vom Krümmelmonster Web Interface\nGesendet von {}-{}"
|
||||
}
|
||||
},
|
||||
"auth": {
|
||||
"confirmation": {
|
||||
"subject": "E-Mail für {} {} bestätigen",
|
||||
"message": "Öffne den Link um die E-Mail zu bestätigen:\n{}auth/register/{}"
|
||||
},
|
||||
"forgot_password": {
|
||||
"subject": "Passwort für {} {} zurücksetzen",
|
||||
"message": "Öffne den Link um das Passwort zu ändern:\n{}auth/forgot-password/{}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user