From b8fcaa48a52835e8767cff753ba9ca842cfb9479 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 7 Nov 2022 20:54:27 +0100 Subject: [PATCH 1/4] Added remove command #91 --- kdb-bot/src/bot/translation/de.json | 14 +++- .../src/modules/level/command/level_group.py | 79 ++++++++++++++++--- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index 994ec206c3..cabd346b39 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -176,6 +176,9 @@ }, "level": { "new_level_message": "<@{}> ist nun Level {}", + "seeding_started": "Levelsystem wird neu geladen.", + "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", + "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen.", "error": { "nothing_found": "Keine Level Einträge gefunden.", "level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!", @@ -189,10 +192,13 @@ "permission_int": "Berechtigungen" }, "create": { - "created": "Level {} mit Berechtigungen {} wurde erstellt.", - "seeding_started": "Levelsystem wird neu geladen.", - "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", - "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen." + "created": "Level {} mit Berechtigungen {} wurde erstellt." + }, + "remove": { + "success": "Level {} wurde entfernt :D", + "error": { + "not_found": "Level {} nicht gefunden!" + } } }, "database": {}, diff --git a/kdb-bot/src/modules/level/command/level_group.py b/kdb-bot/src/modules/level/command/level_group.py index 5dd951c01a..05cdcad78d 100644 --- a/kdb-bot/src/modules/level/command/level_group.py +++ b/kdb-bot/src/modules/level/command/level_group.py @@ -3,6 +3,7 @@ from typing import List as TList import discord from cpl_core.database.context import DatabaseContextABC from cpl_discord.command import DiscordCommandABC +from cpl_discord.container import Guild, Role from cpl_discord.service import DiscordBotServiceABC from cpl_translation import TranslatePipe from discord import app_commands @@ -53,6 +54,16 @@ class LevelGroup(DiscordCommandABC): self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}') + async def _seed_levels(self, channel: discord.TextChannel): + # send message to ctx.channel because send_ctx_msg resolves ctx + try: + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_started')) + await self._level_seeder.seed() + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_finished')) + except Exception as e: + self._logger.error(__name__, f'Level seeding failed', e) + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_failed')) + @commands.hybrid_group() @commands.guild_only() async def level(self, ctx: Context): @@ -104,6 +115,14 @@ class LevelGroup(DiscordCommandABC): async def create(self, ctx: Context, name: str, color: str, min_xp: int, permissions: int): self._logger.debug(__name__, f'Received command level create {ctx}') + if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): + return + + if not self._permissions.is_member_admin(ctx.author): + await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message')) + self._logger.trace(__name__, f'Finished command level remove') + return + try: color = hex(discord.Colour.from_str(color).value) except Exception as e: @@ -116,9 +135,6 @@ class LevelGroup(DiscordCommandABC): self._logger.error(__name__, f'Error parsing permissions {permissions}', e) return - if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): - return - if ctx.guild is None: return @@ -142,15 +158,7 @@ class LevelGroup(DiscordCommandABC): self._logger.error(__name__, f'Could not save level {name} with color {color}, min_xp {min_xp} and permissions {permissions}', e) else: await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.create.created').format(name, permissions)) - - # send message to ctx.channel because send_ctx_msg resolves ctx - try: - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_started')) - await self._level_seeder.seed() - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_finished')) - except Exception as e: - self._logger.error(__name__, f'Level seeding failed', e) - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_failed')) + await self._seed_levels(ctx.channel) self._logger.trace(__name__, f'Finished command level create') @@ -184,3 +192,50 @@ class LevelGroup(DiscordCommandABC): # value in rg format see: # https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour.to_rgb return [app_commands.Choice(name=self._t.transform(f'common.colors.{color}'), value=f'rgb({code[0]}, {code[1]}, {code[2]})') for color, code in colors] + + @level.command() + @commands.guild_only() + async def remove(self, ctx: Context, level: str): + self._logger.debug(__name__, f'Received command level remove {ctx}') + + if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): + return + + if not self._permissions.is_member_admin(ctx.author): + await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message')) + self._logger.trace(__name__, f'Finished command level remove') + return + + if ctx.guild is None: + self._logger.trace(__name__, f'Finished command level remove') + return + + server = self._servers.get_server_by_discord_id(ctx.guild.id) + level_from_db = self._levels.get_levels_by_server_id(server.server_id).where(lambda l: l.name == level).first_or_default() + if level_from_db is None: + self._logger.debug(__name__, f'level {level} not found') + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.remove.error.not_found').format(level)) + self._logger.trace(__name__, f'Finished command level remove') + return + + try: + self._levels.delete_level(level_from_db) + self._db_context.save_changes() + guild: Guild = self._bot.guilds.where(lambda g: g == ctx.guild).single() + role: Role = guild.roles.where(lambda r: r.name == level).single_or_default() + if role is not None: + await role.delete() + self._logger.info(__name__, f'Removed level {level}') + except Exception as e: + self._logger.error(__name__, f'Could not remove level {level}', e) + else: + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.remove.success').format(level)) + await self._seed_levels(ctx.channel) + + self._logger.trace(__name__, f'Finished command level remove') + + @remove.autocomplete('level') + async def remove_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + server = self._servers.get_server_by_discord_id(interaction.guild.id) + levels = self._levels.get_levels_by_server_id(server.server_id).select(lambda l: l.name) + return [app_commands.Choice(name=level, value=level) for level in levels] From 7f2cdc5b1c3d75a43a1b5a08cc182124e9200caf Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 7 Nov 2022 20:54:27 +0100 Subject: [PATCH 2/4] Added remove command #91 --- kdb-bot/src/bot/translation/de.json | 14 +++- .../src/modules/level/command/level_group.py | 79 ++++++++++++++++--- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index 9287476882..ad81d3358d 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -175,6 +175,9 @@ }, "level": { "new_level_message": "<@{}> ist nun Level {}", + "seeding_started": "Levelsystem wird neu geladen.", + "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", + "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen.", "error": { "nothing_found": "Keine Level Einträge gefunden.", "level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!", @@ -188,10 +191,13 @@ "permission_int": "Berechtigungen" }, "create": { - "created": "Level {} mit Berechtigungen {} wurde erstellt.", - "seeding_started": "Levelsystem wird neu geladen.", - "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", - "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen." + "created": "Level {} mit Berechtigungen {} wurde erstellt." + }, + "remove": { + "success": "Level {} wurde entfernt :D", + "error": { + "not_found": "Level {} nicht gefunden!" + } } }, "database": {}, diff --git a/kdb-bot/src/modules/level/command/level_group.py b/kdb-bot/src/modules/level/command/level_group.py index 0eaf7d350e..7658da5a1d 100644 --- a/kdb-bot/src/modules/level/command/level_group.py +++ b/kdb-bot/src/modules/level/command/level_group.py @@ -3,6 +3,7 @@ from typing import List as TList import discord from cpl_core.database.context import DatabaseContextABC from cpl_discord.command import DiscordCommandABC +from cpl_discord.container import Guild, Role from cpl_discord.service import DiscordBotServiceABC from cpl_translation import TranslatePipe from discord import app_commands @@ -53,6 +54,16 @@ class LevelGroup(DiscordCommandABC): self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}') + async def _seed_levels(self, channel: discord.TextChannel): + # send message to ctx.channel because send_ctx_msg resolves ctx + try: + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_started')) + await self._level_seeder.seed() + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_finished')) + except Exception as e: + self._logger.error(__name__, f'Level seeding failed', e) + await self._message_service.send_channel_message(channel, self._t.transform('modules.level.seeding_failed')) + @commands.hybrid_group() @commands.guild_only() async def level(self, ctx: Context): @@ -104,6 +115,14 @@ class LevelGroup(DiscordCommandABC): async def create(self, ctx: Context, name: str, color: str, min_xp: int, permissions: int): self._logger.debug(__name__, f'Received command level create {ctx}') + if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): + return + + if not self._permissions.is_member_admin(ctx.author): + await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message')) + self._logger.trace(__name__, f'Finished command level remove') + return + try: color = hex(discord.Colour.from_str(color).value) except Exception as e: @@ -116,9 +135,6 @@ class LevelGroup(DiscordCommandABC): self._logger.error(__name__, f'Error parsing permissions {permissions}', e) return - if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): - return - if ctx.guild is None: return @@ -142,15 +158,7 @@ class LevelGroup(DiscordCommandABC): self._logger.error(__name__, f'Could not save level {name} with color {color}, min_xp {min_xp} and permissions {permissions}', e) else: await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.create.created').format(name, permissions)) - - # send message to ctx.channel because send_ctx_msg resolves ctx - try: - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_started')) - await self._level_seeder.seed() - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_finished')) - except Exception as e: - self._logger.error(__name__, f'Level seeding failed', e) - await self._message_service.send_channel_message(ctx.channel, self._t.transform('modules.level.create.seeding_failed')) + await self._seed_levels(ctx.channel) self._logger.trace(__name__, f'Finished command level create') @@ -183,3 +191,50 @@ class LevelGroup(DiscordCommandABC): # value in rg format see: # https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour.to_rgb return [app_commands.Choice(name=self._t.transform(f'common.colors.{color}'), value=f'rgb({code[0]}, {code[1]}, {code[2]})') for color, code in colors] + + @level.command() + @commands.guild_only() + async def remove(self, ctx: Context, level: str): + self._logger.debug(__name__, f'Received command level remove {ctx}') + + if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): + return + + if not self._permissions.is_member_admin(ctx.author): + await self._message_service.send_ctx_msg(ctx, self._t.transform('common.no_permission_message')) + self._logger.trace(__name__, f'Finished command level remove') + return + + if ctx.guild is None: + self._logger.trace(__name__, f'Finished command level remove') + return + + server = self._servers.get_server_by_discord_id(ctx.guild.id) + level_from_db = self._levels.get_levels_by_server_id(server.server_id).where(lambda l: l.name == level).first_or_default() + if level_from_db is None: + self._logger.debug(__name__, f'level {level} not found') + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.remove.error.not_found').format(level)) + self._logger.trace(__name__, f'Finished command level remove') + return + + try: + self._levels.delete_level(level_from_db) + self._db_context.save_changes() + guild: Guild = self._bot.guilds.where(lambda g: g == ctx.guild).single() + role: Role = guild.roles.where(lambda r: r.name == level).single_or_default() + if role is not None: + await role.delete() + self._logger.info(__name__, f'Removed level {level}') + except Exception as e: + self._logger.error(__name__, f'Could not remove level {level}', e) + else: + await self._message_service.send_ctx_msg(ctx, self._t.transform('modules.level.remove.success').format(level)) + await self._seed_levels(ctx.channel) + + self._logger.trace(__name__, f'Finished command level remove') + + @remove.autocomplete('level') + async def remove_autocomplete(self, interaction: discord.Interaction, current: str) -> TList[app_commands.Choice[str]]: + server = self._servers.get_server_by_discord_id(interaction.guild.id) + levels = self._levels.get_levels_by_server_id(server.server_id).select(lambda l: l.name) + return [app_commands.Choice(name=level, value=level) for level in levels] From 9099ebe4f30a0f90b79c4e450cd3e9c5c9a5477b Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 8 Nov 2022 18:59:24 +0100 Subject: [PATCH 3/4] Moved admin & moderator commands to base module --- kdb-bot/cpl-workspace.json | 2 - kdb-bot/src/bot/module_list.py | 4 -- kdb-bot/src/modules/admin/__init__.py | 26 ----------- kdb-bot/src/modules/admin/admin.json | 44 ------------------- kdb-bot/src/modules/admin/admin_module.py | 24 ---------- kdb-bot/src/modules/admin/command/__init__.py | 26 ----------- kdb-bot/src/modules/base/base_module.py | 9 ++++ .../command/purge_command.py | 0 .../command/restart_command.py | 0 .../command/shutdown_command.py | 0 .../{moderator => base}/command/user_group.py | 0 kdb-bot/src/modules/moderator/__init__.py | 26 ----------- .../src/modules/moderator/command/__init__.py | 26 ----------- kdb-bot/src/modules/moderator/moderator.json | 44 ------------------- .../src/modules/moderator/moderator_module.py | 24 ---------- 15 files changed, 9 insertions(+), 246 deletions(-) delete mode 100644 kdb-bot/src/modules/admin/__init__.py delete mode 100644 kdb-bot/src/modules/admin/admin.json delete mode 100644 kdb-bot/src/modules/admin/admin_module.py delete mode 100644 kdb-bot/src/modules/admin/command/__init__.py rename kdb-bot/src/modules/{moderator => base}/command/purge_command.py (100%) rename kdb-bot/src/modules/{admin => base}/command/restart_command.py (100%) rename kdb-bot/src/modules/{admin => base}/command/shutdown_command.py (100%) rename kdb-bot/src/modules/{moderator => base}/command/user_group.py (100%) delete mode 100644 kdb-bot/src/modules/moderator/__init__.py delete mode 100644 kdb-bot/src/modules/moderator/command/__init__.py delete mode 100644 kdb-bot/src/modules/moderator/moderator.json delete mode 100644 kdb-bot/src/modules/moderator/moderator_module.py diff --git a/kdb-bot/cpl-workspace.json b/kdb-bot/cpl-workspace.json index 7af45bfebe..fa9a4332ee 100644 --- a/kdb-bot/cpl-workspace.json +++ b/kdb-bot/cpl-workspace.json @@ -5,13 +5,11 @@ "bot": "src/bot/bot.json", "bot-core": "src/bot_core/bot-core.json", "bot-data": "src/bot_data/bot-data.json", - "admin": "src/modules/admin/admin.json", "auto-role": "src/modules/auto_role/auto-role.json", "base": "src/modules/base/base.json", "boot-log": "src/modules/boot_log/boot-log.json", "database": "src/modules/database/database.json", "level": "src/modules/level/level.json", - "moderator": "src/modules/moderator/moderator.json", "permission": "src/modules/permission/permission.json", "bot-api": "src/bot_api/bot-api.json", "get-version": "tools/get_version/get-version.json", diff --git a/kdb-bot/src/bot/module_list.py b/kdb-bot/src/bot/module_list.py index 03b8307cda..575824f3c4 100644 --- a/kdb-bot/src/bot/module_list.py +++ b/kdb-bot/src/bot/module_list.py @@ -4,13 +4,11 @@ from bot_api.api_module import ApiModule from bot_core.core_extension.core_extension_module import CoreExtensionModule from bot_core.core_module import CoreModule from bot_data.data_module import DataModule -from modules.admin.admin_module import AdminModule from modules.auto_role.auto_role_module import AutoRoleModule from modules.base.base_module import BaseModule from modules.boot_log.boot_log_module import BootLogModule from modules.database.database_module import DatabaseModule from modules.level.level_module import LevelModule -from modules.moderator.moderator_module import ModeratorModule from modules.permission.permission_module import PermissionModule @@ -22,12 +20,10 @@ class ModuleList: return List(type, [ CoreModule, # has to be first! DataModule, - AdminModule, AutoRoleModule, BaseModule, DatabaseModule, LevelModule, - ModeratorModule, PermissionModule, ApiModule, # has to be last! diff --git a/kdb-bot/src/modules/admin/__init__.py b/kdb-bot/src/modules/admin/__init__.py deleted file mode 100644 index afcd237eb4..0000000000 --- a/kdb-bot/src/modules/admin/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bot Keksdose bot -~~~~~~~~~~~~~~~~~~~ - -Discord bot for the Keksdose discord Server - -:copyright: (c) 2022 sh-edraft.de -:license: MIT, see LICENSE for more details. - -""" - -__title__ = 'modules.admin' -__author__ = 'Sven Heidemann' -__license__ = 'MIT' -__copyright__ = 'Copyright (c) 2022 sh-edraft.de' -__version__ = '0.3.dev25' - -from collections import namedtuple - - -# imports: - -VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='0', minor='3', micro='dev25') diff --git a/kdb-bot/src/modules/admin/admin.json b/kdb-bot/src/modules/admin/admin.json deleted file mode 100644 index 38e0642859..0000000000 --- a/kdb-bot/src/modules/admin/admin.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "ProjectSettings": { - "Name": "admin", - "Version": { - "Major": "1", - "Minor": "0", - "Micro": "0" - }, - "Author": "", - "AuthorEmail": "", - "Description": "", - "LongDescription": "", - "URL": "", - "CopyrightDate": "", - "CopyrightName": "", - "LicenseName": "", - "LicenseDescription": "", - "Dependencies": [ - "cpl-core>=2022.10.0.post5" - ], - "DevDependencies": [ - "cpl-cli==2022.10.0" - ], - "PythonVersion": ">=3.10.4", - "PythonPath": {}, - "Classifiers": [] - }, - "BuildSettings": { - "ProjectType": "library", - "SourcePath": "", - "OutputPath": "../../dist", - "Main": "admin.main", - "EntryPoint": "admin", - "IncludePackageData": false, - "Included": [], - "Excluded": [ - "*/__pycache__", - "*/logs", - "*/tests" - ], - "PackageData": {}, - "ProjectReferences": [] - } -} \ No newline at end of file diff --git a/kdb-bot/src/modules/admin/admin_module.py b/kdb-bot/src/modules/admin/admin_module.py deleted file mode 100644 index 48f76afac3..0000000000 --- a/kdb-bot/src/modules/admin/admin_module.py +++ /dev/null @@ -1,24 +0,0 @@ -from cpl_core.configuration import ConfigurationABC -from cpl_core.dependency_injection import ServiceCollectionABC -from cpl_core.environment import ApplicationEnvironmentABC -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 modules.admin.command.restart_command import RestartCommand -from modules.admin.command.shutdown_command import ShutdownCommand - - -class AdminModule(ModuleABC): - - def __init__(self, dc: DiscordCollectionABC): - ModuleABC.__init__(self, dc, FeatureFlagsEnum.admin_module) - - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): - pass - - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): - # commands - self._dc.add_command(RestartCommand) - self._dc.add_command(ShutdownCommand) - # events diff --git a/kdb-bot/src/modules/admin/command/__init__.py b/kdb-bot/src/modules/admin/command/__init__.py deleted file mode 100644 index ed0cff3be5..0000000000 --- a/kdb-bot/src/modules/admin/command/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bot Keksdose bot -~~~~~~~~~~~~~~~~~~~ - -Discord bot for the Keksdose discord Server - -:copyright: (c) 2022 sh-edraft.de -:license: MIT, see LICENSE for more details. - -""" - -__title__ = 'modules.admin.command' -__author__ = 'Sven Heidemann' -__license__ = 'MIT' -__copyright__ = 'Copyright (c) 2022 sh-edraft.de' -__version__ = '0.3.dev25' - -from collections import namedtuple - - -# imports: - -VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='0', minor='3', micro='dev25') diff --git a/kdb-bot/src/modules/base/base_module.py b/kdb-bot/src/modules/base/base_module.py index 4ea1ed8506..4383e58aac 100644 --- a/kdb-bot/src/modules/base/base_module.py +++ b/kdb-bot/src/modules/base/base_module.py @@ -11,6 +11,10 @@ from modules.base.command.afk_command import AFKCommand from modules.base.command.help_command import HelpCommand from modules.base.command.info_command import InfoCommand from modules.base.command.ping_command import PingCommand +from modules.base.command.purge_command import PurgeCommand +from modules.base.command.restart_command import RestartCommand +from modules.base.command.shutdown_command import ShutdownCommand +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_member_join_event import BaseOnMemberJoinEvent @@ -35,6 +39,11 @@ class BaseModule(ModuleABC): self._dc.add_command(HelpCommand) self._dc.add_command(InfoCommand) self._dc.add_command(PingCommand) + + self._dc.add_command(RestartCommand) + self._dc.add_command(ShutdownCommand) + self._dc.add_command(PurgeCommand) + self._dc.add_command(UserGroup) # events self._dc.add_event(DiscordEventTypesEnum.on_command.value, BaseOnCommandEvent) self._dc.add_event(DiscordEventTypesEnum.on_command_error.value, BaseOnCommandErrorEvent) diff --git a/kdb-bot/src/modules/moderator/command/purge_command.py b/kdb-bot/src/modules/base/command/purge_command.py similarity index 100% rename from kdb-bot/src/modules/moderator/command/purge_command.py rename to kdb-bot/src/modules/base/command/purge_command.py diff --git a/kdb-bot/src/modules/admin/command/restart_command.py b/kdb-bot/src/modules/base/command/restart_command.py similarity index 100% rename from kdb-bot/src/modules/admin/command/restart_command.py rename to kdb-bot/src/modules/base/command/restart_command.py diff --git a/kdb-bot/src/modules/admin/command/shutdown_command.py b/kdb-bot/src/modules/base/command/shutdown_command.py similarity index 100% rename from kdb-bot/src/modules/admin/command/shutdown_command.py rename to kdb-bot/src/modules/base/command/shutdown_command.py diff --git a/kdb-bot/src/modules/moderator/command/user_group.py b/kdb-bot/src/modules/base/command/user_group.py similarity index 100% rename from kdb-bot/src/modules/moderator/command/user_group.py rename to kdb-bot/src/modules/base/command/user_group.py diff --git a/kdb-bot/src/modules/moderator/__init__.py b/kdb-bot/src/modules/moderator/__init__.py deleted file mode 100644 index ab63ed9f20..0000000000 --- a/kdb-bot/src/modules/moderator/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bot Keksdose bot -~~~~~~~~~~~~~~~~~~~ - -Discord bot for the Keksdose discord Server - -:copyright: (c) 2022 sh-edraft.de -:license: MIT, see LICENSE for more details. - -""" - -__title__ = 'modules.moderator' -__author__ = 'Sven Heidemann' -__license__ = 'MIT' -__copyright__ = 'Copyright (c) 2022 sh-edraft.de' -__version__ = '0.3.dev25' - -from collections import namedtuple - - -# imports: - -VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='0', minor='3', micro='dev25') diff --git a/kdb-bot/src/modules/moderator/command/__init__.py b/kdb-bot/src/modules/moderator/command/__init__.py deleted file mode 100644 index 68d0c50bf8..0000000000 --- a/kdb-bot/src/modules/moderator/command/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bot Keksdose bot -~~~~~~~~~~~~~~~~~~~ - -Discord bot for the Keksdose discord Server - -:copyright: (c) 2022 sh-edraft.de -:license: MIT, see LICENSE for more details. - -""" - -__title__ = 'modules.moderator.command' -__author__ = 'Sven Heidemann' -__license__ = 'MIT' -__copyright__ = 'Copyright (c) 2022 sh-edraft.de' -__version__ = '0.3.dev25' - -from collections import namedtuple - - -# imports: - -VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='0', minor='3', micro='dev25') diff --git a/kdb-bot/src/modules/moderator/moderator.json b/kdb-bot/src/modules/moderator/moderator.json deleted file mode 100644 index b92b06bc64..0000000000 --- a/kdb-bot/src/modules/moderator/moderator.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "ProjectSettings": { - "Name": "moderator", - "Version": { - "Major": "1", - "Minor": "0", - "Micro": "0" - }, - "Author": "", - "AuthorEmail": "", - "Description": "", - "LongDescription": "", - "URL": "", - "CopyrightDate": "", - "CopyrightName": "", - "LicenseName": "", - "LicenseDescription": "", - "Dependencies": [ - "cpl-core>=2022.10.0.post5" - ], - "DevDependencies": [ - "cpl-cli==2022.10.0" - ], - "PythonVersion": ">=3.10.4", - "PythonPath": {}, - "Classifiers": [] - }, - "BuildSettings": { - "ProjectType": "library", - "SourcePath": "", - "OutputPath": "../../dist", - "Main": "moderator.main", - "EntryPoint": "moderator", - "IncludePackageData": false, - "Included": [], - "Excluded": [ - "*/__pycache__", - "*/logs", - "*/tests" - ], - "PackageData": {}, - "ProjectReferences": [] - } -} \ No newline at end of file diff --git a/kdb-bot/src/modules/moderator/moderator_module.py b/kdb-bot/src/modules/moderator/moderator_module.py deleted file mode 100644 index 7df1865f98..0000000000 --- a/kdb-bot/src/modules/moderator/moderator_module.py +++ /dev/null @@ -1,24 +0,0 @@ -from cpl_core.configuration import ConfigurationABC -from cpl_core.dependency_injection import ServiceCollectionABC -from cpl_core.environment import ApplicationEnvironmentABC -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 modules.moderator.command.purge_command import PurgeCommand -from modules.moderator.command.user_group import UserGroup - - -class ModeratorModule(ModuleABC): - - def __init__(self, dc: DiscordCollectionABC): - ModuleABC.__init__(self, dc, FeatureFlagsEnum.moderator_module) - - def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): - pass - - def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): - # commands - self._dc.add_command(PurgeCommand) - self._dc.add_command(UserGroup) - # events From 9e937f17b71887c522b8565cae3f81abfb81fa03 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 8 Nov 2022 20:33:55 +0100 Subject: [PATCH 4/4] Fixed typo in translation... bruh #91 --- kdb-bot/src/bot/translation/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kdb-bot/src/bot/translation/de.json b/kdb-bot/src/bot/translation/de.json index ad81d3358d..4812a5c12f 100644 --- a/kdb-bot/src/bot/translation/de.json +++ b/kdb-bot/src/bot/translation/de.json @@ -177,7 +177,7 @@ "new_level_message": "<@{}> ist nun Level {}", "seeding_started": "Levelsystem wird neu geladen.", "seeding_failed": "Levelsystem konnte nicht neu geladen werden.", - "seeding_finished": "Levelsystem wurde Erfolgreich neu geladen.", + "seeding_finished": "Levelsystem wurde erfolgreich neu geladen.", "error": { "nothing_found": "Keine Level Einträge gefunden.", "level_with_name_already_exists": "Ein Level mit dem Namen {} existiert bereits!",