Merge pull request 'dev' (#392) from dev into master
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m42s

Reviewed-on: sh-edraft.de/kd_discord_bot#392
This commit is contained in:
Sven Heidemann 2023-10-02 09:22:16 +02:00
commit aba6e48e2b
116 changed files with 431 additions and 295 deletions

View File

@ -5,8 +5,8 @@ volumes:
services:
kdb_bot_staging_1:
image: sh-edraft.de/kdb-bot:1.1.8
container_name: kdb_bot_staging_1
image: sh-edraft.de/kdb-bot:1.1.9
restart: unless-stopped
depends_on:
- kdb_db_staging_1
networks:
@ -25,15 +25,14 @@ services:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
constraints: [node.role == manager]
resources:
reservations:
cpus: "0.5"
memory: 1024M
kdb_web_staging_1:
image: sh-edraft.de/kdb-web:1.1.8
container_name: kdb_web_staging_1
image: sh-edraft.de/kdb-web:1.1.9
depends_on:
- kdb_bot_staging_1
networks:
@ -47,7 +46,7 @@ services:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
constraints: [node.role == manager]
resources:
limits:
cpus: "0.4"
@ -58,7 +57,6 @@ services:
kdb_db_staging_1:
image: mysql:latest
container_name: kdb_db_staging_1
command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1
networks:
- kdb_test
@ -75,7 +73,7 @@ services:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
constraints: [node.role == manager]
resources:
reservations:
cpus: "0.1"

View File

@ -5,7 +5,8 @@ volumes:
services:
kdb_bot_prod_1:
image: sh-edraft.de/kdb-bot:1.1.8
image: sh-edraft.de/kdb-bot:1.1.9
restart: unless-stopped
depends_on:
- kdb_db_prod_1
networks:
@ -23,14 +24,14 @@ services:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
constraints: [node.role == manager]
resources:
reservations:
cpus: "0.5"
memory: 1024M
kdb_web_prod_1:
image: sh-edraft.de/kdb-web:1.1.8
image: sh-edraft.de/kdb-web:1.1.9
depends_on:
- kdb_bot_prod_1
networks:
@ -44,7 +45,7 @@ services:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
constraints: [node.role == manager]
resources:
limits:
cpus: "0.4"
@ -72,7 +73,7 @@ services:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
constraints: [node.role == manager]
resources:
reservations:
cpus: "0.1"

View File

@ -15,7 +15,7 @@ __title__ = "bot"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "bot.extension"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -18,6 +18,7 @@ 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.short_role_name_only_highest_migration import ShortRoleNameOnlyHighestMigration
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 (
@ -54,3 +55,4 @@ class StartupMigrationExtension(StartupExtensionABC):
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
services.add_transient(MigrationABC, ShortRoleNameOnlyHighestMigration) # 02.10.2023 #391 - 1.1.9

View File

@ -15,7 +15,7 @@ __title__ = "bot_api"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.configuration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.controller"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.event"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.exception"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.filter"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.logging"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.route"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_api.transformer"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.configuration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.exception"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.helper"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.logging"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.pipes"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_core.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_data"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_data.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "bot_data.migration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS `CFG_ServerHistory`
`TeamChannelId` BIGINT NOT NULL,
`LoginMessageChannelId` BIGINT NOT NULL,
`DefaultRoleId` BIGINT NULL,
`ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE,
`FeatureFlags` JSON NULL DEFAULT ('{}'),
`ServerId` BIGINT NOT NULL,
`Deleted` BOOL DEFAULT FALSE,
@ -44,6 +45,7 @@ BEGIN
`TeamChannelId`,
`LoginMessageChannelId`,
`DefaultRoleId`,
`ShortRoleNameSetOnlyHighest`,
`FeatureFlags`,
`ServerId`,
`DateFrom`,
@ -63,6 +65,7 @@ BEGIN
OLD.TeamChannelId,
OLD.LoginMessageChannelId,
OLD.DefaultRoleId,
OLD.ShortRoleNameSetOnlyHighest,
OLD.FeatureFlags,
OLD.ServerId,
OLD.LastModifiedAt,
@ -91,6 +94,7 @@ BEGIN
`TeamChannelId`,
`LoginMessageChannelId`,
`DefaultRoleId`,
`ShortRoleNameSetOnlyHighest`,
`ServerId`,
`FeatureFlags`,
`Deleted`,
@ -111,6 +115,7 @@ BEGIN
OLD.TeamChannelId,
OLD.LoginMessageChannelId,
OLD.DefaultRoleId,
OLD.ShortRoleNameSetOnlyHighest,
OLD.FeatureFlags,
OLD.ServerId,
TRUE,

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 ShortRoleNameOnlyHighestMigration(MigrationABC):
name = "1.1.9_ShortRoleNameOnlyHighestMigration"
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_Server
ADD ShortRoleNameSetOnlyHighest BOOLEAN NOT NULL DEFAULT FALSE AFTER DefaultRoleId;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_ServerHistory
ADD ShortRoleNameSetOnlyHighest BOOLEAN NOT NULL DEFAULT FALSE AFTER DefaultRoleId;
"""
)
)
self._exec(__file__, "config/server.sql")
def downgrade(self):
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_Server DROP COLUMN ShortRoleNameSetOnlyHighest;
"""
)
)
self._cursor.execute(
str(
f"""
ALTER TABLE CFG_ServerHistory DROP COLUMN ShortRoleNameSetOnlyHighest;
"""
)
)

View File

@ -15,7 +15,7 @@ __title__ = "bot_data.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -29,6 +29,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
team_channel_id: int,
login_message_channel_id: int,
default_role_id: Optional[int],
short_role_name_only_set_highest_role: bool,
feature_flags: dict[FeatureFlagsEnum],
server: Server,
afk_channel_ids: List[int],
@ -52,6 +53,8 @@ class ServerConfig(TableABC, ConfigurationModelABC):
self._team_channel_id = team_channel_id
self._login_message_channel_id = login_message_channel_id
self._default_role_id = default_role_id
self._short_role_name_only_set_highest_role = short_role_name_only_set_highest_role
self._feature_flags = feature_flags
self._server = server
self._afk_channel_ids = afk_channel_ids
@ -78,6 +81,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
guild.system_channel.id,
guild.system_channel.id,
None,
False,
{},
server,
List(int),
@ -200,6 +204,14 @@ class ServerConfig(TableABC, ConfigurationModelABC):
def default_role_id(self, value: int):
self._default_role_id = value
@property
def short_role_name_only_set_highest_role(self) -> bool:
return self._short_role_name_only_set_highest_role
@short_role_name_only_set_highest_role.setter
def short_role_name_only_set_highest_role(self, value: bool):
self._short_role_name_only_set_highest_role = value
@property
def feature_flags(self) -> dict[FeatureFlagsEnum]:
return self._feature_flags
@ -273,6 +285,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`TeamChannelId`,
`LoginMessageChannelId`,
`DefaultRoleId`,
`ShortRoleNameSetOnlyHighest`,
`FeatureFlags`,
`ServerId`
) VALUES (
@ -290,6 +303,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
{self._team_channel_id},
{self._login_message_channel_id},
{"NULL" if self._default_role_id is None else self._default_role_id},
{self._short_role_name_only_set_highest_role},
'{json.dumps(self._feature_flags)}',
{self._server.id}
);
@ -315,6 +329,7 @@ class ServerConfig(TableABC, ConfigurationModelABC):
`TeamChannelId` = {self._team_channel_id},
`LoginMessageChannelId` = {self._login_message_channel_id},
`DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id},
`ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role},
`FeatureFlags` = '{json.dumps(self._feature_flags)}',
`ServerId` = {self._server.id}
WHERE `Id` = {self._id};

View File

@ -18,6 +18,7 @@ class ServerConfigHistory(HistoryTableABC):
team_channel_id: int,
login_message_channel_id: int,
default_role_id: int,
short_role_name_only_set_highest_role: bool,
feature_flags: dict[str],
server_id: int,
deleted: bool,
@ -42,6 +43,8 @@ class ServerConfigHistory(HistoryTableABC):
self._team_channel_id = team_channel_id
self._login_message_channel_id = login_message_channel_id
self._default_role_id = default_role_id
self._short_role_name_only_set_highest_role = short_role_name_only_set_highest_role
self._feature_flags = feature_flags
self._server_id = server_id
@ -105,6 +108,10 @@ class ServerConfigHistory(HistoryTableABC):
def default_role_id(self) -> int:
return self._default_role_id
@property
def short_role_name_only_set_highest_role(self) -> bool:
return self._short_role_name_only_set_highest_role
@property
def feature_flags(self) -> dict[str]:
return self._feature_flags

View File

@ -15,7 +15,7 @@ __title__ = "bot_data.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -65,12 +65,13 @@ class ServerConfigRepositoryService(ServerConfigRepositoryABC):
result[12],
result[13],
result[14],
json.loads(result[15]),
self._servers.get_server_by_id(result[16]),
self._get_afk_channel_ids(result[16]),
self._get_team_role_ids(result[16]),
result[17],
result[15],
json.loads(result[16]),
self._servers.get_server_by_id(result[17]),
self._get_afk_channel_ids(result[17]),
self._get_team_role_ids(result[17]),
result[18],
result[19],
id=result[0],
)

View File

@ -15,7 +15,7 @@ __title__ = "bot_graphql"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_graphql.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -79,6 +79,14 @@ class QueryABC(ObjectType):
permissions: PermissionService = services.get_service(PermissionService)
bot: DiscordBotServiceABC = services.get_service(DiscordBotServiceABC)
if user.auth_role == AuthRoleEnum.admin:
return True
for u in user.users:
guild = bot.get_guild(u.server.discord_id)
if permissions.is_member_technician(guild.get_member(u.discord_id)):
return True
access = False
if type(element) == Achievement:
element: Achievement = element

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "bot_graphql.filter"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -14,6 +14,7 @@ type ServerConfig implements TableWithHistoryQuery {
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
featureFlagCount: Int
featureFlags: [FeatureFlag]
@ -45,6 +46,7 @@ type ServerConfigHistory implements HistoryTableQuery {
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
featureFlagCount: Int
featureFlags: [FeatureFlag]
@ -94,6 +96,7 @@ input ServerConfigInput {
teamChannelId: String
loginMessageChannelId: String
defaultRoleId: String
shortRoleNameOnlySetHighestRole: Boolean
featureFlags: [FeatureFlagInput]
afkChannelIds: [String]

View File

@ -15,7 +15,7 @@ __title__ = "bot_graphql.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "bot_graphql.mutations"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -92,6 +92,11 @@ class ServerConfigMutation(QueryABC):
server_config.default_role_id = (
input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id
)
server_config.short_role_name_only_set_highest_role = (
input["shortRoleNameOnlySetHighestRole"]
if "shortRoleNameOnlySetHighestRole" in input
else server_config.short_role_name_only_set_highest_role
)
server_config.feature_flags = (
dict(zip([x["key"] for x in input["featureFlags"]], [x["value"] for x in input["featureFlags"]]))
if "featureFlags" in input

View File

@ -15,7 +15,7 @@ __title__ = "bot_graphql.queries"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -25,6 +25,9 @@ class ServerConfigQuery(DataQueryWithHistoryABC):
self.set_field("teamChannelId", lambda config, *_: config.team_channel_id)
self.set_field("loginMessageChannelId", lambda config, *_: config.login_message_channel_id)
self.set_field("defaultRoleId", lambda config, *_: config.default_role_id)
self.set_field(
"shortRoleNameOnlySetHighestRole", lambda config, *_: config.short_role_name_only_set_highest_role
)
self.add_collection(
"featureFlag",
lambda config, *_: List(any, [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags]),

View File

@ -15,7 +15,7 @@ __title__ = "modules.achievements"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.achievements.commands"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.achievements.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.achievements.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.auto_role"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -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.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.base"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.command"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -17,6 +17,7 @@ from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from bot_data.model.known_user import KnownUser
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 modules.permission.abc.permission_service_abc import PermissionServiceABC
@ -72,18 +73,6 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC):
member,
)
for admin in self._permission_service.get_admins(member.guild.id):
await self._messenger.send_dm_message(
self._t.transform("modules.base.welcome_message_for_team").format(member.mention),
admin,
)
for moderator in self._permission_service.get_moderators(member.guild.id):
await self._messenger.send_dm_message(
self._t.transform("modules.base.welcome_message_for_team").format(member.mention),
moderator,
)
try:
server = self._servers.get_server_by_discord_id(member.guild.id)
user = self._users.find_user_by_discord_id_and_server_id(member.id, server.id)
@ -101,9 +90,21 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC):
except Exception as e:
self._logger.error(__name__, f"Cannot get user {member.id}", e)
async def _notify_team(self, member: discord.Member):
self._logger.debug(__name__, f"Notify team that a member left")
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{member.guild.id}")
channel = member.guild.get_channel(settings.team_channel_id)
await self._messenger.send_channel_message(
channel,
self._t.transform("modules.base.welcome_message_for_team").format(member.mention),
is_persistent=True,
)
self._logger.trace(__name__, f"Notified team that a member left")
@EventChecks.check_is_ready()
async def on_member_join(self, member: discord.Member):
self._logger.debug(__name__, f"Module {type(self)} started")
await self._client_utils.check_default_role(member)
self._check_for_known_user(member)
await self._add_if_not_exists_user_async(member)
await self._notify_team(member)

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.forms"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.helper"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.base.thread"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.boot_log"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.config"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.config.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.config.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.database"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.level"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.level.command"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.level.configuration"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.level.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.level.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.permission"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.permission.abc"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.permission.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

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

View File

@ -15,7 +15,7 @@ __title__ = "modules.permission.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.short_role_name"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.short_role_name.events"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -15,7 +15,7 @@ __title__ = "modules.short_role_name.service"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

View File

@ -1,3 +1,5 @@
from typing import Optional
import discord
from cpl_core.configuration import ConfigurationABC
from cpl_core.logging import LoggerABC
@ -41,7 +43,11 @@ class ShortRoleNameService:
before = ""
after = ""
new_nick = member.nick if member.nick is not None else member.name
role_ids = List(discord.Role, member.roles).select(lambda x: x.id)
member_roles = List(discord.Role, member.roles)
highest_role: Optional[discord.Role] = (
member_roles.last_or_default() if settings.short_role_name_only_set_highest_role else None
)
member_role_ids = member_roles.select(lambda x: x.id)
server = self._server.get_server_by_discord_id(member.guild.id)
for short_role_name in self._short_role_names.get_short_role_names_by_server_id(server.id):
@ -51,7 +57,11 @@ class ShortRoleNameService:
new_nick = new_nick.replace(f"[{short_role_name.short_name}] ", "")
new_nick = new_nick.replace(f"[{short_role_name.short_name}]", "")
if short_role_name.role_id not in role_ids:
if (
short_role_name.role_id not in member_role_ids
or highest_role
and highest_role.id != short_role_name.role_id
):
continue
if short_role_name.position == ShortRoleNamePositionEnum.before:

View File

@ -48,7 +48,7 @@ class ShortRoleNameCheckCommand(DiscordCommandABC):
return
settings: ServerConfig = self._config.get_configuration(f"ServerConfig_{ctx.guild.id}")
if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.game_server):
if not FeatureFlagsSettings.get_flag_from_dict(settings.feature_flags, FeatureFlagsEnum.short_role_name):
await self._message_service.send_ctx_msg(ctx, self._t.transform("common.feature_not_activated"))
return

View File

@ -15,7 +15,7 @@ __title__ = "modules.technician"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.8"
__version__ = "1.1.9"
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="8")
version_info = VersionInfo(major="1", minor="1", micro="9")

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