Merge pull request '0.3 - user-info zu /user info konvertieren #61' (#68) from Ebola-Chan/kd_discord_bot:#61 into 0.3

Reviewed-on: sh-edraft.de/kd_discord_bot#68
Reviewed-by: Sven Heidemann <sven.heidemann@sh-edraft.de>
Closes #61
This commit is contained in:
Sven Heidemann 2022-10-13 16:33:17 +02:00
commit 30dbce3f4b
4 changed files with 97 additions and 6 deletions

View File

@ -17,7 +17,7 @@
"LicenseDescription": "MIT, see LICENSE for more details.", "LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [ "Dependencies": [
"cpl-core==2022.10.0.post6", "cpl-core==2022.10.0.post6",
"cpl-translation==2022.10.0", "cpl-translation==2022.10.0.post1",
"cpl-query==2022.10.0", "cpl-query==2022.10.0",
"cpl-discord==2022.10.0.post5" "cpl-discord==2022.10.0.post5"
], ],

View File

@ -0,0 +1,86 @@
{
"TimeFormatSettings": {
"DateFormat": "%Y-%m-%d",
"TimeFormat": "%H:%M:%S",
"DateTimeFormat": "%Y-%m-%d %H:%M:%S.%f",
"DateTimeLogFormat": "%Y-%m-%d_%H-%M-%S"
},
"LoggingSettings": {
"Path": "logs/",
"Filename": "bot.log",
"ConsoleLogLevel": "TRACE",
"FileLogLevel": "TRACE"
},
"BotLoggingSettings": {
"Command": {
"Path": "logs/",
"Filename": "commands.log",
"ConsoleLogLevel": "DEBUG",
"FileLogLevel": "TRACE"
},
"Database": {
"Path": "logs/",
"Filename": "database.log",
"ConsoleLogLevel": "DEBUG",
"FileLogLevel": "TRACE"
},
"Message": {
"Path": "logs/",
"Filename": "message.log",
"ConsoleLogLevel": "DEBUG",
"FileLogLevel": "TRACE"
}
},
"DatabaseSettings": {
"Host": "localhost",
"User": "root",
"Password": "MTAwNjE5OTdOaWNrLko=",
"Database": "kd_kdb",
"Charset": "utf8mb4",
"UseUnicode": "true",
"Buffered": "true",
"AuthPlugin": "mysql_native_password"
},
"DiscordBot": {
"Token": "MTAyOTgxMjE0Mjk4NTE5MTYxNA.G4ArAJ.sZh6pE-mwO2qDAr1mfHEoo7EwbJb-TZT8h6nGg",
"Prefix": "!kn "
},
"Bot": {
"910199451145076828": {
"MessageDeleteTimer": 2
},
"Technicians": [
240160344557879316
],
"WaitForRestart": 4,
"WaitForShutdown": 4
},
"Base": {
"910199451145076828": {
"MaxVoiceStateHours": 24,
"XpPerMessage": 2,
"XpPerOntimeHour": 4,
"AFKChannelIds": [
910199452915093593,
910199452915093594
],
"AFKCommandChannelId": 910199452915093594,
"HelpCommandReferenceUrl": "https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot/wiki/Befehle"
}
},
"BootLog": {
"910199451145076828": {
"LoginMessageChannelId": "910199452915093588"
}
},
"Permission": {
"910199451145076828": {
"AdminRoleIds": [
925072155203477584
],
"ModeratorRoleIds": [
925072209884635167
]
}
}
}

View File

@ -18,7 +18,7 @@ from bot_data.abc.user_repository_abc import UserRepositoryABC
from modules.permission.abc.permission_service_abc import PermissionServiceABC from modules.permission.abc.permission_service_abc import PermissionServiceABC
class UserInfoCommand(DiscordCommandABC): class UserGroup(DiscordCommandABC):
def __init__( def __init__(
self, self,
@ -50,9 +50,14 @@ class UserInfoCommand(DiscordCommandABC):
self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}') self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
@commands.hybrid_command(name='user-info') @commands.hybrid_group()
@commands.guild_only() @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}') 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): if not await self._client_utils.check_if_bot_is_ready_yet_and_respond(ctx):
return return

View File

@ -6,7 +6,7 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC
from bot_core.abc.module_abc import ModuleABC from bot_core.abc.module_abc import ModuleABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from modules.moderator.command.purge_command import PurgeCommand 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): class ModeratorModule(ModuleABC):
@ -20,5 +20,5 @@ class ModeratorModule(ModuleABC):
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
# commands # commands
self._dc.add_command(PurgeCommand) self._dc.add_command(PurgeCommand)
self._dc.add_command(UserInfoCommand) self._dc.add_command(UserGroup)
# events # events