Compare commits

..

2 Commits

Author SHA1 Message Date
9ed66c2560 Merge branch '0.3' of https://git.sh-edraft.de/sh-edraft.de/kd_discord_bot into 0.3
 Conflicts:
	kdb-bot/src/modules/technician/command/log_command.py
2022-11-18 15:39:36 +01:00
6e6157ccf2 Fixed log command 2022-11-18 15:34:25 +01:00

View File

@ -1,10 +1,12 @@
import os
from datetime import datetime
from string import Template
from zipfile import ZipFile
import discord
from cpl_core.dependency_injection import ServiceProviderABC
from cpl_core.environment import ApplicationEnvironmentABC
from cpl_core.logging import LoggingSettings
from cpl_core.time import TimeFormatSettings
from cpl_discord.command import DiscordCommandABC
from cpl_query.extension import List
from cpl_translation import TranslatePipe
@ -30,6 +32,8 @@ class LogCommand(DiscordCommandABC):
client_utils: ClientUtilsServiceABC,
translate: TranslatePipe,
permissions: PermissionServiceABC,
time_format: TimeFormatSettings,
env: ApplicationEnvironmentABC
):
DiscordCommandABC.__init__(self)
@ -41,10 +45,14 @@ class LogCommand(DiscordCommandABC):
self._t = translate
self._permissions = permissions
self._env = env
self._log_settings: LoggingSettings = logging_settings
self._time_format_settings: TimeFormatSettings = time_format
self._logger.trace(__name__, f'Loaded command service: {type(self).__name__}')
def _reduce_path(self, p: str) -> str:
if p.startswith('/') and not p.endswith('/') or p.endswith('/') or p == '':
if len(p.split('/')) == 1 or p == '':
return p
return self._reduce_path(os.path.dirname(p))