1.1.7 - #376 #375 #374 #377

Merged
edraft merged 24 commits from 1.1.7 into support 2023-09-28 18:12:58 +02:00
166 changed files with 2675 additions and 719 deletions

View File

@ -16,6 +16,7 @@
"level": "src/modules/level/level.json",
"permission": "src/modules/permission/permission.json",
"technician": "src/modules/technician/technician.json",
"short-role-name": "src/modules/_short_role_name/modules/short-role-name.json",
"checks": "tools/checks/checks.json",
"get-version": "tools/get_version/get-version.json",
"post-build": "tools/post_build/post-build.json",

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -4,12 +4,12 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
"Description": "Keksdose bot",
"LongDescription": "Discord bot for the Keksdose discord Server",
"Description": "sh-edraft.de Discord bot",
"LongDescription": "Discord bot for customers of sh-edraft.de",
"URL": "https://www.sh-edraft.de",
"CopyrightDate": "2022 - 2023",
"CopyrightName": "sh-edraft.de",
@ -68,6 +68,7 @@
"../modules/database/database.json",
"../modules/level/level.json",
"../modules/permission/permission.json",
"../modules/short_role_name/short-role-name.json",
"../modules/technician/technician.json"
]
}

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot.extension"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -13,6 +13,7 @@ from modules.config.config_module import ConfigModule
from modules.database.database_module import DatabaseModule
from modules.level.level_module import LevelModule
from modules.permission.permission_module import PermissionModule
from modules.short_role_name.short_role_name_module import ShortRoleNameModule
from modules.technician.technician_module import TechnicianModule
@ -35,6 +36,7 @@ class ModuleList:
ApiModule,
TechnicianModule,
AchievementsModule,
ShortRoleNameModule,
# has to be last!
BootLogModule,
CoreExtensionModule,

View File

@ -13,9 +13,11 @@ from bot_data.migration.config_feature_flags_migration import ConfigFeatureFlags
from bot_data.migration.config_migration import ConfigMigration
from bot_data.migration.db_history_migration import DBHistoryMigration
from bot_data.migration.default_role_migration import DefaultRoleMigration
from bot_data.migration.fix_updates_migration import FixUpdatesMigration
from bot_data.migration.initial_migration import InitialMigration
from bot_data.migration.level_migration import LevelMigration
from bot_data.migration.remove_stats_migration import RemoveStatsMigration
from bot_data.migration.short_role_name_migration import ShortRoleNameMigration
from bot_data.migration.stats_migration import StatsMigration
from bot_data.migration.user_joined_game_server_migration import UserJoinedGameServerMigration
from bot_data.migration.user_message_count_per_hour_migration import (
@ -50,3 +52,5 @@ class StartupMigrationExtension(StartupExtensionABC):
services.add_transient(MigrationABC, ConfigMigration) # 19.07.2023 #127 - 1.1.0
services.add_transient(MigrationABC, ConfigFeatureFlagsMigration) # 15.08.2023 #334 - 1.1.0
services.add_transient(MigrationABC, DefaultRoleMigration) # 24.09.2023 #360 - 1.1.3
services.add_transient(MigrationABC, ShortRoleNameMigration) # 28.09.2023 #378 - 1.1.7
services.add_transient(MigrationABC, FixUpdatesMigration) # 28.09.2023 #378 - 1.1.7

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "",
"AuthorEmail": "",

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.configuration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.controller"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.event"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.exception"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.filter"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.filter.discord"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.logging"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.model.discord"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.route"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_api.transformer"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.configuration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -16,9 +16,11 @@ class FeatureFlagsEnum(Enum):
level_module = "LevelModule"
moderator_module = "ModeratorModule"
permission_module = "PermissionModule"
short_role_name_module = "ShortRoleNameModule"
# features
api_only = "ApiOnly"
presence = "Presence"
version_in_presence = "VersionInPresence"
game_server = "GameServer"
sync_xp = "SyncXp"
short_role_name = "ShortRoleName"

View File

@ -18,12 +18,14 @@ class FeatureFlagsSettings(ConfigurationModelABC):
FeatureFlagsEnum.moderator_module.value: False, # 02.10.2022 #48
FeatureFlagsEnum.permission_module.value: True, # 02.10.2022 #48
FeatureFlagsEnum.config_module.value: True, # 19.07.2023 #127
FeatureFlagsEnum.short_role_name_module.value: True, # 28.09.2023 #378
# features
FeatureFlagsEnum.api_only.value: False, # 13.10.2022 #70
FeatureFlagsEnum.presence.value: True, # 03.10.2022 #56
FeatureFlagsEnum.version_in_presence.value: False, # 21.03.2023 #253
FeatureFlagsEnum.game_server.value: False, # 25.09.2023 #366
FeatureFlagsEnum.sync_xp.value: False, # 25.09.2023 #366
FeatureFlagsEnum.short_role_name.value: False, # 28.09.2023 #378
}
def __init__(self, **kwargs: dict):

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.core_extension"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.exception"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.helper"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.logging"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.pipes"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_core.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -24,7 +24,6 @@ from bot_data.model.server_config import ServerConfig
from bot_data.model.user import User
from bot_data.model.user_joined_server import UserJoinedServer
from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel
from bot_data.service.seeder_service import SeederService
from bot_data.service.user_repository_service import ServerRepositoryABC
from modules.achievements.achievement_service import AchievementService
@ -34,7 +33,6 @@ class DataIntegrityService:
self,
config: ConfigurationABC,
logger: DatabaseLogger,
seeder: SeederService,
bot: DiscordBotServiceABC,
db_context: DatabaseContextABC,
server_repo: ServerRepositoryABC,
@ -51,7 +49,6 @@ class DataIntegrityService:
self._config = config
self._logger = logger
self._seeder = seeder
self._bot = bot
self._db_context = db_context
self._servers = server_repo

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_data"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_data.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,13 +1,20 @@
import os
from abc import ABC, abstractmethod
from cpl_core.dependency_injection import ServiceProviderABC
from mysql.connector.cursor import MySQLCursorBuffered
from bot_data.db_context import DBContext
class MigrationABC(ABC):
name = None
prio = 0
@abstractmethod
def __init__(self):
pass
@ServiceProviderABC.inject
def __init__(self, db: DBContext):
self._cursor: MySQLCursorBuffered = db.cursor
@abstractmethod
def upgrade(self):
@ -16,3 +23,10 @@ class MigrationABC(ABC):
@abstractmethod
def downgrade(self):
pass
def _exec(self, self_file: str, file: str):
path = f"{os.path.dirname(os.path.realpath(self_file))}/db_history_scripts"
sql = open(f"{path}/{file}").read()
for statement in sql.split("\n\n"):
self._cursor.execute(statement + ";")

View File

@ -0,0 +1,39 @@
from abc import ABC, abstractmethod
from cpl_query.extension import List
from bot_data.model.short_role_name import ShortRoleName
class ShortRoleNameRepositoryABC(ABC):
@abstractmethod
def __init__(self):
pass
@abstractmethod
def get_short_role_names(self) -> List[ShortRoleName]:
pass
@abstractmethod
def get_short_role_name_by_id(self, id: int) -> ShortRoleName:
pass
@abstractmethod
def find_short_role_names_by_role_id(self, role_id: int) -> List[ShortRoleName]:
pass
@abstractmethod
def get_short_role_names_by_server_id(self, id: int) -> List[ShortRoleName]:
pass
@abstractmethod
def add_short_role_name(self, short_role_name: ShortRoleName):
pass
@abstractmethod
def update_short_role_name(self, short_role_name: ShortRoleName):
pass
@abstractmethod
def delete_short_role_name(self, short_role_name: ShortRoleName):
pass

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",

