From 0c71e4934e63d8cdb5a98447255acfa585eceeb3 Mon Sep 17 00:00:00 2001 From: Nick Jungmann Date: Wed, 12 Oct 2022 20:42:40 +0200 Subject: [PATCH] Renamed user-info and added it to user group #61 --- src/bot/bot.json | 2 +- src/bot/config/appsettings.PC-Nick.json | 86 +++++++++++++++++++ .../{user_info_command.py => user_group.py} | 11 ++- src/modules/moderator/moderator_module.py | 4 +- 4 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 src/bot/config/appsettings.PC-Nick.json rename src/modules/moderator/command/{user_info_command.py => user_group.py} (94%) diff --git a/src/bot/bot.json b/src/bot/bot.json index 11f9a61edc..8bbcdf43bb 100644 --- a/src/bot/bot.json +++ b/src/bot/bot.json @@ -17,7 +17,7 @@ "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ "cpl-core==2022.10.0.post6", - "cpl-translation==2022.10.0", + "cpl-translation==2022.10.0.post1", "cpl-query==2022.10.0", "cpl-discord==2022.10.0.post5" ], diff --git a/src/bot/config/appsettings.PC-Nick.json b/src/bot/config/appsettings.PC-Nick.json new file mode 100644 index 0000000000..d296c19c2a --- /dev/null +++ b/src/bot/config/appsettings.PC-Nick.json @@ -0,0 +1,86 @@ +{ + "TimeFormatSettings": { + "DateFormat": "%Y-%m-%d", + "TimeFormat": "%H:%M:%S", + "DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f", + "DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S" + }, + "LoggingSettings": { + "Path": "logs/", + "Filename": "bot.log", + "ConsoleLogLevel": "TRACE", + "FileLogLevel": "TRACE" + }, + "BotLoggingSettings": { + "Command": { + "Path": "logs/", + "Filename": "commands.log", + "ConsoleLogLevel": "DEBUG", + "FileLogLevel": "TRACE" + }, + "Database": { + "Path": "logs/", + "Filename": "database.log", + "ConsoleLogLevel": "DEBUG", + "FileLogLevel": "TRACE" + }, + "Message": { + "Path": "logs/", + "Filename": "message.log", + "ConsoleLogLevel": "DEBUG", + "FileLogLevel": "TRACE" + } + }, + "DatabaseSettings": { + "Host": "localhost", + "User": "root", + "Password": "MTAwNjE5OTdOaWNrLko=", + "Database": "kd_kdb", + "Charset": "utf8mb4", + "UseUnicode": "true", + "Buffered": "true", + "AuthPlugin": "mysql_native_password" + }, + "DiscordBot": { + "Token": "MTAyOTgxMjE0Mjk4NTE5MTYxNA.G4ArAJ.sZh6pE-mwO2qDAr1mfHEoo7EwbJb-TZT8h6nGg", + "Prefix": "!kn " + }, + "Bot": { + "910199451145076828": { + "MessageDeleteTimer": 2 + }, + "Technicians": [ + 240160344557879316 + ], + "WaitForRestart": 4, + "WaitForShutdown": 4 + }, + "Base": { + "910199451145076828": { + "MaxVoiceStateHours": 24, + "XpPerMessage": 2, + "XpPerOntimeHour": 4, + "AFKChannelIds": [ + 910199452915093593, + 910199452915093594 + ], + "AFKCommandChannelId": 910199452915093594, + "HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle" + } + }, + "BootLog": { + "910199451145076828": { + "LoginMessageChannelId": "910199452915093588" + } + }, + "Permission": { + "910199451145076828": { + "AdminRoleIds": [ + 925072155203477584 + ], + "ModeratorRoleIds": [ + 925072209884635167 + ] + } + } +} diff --git a/src/modules/moderator/command/user_info_command.py b/src/modules/moderator/command/user_group.py similarity index 94% rename from src/modules/moderator/command/user_info_command.py rename to src/modules/moderator/command/user_group.py index c83547ca13..1988902be4 100644 --- a/src/modules/moderator/command/user_info_command.py +++ b/src/modules/moderator/command/user_group.py @@ -18,7 +18,7 @@ from bot_data.abc.user_repository_abc import UserRepositoryABC from modules.permission.abc.permission_service_abc import PermissionServiceABC -class UserInfoCommand(DiscordCommandABC): +class UserGroup(DiscordCommandABC): def __init__( self, @@ -50,9 +50,14 @@ class UserInfoCommand(DiscordCommandABC): self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}') - @commands.hybrid_command(name='user-info') + @commands.hybrid_group() @commands.guild_only() - async def user_info(self, ctx: Context, member: Optional[discord.Member] = None, *, wait: int = None): + async def user(self, ctx: Context): + pass + + @user.command() + @commands.guild_only() + async def info(self, ctx: Context, member: Optional[discord.Member] = None, *, wait: int = None): self._logger.debug(__name__, f'Received command user-info {ctx}:{member},{wait}') if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx): return diff --git a/src/modules/moderator/moderator_module.py b/src/modules/moderator/moderator_module.py index c981fc2d91..7df1865f98 100644 --- a/src/modules/moderator/moderator_module.py +++ b/src/modules/moderator/moderator_module.py @@ -6,7 +6,7 @@ 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_info_command import UserInfoCommand +from modules.moderator.command.user_group import UserGroup class ModeratorModule(ModuleABC): @@ -20,5 +20,5 @@ class ModeratorModule(ModuleABC): def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): # commands self._dc.add_command(PurgeCommand) - self._dc.add_command(UserInfoCommand) + self._dc.add_command(UserGroup) # events