View File

@ -16,6 +16,7 @@ from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.level_repository_abc import LevelRepositoryABC
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC
from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC
from bot_data.abc.user_game_ident_repository_abc import UserGameIdentRepositoryABC
from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC
@ -41,6 +42,7 @@ from bot_data.service.seeder_service import SeederService
from bot_data.service.server_config_repository_service import ServerConfigRepositoryService
from bot_data.service.server_config_seeder import ServerConfigSeeder
from bot_data.service.server_repository_service import ServerRepositoryService
from bot_data.service.short_role_name_repository_service import ShortRoleNameRepositoryService
from bot_data.service.technician_config_repository_service import TechnicianConfigRepositoryService
from bot_data.service.technician_config_seeder import TechnicianConfigSeeder
from bot_data.service.user_game_ident_repository_service import UserGameIdentRepositoryService
@ -89,6 +91,7 @@ class DataModule(ModuleABC):
services.add_transient(AchievementRepositoryABC, AchievementRepositoryService)
services.add_transient(TechnicianConfigRepositoryABC, TechnicianConfigRepositoryService)
services.add_transient(ServerConfigRepositoryABC, ServerConfigRepositoryService)
services.add_transient(ShortRoleNameRepositoryABC, ShortRoleNameRepositoryService)
services.add_transient(SeederService)
services.add_transient(DataSeederABC, TechnicianConfigSeeder)

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_data.migration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,5 +1,3 @@
import os
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
@ -12,26 +10,18 @@ class ConfigMigration(MigrationABC):
MigrationABC.__init__(self)
self._logger = logger
self._db = db
self._cursor = db.cursor
def _exec(self, file: str):
path = f"{os.path.dirname(os.path.realpath(__file__))}/db_history_scripts"
sql = open(f"{path}/{file}").read()
for statement in sql.split("\n\n"):
self._cursor.execute(statement + ";")
def upgrade(self):
self._logger.debug(__name__, "Running upgrade")
self._server_upgrade()
self._technician_upgrade()
self._exec("config/server.sql")
self._exec("config/server_afk_channels.sql")
self._exec("config/server_team_roles.sql")
self._exec("config/technician.sql")
self._exec("config/technician_ids.sql")
self._exec("config/technician_ping_urls.sql")
self._exec(__file__, "config/server.sql")
self._exec(__file__, "config/server_afk_channels.sql")
self._exec(__file__, "config/server_team_roles.sql")
self._exec(__file__, "config/technician.sql")
self._exec(__file__, "config/technician_ids.sql")
self._exec(__file__, "config/technician_ping_urls.sql")
def _server_upgrade(self):
self._cursor.execute(

View File

@ -1,5 +1,3 @@
import os
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
@ -15,33 +13,26 @@ class DBHistoryMigration(MigrationABC):
self._db = db
self._cursor = db.cursor
def _exec(self, file: str):
path = f"{os.path.dirname(os.path.realpath(__file__))}/db_history_scripts"
sql = open(f"{path}/{file}").read()
for statement in sql.split("\n\n"):
self._cursor.execute(statement + ";")
def upgrade(self):
self._logger.debug(__name__, "Running upgrade")
self._exec("api_keys.sql")
self._exec("auth_users.sql")
self._exec("auth_user_users_relation.sql")
self._exec("auto_role_rules.sql")
self._exec("auto_roles.sql")
self._exec("clients.sql")
self._exec("game_servers.sql")
self._exec("known_users.sql")
self._exec("levels.sql")
self._exec("servers.sql")
self._exec("user_game_idents.sql")
self._exec("user_joined_game_servers.sql")
self._exec("user_joined_servers.sql")
self._exec("user_joined_voice_channel.sql")
self._exec("user_message_count_per_hour.sql")
self._exec("users.sql")
self._exec("user_warnings.sql")
self._exec(__file__, "api_keys.sql")
self._exec(__file__, "auth_users.sql")
self._exec(__file__, "auth_user_users_relation.sql")
self._exec(__file__, "auto_role_rules.sql")
self._exec(__file__, "auto_roles.sql")
self._exec(__file__, "clients.sql")
self._exec(__file__, "game_servers.sql")
self._exec(__file__, "known_users.sql")
self._exec(__file__, "levels.sql")
self._exec(__file__, "servers.sql")
self._exec(__file__, "user_game_idents.sql")
self._exec(__file__, "user_joined_game_servers.sql")
self._exec(__file__, "user_joined_servers.sql")
self._exec(__file__, "user_joined_voice_channel.sql")
self._exec(__file__, "user_message_count_per_hour.sql")
self._exec(__file__, "users.sql")
self._exec(__file__, "user_warnings.sql")
self._logger.debug(__name__, "Finished history upgrade")

View File

@ -1,23 +1,25 @@
CREATE TABLE IF NOT EXISTS `CFG_ServerHistory`
(
`Id` BIGINT(20) NOT NULL,
`MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6,
`NotificationChatId` BIGINT NOT NULL,
`MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6,
`XpPerMessage` BIGINT NOT NULL DEFAULT 1,
`XpPerReaction` BIGINT NOT NULL DEFAULT 1,
`MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20,
`XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10,
`XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10,
`XpPerAchievement` BIGINT NOT NULL DEFAULT 10,
`AFKCommandChannelId` BIGINT NOT NULL,
`HelpVoiceChannelId` BIGINT NOT NULL,
`TeamChannelId` BIGINT NOT NULL,
`LoginMessageChannelId` BIGINT NOT NULL,
`ServerId` BIGINT NOT NULL,
`Deleted` BOOL DEFAULT FALSE,
`DateFrom` DATETIME(6) NOT NULL,
`DateTo` DATETIME(6) NOT NULL
`Id` BIGINT(20) NOT NULL,
`MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6,
`NotificationChatId` BIGINT NOT NULL,
`MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6,
`XpPerMessage` BIGINT NOT NULL DEFAULT 1,
`XpPerReaction` BIGINT NOT NULL DEFAULT 1,
`MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20,
`XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10,
`XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10,
`XpPerAchievement` BIGINT NOT NULL DEFAULT 10,
`AFKCommandChannelId` BIGINT NOT NULL,
`HelpVoiceChannelId` BIGINT NOT NULL,
`TeamChannelId` BIGINT NOT NULL,
`LoginMessageChannelId` BIGINT NOT NULL,
`DefaultRoleId` BIGINT NULL,
`FeatureFlags` JSON NULL DEFAULT ('{}'),
`ServerId` BIGINT NOT NULL,
`Deleted` BOOL DEFAULT FALSE,
`DateFrom` DATETIME(6) NOT NULL,
`DateTo` DATETIME(6) NOT NULL
);
DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;
@ -27,44 +29,44 @@ CREATE TRIGGER `TR_CFG_ServerUpdate`
ON `CFG_Server`
FOR EACH ROW
BEGIN
INSERT INTO `CFG_ServerHistory` (
`Id`,
`MessageDeleteTimer`,
`NotificationChatId`,
`MaxVoiceStateHours`,
`XpPerMessage`,
`XpPerReaction`,
`MaxMessageXpPerHour`,
`XpPerOntimeHour`,
`XpPerEventParticipation`,
`XpPerAchievement`,
`AFKCommandChannelId`,
`HelpVoiceChannelId`,
`TeamChannelId`,
`LoginMessageChannelId`,
`ServerId`,
`DateFrom`,
`DateTo`
)
VALUES (
OLD.Id,
OLD.MessageDeleteTimer,
OLD.NotificationChatId,
OLD.MaxVoiceStateHours,
OLD.XpPerMessage,
OLD.XpPerReaction,
OLD.MaxMessageXpPerHour,
OLD.XpPerOntimeHour,
OLD.XpPerEventParticipation,
OLD.XpPerAchievement,
OLD.AFKCommandChannelId,
OLD.HelpVoiceChannelId,
OLD.TeamChannelId,
OLD.LoginMessageChannelId,
OLD.ServerId,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6)
);
INSERT INTO `CFG_ServerHistory` (`Id`,
`MessageDeleteTimer`,
`NotificationChatId`,
`MaxVoiceStateHours`,
`XpPerMessage`,
`XpPerReaction`,
`MaxMessageXpPerHour`,
`XpPerOntimeHour`,
`XpPerEventParticipation`,
`XpPerAchievement`,
`AFKCommandChannelId`,
`HelpVoiceChannelId`,
`TeamChannelId`,
`LoginMessageChannelId`,
`DefaultRoleId`,
`FeatureFlags`,
`ServerId`,
`DateFrom`,
`DateTo`)
VALUES (OLD.Id,
OLD.MessageDeleteTimer,
OLD.NotificationChatId,
OLD.MaxVoiceStateHours,
OLD.XpPerMessage,
OLD.XpPerReaction,
OLD.MaxMessageXpPerHour,
OLD.XpPerOntimeHour,
OLD.XpPerEventParticipation,
OLD.XpPerAchievement,
OLD.AFKCommandChannelId,
OLD.HelpVoiceChannelId,
OLD.TeamChannelId,
OLD.LoginMessageChannelId,
OLD.DefaultRoleId,
OLD.FeatureFlags,
OLD.ServerId,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6));
END;
DROP TRIGGER IF EXISTS `TR_CFG_ServerDelete`;
@ -74,44 +76,44 @@ CREATE TRIGGER `TR_CFG_ServerDelete`
ON `CFG_Server`
FOR EACH ROW
BEGIN
INSERT INTO `CFG_ServerHistory` (
`Id`,
`MessageDeleteTimer`,
`NotificationChatId`,
`MaxVoiceStateHours`,
`XpPerMessage`,
`XpPerReaction`,
`MaxMessageXpPerHour`,
`XpPerOntimeHour`,
`XpPerEventParticipation`,
`XpPerAchievement`,
`AFKCommandChannelId`,
`HelpVoiceChannelId`,
`TeamChannelId`,
`LoginMessageChannelId`,
`ServerId`,
`Deleted`,
`DateFrom`,
`DateTo`
)
VALUES (
OLD.Id,
OLD.MessageDeleteTimer,
OLD.NotificationChatId,
OLD.MaxVoiceStateHours,
OLD.XpPerMessage,
OLD.XpPerReaction,
OLD.MaxMessageXpPerHour,
OLD.XpPerOntimeHour,
OLD.XpPerEventParticipation,
OLD.XpPerAchievement,
OLD.AFKCommandChannelId,
OLD.HelpVoiceChannelId,
OLD.TeamChannelId,
OLD.LoginMessageChannelId,
OLD.ServerId,
TRUE,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6)
);
INSERT INTO `CFG_ServerHistory` (`Id`,
`MessageDeleteTimer`,
`NotificationChatId`,
`MaxVoiceStateHours`,
`XpPerMessage`,
`XpPerReaction`,
`MaxMessageXpPerHour`,
`XpPerOntimeHour`,
`XpPerEventParticipation`,
`XpPerAchievement`,
`AFKCommandChannelId`,
`HelpVoiceChannelId`,
`TeamChannelId`,
`LoginMessageChannelId`,
`DefaultRoleId`,
`ServerId`,
`FeatureFlags`,
`Deleted`,
`DateFrom`,
`DateTo`)
VALUES (OLD.Id,
OLD.MessageDeleteTimer,
OLD.NotificationChatId,
OLD.MaxVoiceStateHours,
OLD.XpPerMessage,
OLD.XpPerReaction,
OLD.MaxMessageXpPerHour,
OLD.XpPerOntimeHour,
OLD.XpPerEventParticipation,
OLD.XpPerAchievement,
OLD.AFKCommandChannelId,
OLD.HelpVoiceChannelId,
OLD.TeamChannelId,
OLD.LoginMessageChannelId,
OLD.DefaultRoleId,
OLD.FeatureFlags,
OLD.ServerId,
TRUE,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6));
END;

View File

@ -1,13 +1,14 @@
CREATE TABLE IF NOT EXISTS `CFG_TechnicianHistory`
(
`Id` BIGINT(20) NOT NULL,
`Id` BIGINT(20) NOT NULL,
`HelpCommandReferenceUrl` VARCHAR(255) NOT NULL,
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
`Deleted` BOOL DEFAULT FALSE,
`DateFrom` DATETIME(6) NOT NULL,
`DateTo` DATETIME(6) NOT NULL
`WaitForRestart` BIGINT NOT NULL DEFAULT 8,
`WaitForShutdown` BIGINT NOT NULL DEFAULT 8,
`CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000,
`FeatureFlags` JSON NULL DEFAULT ('{}'),
`Deleted` BOOL DEFAULT FALSE,
`DateFrom` DATETIME(6) NOT NULL,
`DateTo` DATETIME(6) NOT NULL
);
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;
@ -17,24 +18,22 @@ CREATE TRIGGER `TR_CFG_TechnicianUpdate`
ON `CFG_Technician`
FOR EACH ROW
BEGIN
INSERT INTO `CFG_TechnicianHistory` (
`Id`,
`HelpCommandReferenceUrl`,
`WaitForRestart`,
`WaitForShutdown`,
`CacheMaxMessages`,
`DateFrom`,
`DateTo`
)
VALUES (
OLD.Id,
OLD.HelpCommandReferenceUrl,
OLD.WaitForRestart,
OLD.WaitForShutdown,
OLD.CacheMaxMessages,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6)
);
INSERT INTO `CFG_TechnicianHistory` (`Id`,
`HelpCommandReferenceUrl`,
`WaitForRestart`,
`WaitForShutdown`,
`CacheMaxMessages`,
`FeatureFlags`,
`DateFrom`,
`DateTo`)
VALUES (OLD.Id,
OLD.HelpCommandReferenceUrl,
OLD.WaitForRestart,
OLD.WaitForShutdown,
OLD.CacheMaxMessages,
OLD.FeatureFlags,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6));
END;
DROP TRIGGER IF EXISTS `TR_CFG_TechnicianDelete`;
@ -44,24 +43,22 @@ CREATE TRIGGER `TR_CFG_TechnicianDelete`
ON `CFG_Technician`
FOR EACH ROW
BEGIN
INSERT INTO `CFG_TechnicianHistory` (
`Id`,
`HelpCommandReferenceUrl`,
`WaitForRestart`,
`WaitForShutdown`,
`CacheMaxMessages`,
`Deleted`,
`DateFrom`,
`DateTo`
)
VALUES (
OLD.Id,
OLD.HelpCommandReferenceUrl,
OLD.WaitForRestart,
OLD.WaitForShutdown,
OLD.CacheMaxMessages,
TRUE,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6)
);
INSERT INTO `CFG_TechnicianHistory` (`Id`,
`HelpCommandReferenceUrl`,
`WaitForRestart`,
`WaitForShutdown`,
`CacheMaxMessages`,
`FeatureFlags`,
`Deleted`,
`DateFrom`,
`DateTo`)
VALUES (OLD.Id,
OLD.HelpCommandReferenceUrl,
OLD.WaitForRestart,
OLD.WaitForShutdown,
OLD.CacheMaxMessages,
OLD.FeatureFlags,
TRUE,
OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6));
END;

View File

@ -0,0 +1,38 @@
CREATE TABLE IF NOT EXISTS `ShortRoleNamesHistory`
(
`Id` BIGINT(20) NOT NULL,
`ShortName` VARCHAR(64) DEFAULT NULL,
`DiscordRoleId` BIGINT(20) NOT NULL,
`Position` ENUM ('Before', 'After') NOT NULL,
`ServerId` BIGINT(20) DEFAULT NULL,
`Deleted` BOOL DEFAULT FALSE,
`DateFrom` DATETIME(6) NOT NULL,
`DateTo` DATETIME(6) NOT NULL
);
DROP TRIGGER IF EXISTS `TR_ShortRoleNamesUpdate`;
CREATE TRIGGER `TR_ShortRoleNamesUpdate`
AFTER UPDATE
ON `ShortRoleNames`
FOR EACH ROW
BEGIN
INSERT INTO `ShortRoleNamesHistory` (`Id`, `ShortName`, `DiscordRoleId`, `Position`, `ServerId`, `DateFrom`,
`DateTo`)
VALUES (OLD.Id, OLD.ShortName, OLD.DiscordRoleId, OLD.Position, OLD.ServerId, OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6));
END;
DROP TRIGGER IF EXISTS `TR_ShortRoleNamesDelete`;
CREATE TRIGGER `TR_ShortRoleNamesDelete`
AFTER DELETE
ON `ShortRoleNames`
FOR EACH ROW
BEGIN
INSERT INTO `ShortRoleNamesHistory` (`Id`, `ShortName`, `DiscordRoleId`, `Position`, `ServerId`, `Deleted`,
`DateFrom`,
`DateTo`)
VALUES (OLD.Id, OLD.ShortName, OLD.DiscordRoleId, OLD.Position, OLD.ServerId, TRUE, OLD.LastModifiedAt,
CURRENT_TIMESTAMP(6));
END;

View File

@ -0,0 +1,51 @@
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
class FixUpdatesMigration(MigrationABC):
name = "1.1.7_FixUpdatesMigration"
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_ServerHistory
ADD DefaultRoleId BIGINT NULL AFTER LoginMessageChannelId;
"""
)
)
self._cursor.execute(
str(
"""ALTER TABLE CFG_TechnicianHistory ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;"""
)
)
self._cursor.execute(
str(
"""ALTER TABLE CFG_ServerHistory ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;"""
)
)
self._exec(__file__, "config/server.sql")
self._exec(__file__, "config/technician.sql")
def downgrade(self):
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_ServerHistory DROP COLUMN DefaultRoleId;
"""
)
)
self._cursor.execute("ALTER TABLE CFG_TechnicianHistory DROP COLUMN FeatureFlags;")
self._cursor.execute("ALTER TABLE CFG_ServerHistory DROP COLUMN FeatureFlags;")

View File

@ -0,0 +1,40 @@
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
class ShortRoleNameMigration(MigrationABC):
name = "1.1.7_ShortRoleNameMigration"
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"""
CREATE TABLE IF NOT EXISTS `ShortRoleNames` (
`Id` BIGINT NOT NULL AUTO_INCREMENT,
`ShortName` VARCHAR(255) NOT NULL,
`DiscordRoleId` BIGINT NOT NULL,
`Position` ENUM('before', 'after') NOT NULL,
`ServerId` BIGINT,
`CreatedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
`LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
PRIMARY KEY(`Id`),
FOREIGN KEY (`ServerId`) REFERENCES `Servers`(`ServerId`)
);
"""
)
)
self._exec(__file__, "short_rule_names.sql")
def downgrade(self):
self._cursor.execute("DROP TABLE `ShortRoleNames`;")
self._cursor.execute("DROP TABLE `ShortRoleNamesHistory`;")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_data.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,9 +1,11 @@
import json
from datetime import datetime
from typing import Optional
from cpl_core.configuration import ConfigurationModelABC
from cpl_core.database import TableABC
from cpl_query.extension import List
from discord import Guild
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_data.model.server import Server
@ -26,7 +28,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
help_voice_channel_id: int,
team_channel_id: int,
login_message_channel_id: int,
default_role_id: int,
default_role_id: Optional[int],
feature_flags: dict[FeatureFlagsEnum],
server: Server,
afk_channel_ids: List[int],
@ -59,6 +61,29 @@ class ServerConfig(TableABC, ConfigurationModelABC):
self._created_at = created_at if created_at is not None else self._created_at
self._modified_at = modified_at if modified_at is not None else self._modified_at
@staticmethod
def new(guild: Guild, server: Server) -> "ServerConfig":
return ServerConfig(
6,
guild.system_channel.id,
6,
1,
1,
20,
10,
10,
10,
guild.system_channel.id,
guild.system_channel.id,
guild.system_channel.id,
guild.system_channel.id,
None,
{},
server,
List(int),
List(int),
)
@property
def id(self) -> int:
return self._id
@ -264,7 +289,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{self._help_voice_channel_id},
{self._team_channel_id},
{self._login_message_channel_id},
{self._default_role_id},
{"NULL" if self._default_role_id is None else self._default_role_id},
'{json.dumps(self._feature_flags)}',
{self._server.id}
);
@ -289,7 +314,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`HelpVoiceChannelId` = {self._help_voice_channel_id},
`TeamChannelId` = {self._team_channel_id},
`LoginMessageChannelId` = {self._login_message_channel_id},
`DefaultRoleId` = {self._default_role_id},
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id}
WHERE `Id` = {self._id};

View File

@ -0,0 +1,140 @@
from datetime import datetime
from cpl_core.database import TableABC
from cpl_core.dependency_injection import ServiceProviderABC
from cpl_discord.service import DiscordBotServiceABC
from bot_data.model.server import Server
from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum
class ShortRoleName(TableABC):
def __init__(
self,
short_name: str,
discord_role_id: int,
position: ShortRoleNamePositionEnum,
server: Server,
created_at: datetime = None,
modified_at: datetime = None,
id=0,
):
self._id = id
self._short_name = short_name
self._discord_role_id = discord_role_id
self._position = position
self._server = server
TableABC.__init__(self)
self._created_at = created_at if created_at is not None else self._created_at
self._modified_at = modified_at if modified_at is not None else self._modified_at
@property
def id(self) -> int:
return self._id
@property
def short_name(self) -> str:
return self._short_name
@short_name.setter
def short_name(self, value: str):
self._short_name = value
@property
def role_id(self) -> int:
return self._discord_role_id
@role_id.setter
def role_id(self, value: int):
self._discord_role_id = value
@property
@ServiceProviderABC.inject
def role_name(self, bot: DiscordBotServiceABC) -> str:
guild = bot.get_guild(self._server.discord_id)
return guild.get_role(self.role_id).name
@property
def position(self) -> ShortRoleNamePositionEnum:
return self._position
@position.setter
def position(self, value: ShortRoleNamePositionEnum):
self._position = value
@property
def server(self) -> Server:
return self._server
@staticmethod
def get_select_all_string() -> str:
return str(
f"""
SELECT * FROM `ShortRoleNames`;
"""
)
@staticmethod
def get_select_by_id_string(id: int) -> str:
return str(
f"""
SELECT * FROM `ShortRoleNames`
WHERE `Id` = {id};
"""
)
@staticmethod
def get_select_by_role_id_string(id: int) -> str:
return str(
f"""
SELECT * FROM `ShortRoleNames`
WHERE `DiscordRoleId` = {id};
"""
)
@staticmethod
def get_select_by_server_id_string(id: int) -> str:
return str(
f"""
SELECT * FROM `ShortRoleNames`
WHERE `ServerId` = {id};
"""
)
@property
def insert_string(self) -> str:
return str(
f"""
INSERT INTO `ShortRoleNames` (
`ShortName`, `DiscordRoleId`, `Position`, `ServerId`
) VALUES (
'{self._short_name}',
{self._discord_role_id},
'{self._position}',
{self._server.id}
);
"""
)
@property
def udpate_string(self) -> str:
return str(
f"""
UPDATE `ShortRoleNames`
SET `ShortName` = '{self._short_name}',
`DiscordRoleId` = {self._discord_role_id},
`Position` = '{self._position}',
`ServerId` = {self._server.id}
WHERE `Id` = {self._id};
"""
)
@property
def delete_string(self) -> str:
return str(
f"""
DELETE FROM `ShortRoleNames`
WHERE `Id` = {self._id};
"""
)

View File

@ -0,0 +1,56 @@
from cpl_core.dependency_injection import ServiceProviderABC
from cpl_discord.service import DiscordBotServiceABC
from bot_data.abc.history_table_abc import HistoryTableABC
class ShortRoleNameHistory(HistoryTableABC):
def __init__(
self,
name: str,
discord_role_id: int,
server: int,
deleted: bool,
date_from: str,
date_to: str,
id=0,
):
HistoryTableABC.__init__(self)
self._id = id
self._name = name
self._discord_role_id = discord_role_id
self._server = server
self._deleted = deleted
self._date_from = date_from
self._date_to = date_to
@property
def id(self) -> int:
return self._id
@property
def name(self) -> str:
return self._name
@name.setter
def name(self, value: str):
self._name = value
@property
def role_id(self) -> int:
return self._discord_role_id
@role_id.setter
def role_id(self, value: int):
self._discord_role_id = value
@property
@ServiceProviderABC.inject
def role_name(self, bot: DiscordBotServiceABC) -> str:
guild = bot.get_guild(self._server.discord_id)
return guild.get_role(self.role_id).name
@property
def server(self) -> int:
return self._server

View File

@ -0,0 +1,6 @@
from enum import Enum
class ShortRoleNamePositionEnum(Enum):
before = "before"
after = "after"

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_data.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -34,30 +34,12 @@ class ServerConfigSeeder(DataSeederABC):
if self._server_config.does_server_config_exists(server.id):
continue
config = ServerConfig(
6,
guild.system_channel.id,
6,
1,
1,
20,
10,
10,
10,
guild.system_channel.id,
guild.system_channel.id,
guild.system_channel.id,
guild.system_channel.id,
{},
server,
[],
[],
)
config = ServerConfig.new(guild, server)
self._server_config.add_server_config(config)
self._db.save_changes()
self._logger.debug(__name__, "Seeded technician config")
self._logger.debug(__name__, "Seeded server config")
except Exception as e:
self._logger.error(__name__, f"Seeding technician config failed", e)
self._logger.error(__name__, f"Seeding server config failed", e)

View File

@ -0,0 +1,95 @@
from typing import Optional
from cpl_core.database.context import DatabaseContextABC
from cpl_query.extension import List
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC
from bot_data.model.short_role_name import ShortRoleName
from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum
class ShortRoleNameRepositoryService(ShortRoleNameRepositoryABC):
def __init__(
self,
logger: DatabaseLogger,
db_context: DatabaseContextABC,
servers: ServerRepositoryABC,
):
self._logger = logger
self._context = db_context
self._servers = servers
ShortRoleNameRepositoryABC.__init__(self)
@staticmethod
def _get_value_from_result(value: any) -> Optional[any]:
if isinstance(value, str) and "NULL" in value:
return None
return value
def _short_role_name_from_result(self, sql_result: tuple) -> ShortRoleName:
return ShortRoleName(
self._get_value_from_result(sql_result[1]), # name
int(self._get_value_from_result(sql_result[2])), # role_id
ShortRoleNamePositionEnum(self._get_value_from_result(sql_result[3])), # position
self._servers.get_server_by_id(sql_result[4]), # server
self._get_value_from_result(sql_result[5]), # created_at
self._get_value_from_result(sql_result[6]), # modified_at
id=self._get_value_from_result(sql_result[0]), # id
)
def get_short_role_names(self) -> List[ShortRoleName]:
short_role_names = List(ShortRoleName)
self._logger.trace(__name__, f"Send SQL command: {ShortRoleName.get_select_all_string()}")
results = self._context.select(ShortRoleName.get_select_all_string())
for result in results:
self._logger.trace(__name__, f"Get short_role_name with id {result[0]}")
short_role_names.append(self._short_role_name_from_result(result))
return short_role_names
def get_short_role_name_by_id(self, id: int) -> ShortRoleName:
self._logger.trace(__name__, f"Send SQL command: {ShortRoleName.get_select_by_id_string(id)}")
result = self._context.select(ShortRoleName.get_select_by_id_string(id))[0]
return self._short_role_name_from_result(result)
def find_short_role_names_by_role_id(self, role_id: int) -> List[ShortRoleName]:
short_role_names = List(ShortRoleName)
self._logger.trace(__name__, f"Send SQL command: {ShortRoleName.get_select_by_role_id_string(role_id)}")
results = self._context.select(ShortRoleName.get_select_by_role_id_string(role_id))
for result in results:
self._logger.trace(__name__, f"Get short_role_name with id {result[0]}")
short_role_names.append(self._short_role_name_from_result(result))
return short_role_names
def get_short_role_names_by_server_id(self, server_id: int) -> List[ShortRoleName]:
short_role_names = List(ShortRoleName)
self._logger.trace(
__name__,
f"Send SQL command: {ShortRoleName.get_select_by_server_id_string(server_id)}",
)
results = self._context.select(ShortRoleName.get_select_by_server_id_string(server_id))
for result in results:
self._logger.trace(__name__, f"Get short_role_name with id {result[0]}")
short_role_names.append(self._short_role_name_from_result(result))
return short_role_names
def add_short_role_name(self, short_role_name: ShortRoleName):
self._logger.trace(__name__, f"Send SQL command: {short_role_name.insert_string}")
self._context.cursor.execute(short_role_name.insert_string)
def update_short_role_name(self, short_role_name: ShortRoleName):
self._logger.trace(__name__, f"Send SQL command: {short_role_name.udpate_string}")
self._context.cursor.execute(short_role_name.udpate_string)
def delete_short_role_name(self, short_role_name: ShortRoleName):
self._logger.trace(__name__, f"Send SQL command: {short_role_name.delete_string}")
self._context.cursor.execute(short_role_name.delete_string)

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -20,6 +20,7 @@ from bot_data.model.known_user import KnownUser
from bot_data.model.level import Level
from bot_data.model.server import Server
from bot_data.model.server_config import ServerConfig
from bot_data.model.short_role_name import ShortRoleName
from bot_data.model.user import User
from bot_data.model.user_joined_game_server import UserJoinedGameServer
from bot_data.model.user_joined_server import UserJoinedServer
@ -184,6 +185,16 @@ class QueryABC(ObjectType):
access = True
break
elif type(element) == ShortRoleName:
element: ShortRoleName = element
for u in user.users:
u: User = u
guild = bot.get_guild(u.server.discord_id)
member = guild.get_member(u.discord_id)
if permissions.is_member_moderator(member) and u.server.id == element.server.id:
access = True
break
elif type(element) == dict and "key" in element and element["key"] in [e.value for e in FeatureFlagsEnum]:
for u in user.users:
u: User = u

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql.filter"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -0,0 +1,70 @@
from cpl_discord.service import DiscordBotServiceABC
from cpl_query.extension import List
from bot_data.model.short_role_name import ShortRoleName
from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum
from bot_data.model.user import User
from bot_graphql.abc.filter_abc import FilterABC
class ShortRoleNameFilter(FilterABC):
def __init__(self, bot: DiscordBotServiceABC):
FilterABC.__init__(self)
self._bot = bot
self._id = None
self._short_name = None
self._role_id = None
self._role_name = None
self._position = None
self._server = None
def from_dict(self, values: dict):
if "id" in values:
self._id = int(values["id"])
if "shortName" in values:
self._short_name = values["shortName"]
if "roleId" in values:
self._role_id = int(values["roleId"])
if "roleName" in values:
self._role_name = values["roleName"]
if "position" in values:
self._position = ShortRoleNamePositionEnum(values["position"])
if "server" in values:
from bot_graphql.filter.server_filter import ServerFilter
self._server: ServerFilter = self._services.get_service(ServerFilter)
self._server.from_dict(values["server"])
def filter(self, query: List[User]) -> List[User]:
if self._id is not None:
query = query.where(lambda x: x.id == self._id)
if self._short_name is not None:
query = query.where(lambda x: x.short_name == self._short_name or self._short_name in x.short_name)
if self._role_id is not None:
query = query.where(lambda x: x.role_id == self._role_id)
if self._role_name is not None and self._role_id is not None:
def get_role_name(x: ShortRoleName):
guild = self._bot.get_guild(x.server.discord_id)
name = guild.get_role(x.role_id).name
return name == self._role_name or self._role_name in name
query = query.where(get_role_name)
if self._position is not None:
query = query.where(lambda x: x.position.value == self._position.value)
if self._server is not None:
servers = self._server.filter(query.select(lambda x: x.server)).select(lambda x: x.id)
query = query.where(lambda x: x.server.id in servers)
return query

View File

@ -5,6 +5,7 @@ type Mutation {
user: UserMutation
userJoinedGameServer: UserJoinedGameServerMutation
achievement: AchievementMutation
shortRoleName: ShortRoleNameMutation
technicianConfig: TechnicianConfigMutation
serverConfig: ServerConfigMutation
}

View File

@ -37,6 +37,10 @@ type Query {
achievementAttributes: [AchievementAttribute]
achievementOperators: [String]
shortRoleNameCount: Int
shortRoleNames(filter: ShortRoleNameFilter, page: Page, sort: Sort): [ShortRoleName]
shortRoleNamePositions: [String]
technicianConfig: TechnicianConfig
possibleFeatureFlags: [String]
discord: Discord

View File

@ -31,7 +31,11 @@ type Server implements TableWithHistoryQuery {
achievementCount: Int
achievements(filter: AchievementFilter, page: Page, sort: Sort): [Achievement]
shortRoleNameCount: Int
shortRoleNames(filter: ShortRoleNameFilter, page: Page, sort: Sort): [ShortRoleName]
config: ServerConfig
hasFeatureFlag(flag: String): FeatureFlag
createdAt: String
modifiedAt: String

View File

@ -0,0 +1,50 @@
type ShortRoleName implements TableWithHistoryQuery {
id: ID
shortName: String
roleId: String
roleName: String
position: String
server: Server
createdAt: String
modifiedAt: String
history: [ShortRoleNameHistory]
}
type ShortRoleNameHistory implements HistoryTableQuery {
id: ID
shortName: String
roleId: String
position: String
server: ID
deleted: Boolean
dateFrom: String
dateTo: String
}
input ShortRoleNameFilter {
id: ID
shortName: String
roleId: String
roleName: String
position: String
}
type ShortRoleNameMutation {
createShortRoleName(input: ShortRoleNameInput!): ShortRoleName
updateShortRoleName(input: ShortRoleNameInput!): ShortRoleName
deleteShortRoleName(id: ID): ShortRoleName
}
input ShortRoleNameInput {
id: ID
shortName: String
roleId: String
roleName: String
position: String
serverId: ID
}

View File

@ -5,7 +5,6 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC
from bot_core.abc.module_abc import ModuleABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_data.service.seeder_service import SeederService
from bot_graphql.abc.filter_abc import FilterABC
from bot_graphql.abc.query_abc import QueryABC
from bot_graphql.filter.achievement_filter import AchievementFilter
@ -14,6 +13,7 @@ from bot_graphql.filter.auto_role_rule_filter import AutoRoleRuleFilter
from bot_graphql.filter.client_filter import ClientFilter
from bot_graphql.filter.level_filter import LevelFilter
from bot_graphql.filter.server_filter import ServerFilter
from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter
from bot_graphql.filter.user_filter import UserFilter
from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter
from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter
@ -25,6 +25,7 @@ from bot_graphql.mutations.auto_role_mutation import AutoRoleMutation
from bot_graphql.mutations.auto_role_rule_mutation import AutoRoleRuleMutation
from bot_graphql.mutations.level_mutation import LevelMutation
from bot_graphql.mutations.server_config_mutation import ServerConfigMutation
from bot_graphql.mutations.short_role_name_mutation import ShortRoleNameMutation
from bot_graphql.mutations.technician_config_mutation import TechnicianConfigMutation
from bot_graphql.mutations.user_joined_game_server_mutation import UserJoinedGameServerMutation
from bot_graphql.mutations.user_mutation import UserMutation
@ -51,6 +52,8 @@ from bot_graphql.queries.level_query import LevelQuery
from bot_graphql.queries.server_config_query import ServerConfigQuery
from bot_graphql.queries.server_history_query import ServerHistoryQuery
from bot_graphql.queries.server_query import ServerQuery
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.technician_config_history_query import TechnicianConfigHistoryQuery
from bot_graphql.queries.technician_config_query import TechnicianConfigQuery
from bot_graphql.queries.technician_id_config_history_query import TechnicianIdConfigHistoryQuery
@ -110,6 +113,8 @@ class GraphQLModule(ModuleABC):
services.add_transient(QueryABC, UserJoinedVoiceChannelQuery)
services.add_transient(QueryABC, UserJoinedGameServerHistoryQuery)
services.add_transient(QueryABC, UserJoinedGameServerQuery)
services.add_transient(QueryABC, ShortRoleNameHistoryQuery)
services.add_transient(QueryABC, ShortRoleNameQuery)
services.add_transient(QueryABC, DiscordQuery)
services.add_transient(QueryABC, GuildQuery)
@ -129,6 +134,7 @@ class GraphQLModule(ModuleABC):
services.add_transient(FilterABC, UserJoinedServerFilter)
services.add_transient(FilterABC, UserJoinedVoiceChannelFilter)
services.add_transient(FilterABC, UserJoinedGameServerFilter)
services.add_transient(FilterABC, ShortRoleNameFilter)
# mutations
services.add_transient(QueryABC, AutoRoleMutation)
@ -136,8 +142,7 @@ class GraphQLModule(ModuleABC):
services.add_transient(QueryABC, LevelMutation)
services.add_transient(QueryABC, UserMutation)
services.add_transient(QueryABC, AchievementMutation)
services.add_transient(QueryABC, ShortRoleNameMutation)
services.add_transient(QueryABC, UserJoinedGameServerMutation)
services.add_transient(QueryABC, TechnicianConfigMutation)
services.add_transient(QueryABC, ServerConfigMutation)
services.add_transient(SeederService)

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -5,6 +5,7 @@ from bot_graphql.mutations.auto_role_mutation import AutoRoleMutation
from bot_graphql.mutations.auto_role_rule_mutation import AutoRoleRuleMutation
from bot_graphql.mutations.level_mutation import LevelMutation
from bot_graphql.mutations.server_config_mutation import ServerConfigMutation
from bot_graphql.mutations.short_role_name_mutation import ShortRoleNameMutation
from bot_graphql.mutations.technician_config_mutation import TechnicianConfigMutation
from bot_graphql.mutations.user_joined_game_server_mutation import UserJoinedGameServerMutation
from bot_graphql.mutations.user_mutation import UserMutation
@ -21,6 +22,7 @@ class Mutation(MutationType):
user_joined_game_server: UserJoinedGameServerMutation,
technician_config: TechnicianConfigMutation,
server_config: ServerConfigMutation,
short_role_name_mutation: ShortRoleNameMutation,
):
MutationType.__init__(self)
@ -30,5 +32,6 @@ class Mutation(MutationType):
self.set_field("user", lambda *_: user_mutation)
self.set_field("achievement", lambda *_: achievement_mutation)
self.set_field("userJoinedGameServer", lambda *_: user_joined_game_server)
self.set_field("shortRoleName", lambda *_: short_role_name_mutation)
self.set_field("technicianConfig", lambda *_: technician_config)
self.set_field("serverConfig", lambda *_: server_config)

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql.mutations"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -0,0 +1,85 @@
from cpl_core.database.context import DatabaseContextABC
from cpl_discord.service import DiscordBotServiceABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC
from bot_data.model.short_role_name import ShortRoleName
from bot_data.model.user_role_enum import UserRoleEnum
from bot_graphql.abc.query_abc import QueryABC
from modules.permission.service.permission_service import PermissionService
class ShortRoleNameMutation(QueryABC):
def __init__(
self,
servers: ServerRepositoryABC,
short_role_names: ShortRoleNameRepositoryABC,
bot: DiscordBotServiceABC,
db: DatabaseContextABC,
permissions: PermissionService,
):
QueryABC.__init__(self, "ShortRoleNameMutation")
self._servers = servers
self._short_role_names = short_role_names
self._bot = bot
self._db = db
self._permissions = permissions
self.set_field("createShortRoleName", self.resolve_create_short_role_name)
self.set_field("updateShortRoleName", self.resolve_update_short_role_name)
self.set_field("deleteShortRoleName", self.resolve_delete_short_role_name)
def resolve_create_short_role_name(self, *_, input: dict):
server = self._servers.get_server_by_id(input["serverId"])
self._can_user_mutate_data(server, UserRoleEnum.admin)
short_role_name = ShortRoleName(
input["shortName"],
int(input["roleId"]),
input["position"],
server,
)
result = self._short_role_names.find_short_role_names_by_role_id(short_role_name.role_id)
if result is not None:
raise ValueError("Short name for role already exists")
self._short_role_names.add_short_role_name(short_role_name)
self._db.save_changes()
def get_new_short_role_name(srn: ShortRoleName):
return (
srn.short_name == short_role_name.short_name
and srn.role_id == short_role_name.role_id
and srn.position.value == short_role_name.position
)
return (
self._short_role_names.get_short_role_names_by_server_id(short_role_name.server.id)
.where(get_new_short_role_name)
.last()
)
def resolve_update_short_role_name(self, *_, input: dict):
short_role_name = self._short_role_names.get_short_role_name_by_id(input["id"])
self._can_user_mutate_data(short_role_name.server, UserRoleEnum.moderator)
short_role_name.short_name = input["shortName"] if "shortName" in input else short_role_name.short_name
short_role_name.role_id = input["roleId"] if "roleId" in input else short_role_name.role_id
short_role_name.position = input["position"] if "position" in input else short_role_name.position
self._short_role_names.update_short_role_name(short_role_name)
self._db.save_changes()
short_role_name = self._short_role_names.get_short_role_name_by_id(input["id"])
return short_role_name
def resolve_delete_short_role_name(self, *_, id: int):
short_role_name = self._short_role_names.get_short_role_name_by_id(id)
self._can_user_mutate_data(short_role_name.server, UserRoleEnum.admin)
self._short_role_names.delete_short_role_name(short_role_name)
self._db.save_changes()
return short_role_name

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries.discord"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,3 +1,4 @@
import discord
from cpl_discord.service import DiscordBotServiceABC
from cpl_query.extension import List
from discord import Guild
@ -17,22 +18,24 @@ class GuildQuery(QueryABC):
self.set_field("id", lambda g, *_: g.id)
self.set_field("name", lambda g, *_: g.name)
self.set_field("channels", self._resolve_channels)
self.set_field("roles", lambda g, *_: g.roles)
self.set_field("emojis", lambda g, *_: g.emojis)
self.set_field("roles", lambda g, *_: g.roles.order_by(lambda x: x.position))
self.set_field(
"emojis", lambda g, *_: List(discord.Emoji, g.emojis).order_by_descending(lambda x: x.created_at)
)
def _resolve_channels(self, g: Guild, *_, filter=None):
users = List(any).extend(g.channels)
channels = List(any).extend(g.channels)
if filter is None:
return users
return channels
if "id" in filter:
users = users.where(lambda c: c.id == int(filter["id"]))
channels = channels.where(lambda c: c.id == int(filter["id"]))
if "name" in filter:
users = users.where(lambda c: c.id == filter["name"])
channels = channels.where(lambda c: c.id == filter["name"])
if "type" in filter:
users = users.where(lambda c: type(c).__name__ == filter["type"])
channels = channels.where(lambda c: type(c).__name__ == filter["type"])
return users
return channels.order_by(lambda x: x.position)

View File

@ -1,28 +1,35 @@
from cpl_core.configuration import ConfigurationABC
from cpl_core.database.context import DatabaseContextABC
from cpl_discord.service import DiscordBotServiceABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_data.abc.achievement_repository_abc import AchievementRepositoryABC
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
from bot_data.abc.client_repository_abc import ClientRepositoryABC
from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC
from bot_data.abc.level_repository_abc import LevelRepositoryABC
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from bot_data.model.server import Server
from bot_data.model.server_config import ServerConfig
from bot_data.model.server_history import ServerHistory
from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC
from bot_graphql.filter.achievement_filter import AchievementFilter
from bot_graphql.filter.auto_role_filter import AutoRoleFilter
from bot_graphql.filter.client_filter import ClientFilter
from bot_graphql.filter.level_filter import LevelFilter
from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter
from bot_graphql.filter.user_filter import UserFilter
class ServerQuery(DataQueryWithHistoryABC):
def __init__(
self,
config: ConfigurationABC,
bot: DiscordBotServiceABC,
db: DatabaseContextABC,
auto_roles: AutoRoleRepositoryABC,
@ -33,10 +40,12 @@ class ServerQuery(DataQueryWithHistoryABC):
ujs: UserJoinedServerRepositoryABC,
ujvs: UserJoinedVoiceChannelRepositoryABC,
achievements: AchievementRepositoryABC,
short_role_names: ShortRoleNameRepositoryABC,
server_configs: ServerConfigRepositoryABC,
):
DataQueryWithHistoryABC.__init__(self, "Server", "ServersHistory", ServerHistory, db)
self._config = config
self._bot = bot
self._auto_roles = auto_roles
self._clients = clients
@ -64,7 +73,15 @@ class ServerQuery(DataQueryWithHistoryABC):
self.add_collection(
"achievement", lambda server, *_: achievements.get_achievements_by_server_id(server.id), AchievementFilter
)
self.add_collection(
"shortRoleName",
lambda server, *_: short_role_names.get_short_role_names_by_server_id(server.id),
ShortRoleNameFilter,
)
self.set_field("config", lambda server, *_: server_configs.get_server_config_by_server(server.id))
self.set_field(
"hasFeatureFlag", lambda server, *_, **kwargs: self._resolve_has_feature_flag(server, *_, **kwargs)
)
@staticmethod
def resolve_id(server: Server, *_):
@ -81,3 +98,12 @@ class ServerQuery(DataQueryWithHistoryABC):
@staticmethod
def resolve_icon_url(server: Server, *_):
return server.icon_url
def _resolve_has_feature_flag(self, server: Server, *_, **kwargs):
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{server.discord_id}")
if "flag" not in kwargs:
return False
return {
"key": kwargs["flag"],
"value": FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum(kwargs["flag"])),
}

View File

@ -0,0 +1,11 @@
from bot_graphql.abc.history_query_abc import HistoryQueryABC
class ShortRoleNameHistoryQuery(HistoryQueryABC):
def __init__(self):
HistoryQueryABC.__init__(self, "ShortRoleName")
self.set_field("id", lambda x, *_: x.id)
self.set_field("shortName", lambda x, *_: x.shortName)
self.set_field("roleId", lambda x, *_: x.roleId)
self.set_field("position", lambda x, *_: x.position.value)

View File

@ -0,0 +1,18 @@
from cpl_core.database.context import DatabaseContextABC
from bot_data.model.short_role_name_history import ShortRoleNameHistory
from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC
class ShortRoleNameQuery(DataQueryWithHistoryABC):
def __init__(
self,
db: DatabaseContextABC,
):
DataQueryWithHistoryABC.__init__(self, "ShortRoleName", "ShortRoleNamesHistory", ShortRoleNameHistory, db)
self.set_field("id", lambda x, *_: x.id)
self.set_field("shortName", lambda x, *_: x.short_name)
self.set_field("roleId", lambda x, *_: x.role_id)
self.set_field("roleName", lambda x, *_: x.role_name)
self.set_field("position", lambda x, *_: x.position.value)

View File

@ -9,11 +9,13 @@ from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.level_repository_abc import LevelRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC
from bot_data.abc.technician_config_repository_abc import TechnicianConfigRepositoryABC
from bot_data.abc.user_joined_game_server_repository_abc import UserJoinedGameServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from bot_data.model.short_role_name_position_enum import ShortRoleNamePositionEnum
from bot_graphql.abc.query_abc import QueryABC
from bot_graphql.filter.achievement_filter import AchievementFilter
from bot_graphql.filter.auto_role_filter import AutoRoleFilter
@ -21,6 +23,7 @@ from bot_graphql.filter.auto_role_rule_filter import AutoRoleRuleFilter
from bot_graphql.filter.client_filter import ClientFilter
from bot_graphql.filter.level_filter import LevelFilter
from bot_graphql.filter.server_filter import ServerFilter
from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter
from bot_graphql.filter.user_filter import UserFilter
from bot_graphql.filter.user_joined_game_server_filter import UserJoinedGameServerFilter
from bot_graphql.filter.user_joined_server_filter import UserJoinedServerFilter
@ -44,6 +47,7 @@ class Query(QueryABC):
user_joined_game_server: UserJoinedGameServerRepositoryABC,
users: UserRepositoryABC,
achievements: AchievementRepositoryABC,
short_role_names: ShortRoleNameRepositoryABC,
achievement_service: AchievementService,
technician_config: TechnicianConfigRepositoryABC,
):
@ -71,9 +75,12 @@ class Query(QueryABC):
)
self.add_collection("user", lambda *_: users.get_users(), UserFilter)
self.add_collection("achievement", lambda *_: achievements.get_achievements(), AchievementFilter)
self.add_collection("shortRoleName", lambda *_: short_role_names.get_short_role_names(), ShortRoleNameFilter)
self.set_field("technicianConfig", lambda *_: technician_config.get_technician_config())
self.set_field("achievementAttributes", lambda *_: achievement_service.get_attributes())
self.set_field("achievementOperators", lambda *_: achievement_service.get_operators())
self.set_field("shortRoleNamePositions", lambda *_: [x.value for x in ShortRoleNamePositionEnum])
self.set_field("possibleFeatureFlags", lambda *_: [e.value for e in FeatureFlagsEnum])
self.set_field("discord", lambda *_: Discord(bot.guilds, List(any).extend(bot.users)))

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.achievements"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,10 +16,10 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=1.1.1"
"cpl-core>=1.1.7"
],
"DevDependencies": [
"cpl-cli>=1.1.1"
"cpl-cli>=1.1.7"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {},

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.achievements.commands"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.achievements.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.achievements.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.auto_role"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "",
"AuthorEmail": "",

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.auto_role.command"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.auto_role.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.auto_role.helper"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "1",
"Micro": "6"
"Micro": "7"
},
"Author": "",
"AuthorEmail": "",

View File

@ -21,6 +21,7 @@ from modules.base.command.unregister_group import UnregisterGroup
from modules.base.command.user_group import UserGroup
from modules.base.events.base_on_command_error_event import BaseOnCommandErrorEvent
from modules.base.events.base_on_command_event import BaseOnCommandEvent
from modules.base.events.base_on_guild_join_event import BaseOnGuildJoinEvent
from modules.base.events.base_on_member_join_event import BaseOnMemberJoinEvent
from modules.base.events.base_on_member_remove_event import BaseOnMemberRemoveEvent
from modules.base.events.base_on_message_delete_event import BaseOnMessageDeleteEvent
@ -103,3 +104,7 @@ class BaseModule(ModuleABC):
DiscordEventTypesEnum.on_scheduled_event_update.value,
BaseOnScheduledEventUpdateEvent,
)
self._dc.add_event(
DiscordEventTypesEnum.on_guild_join.value,
BaseOnGuildJoinEvent,
)

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.command"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -0,0 +1,38 @@
from cpl_core.database.context import DatabaseContextABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnGuildJoinABC
from cpl_discord.service import DiscordBotServiceABC
from discord import Guild
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.model.server import Server
from bot_data.service.seeder_service import SeederService
class BaseOnGuildJoinEvent(OnGuildJoinABC):
def __init__(
self,
logger: LoggerABC,
bot: DiscordBotServiceABC,
servers: ServerRepositoryABC,
server_config: ServerConfigRepositoryABC,
db: DatabaseContextABC,
seeder: SeederService,
):
OnGuildJoinABC.__init__(self)
self._logger = logger
self._bot = bot
self._servers = servers
self._server_config = server_config
self._db = db
self._seeder = seeder
async def on_guild_join(self, guild: Guild):
if self._servers.find_server_by_discord_id(guild.id) is None:
self._servers.add_server(Server(guild.id))
self._db.save_changes()
await self._seeder.seed()
self._logger.debug(__name__, "Seeded technician config")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.forms"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.helper"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

View File

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
bot sh-edraft.de Discord bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
Discord bot for customers of sh-edraft.de
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
@ -15,7 +15,7 @@ __title__ = "modules.base.thread"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.6"
__version__ = "1.1.7"
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="6")
version_info = VersionInfo(major="1", minor="1", micro="7")

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