Bugfixes for last changes

This commit is contained in:
Sven Heidemann 2022-01-08 19:35:14 +01:00
parent 26963b2bef
commit 558d134bd7
5 changed files with 8 additions and 7 deletions

View File

@ -3,6 +3,7 @@
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tools" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
<excludeFolder url="file://$MODULE_DIR$/src/gismo/logs" /> <excludeFolder url="file://$MODULE_DIR$/src/gismo/logs" />
<excludeFolder url="file://$MODULE_DIR$/.vscode" /> <excludeFolder url="file://$MODULE_DIR$/.vscode" />

View File

@ -106,7 +106,7 @@ class Startup(StartupABC):
provider: ServiceProviderABC = services.build_service_provider() provider: ServiceProviderABC = services.build_service_provider()
startup_init_time = round((datetime.now() - self._config.get_configuration('Startup_StartTime')).total_seconds(), 2) startup_init_time = round((datetime.now() - datetime.strptime(self._config.get_configuration('Startup_StartTime'), '%Y-%m-%d %H:%M:%S.%f')).total_seconds(), 2)
self._config.add_configuration('Startup_InitTime', str(startup_init_time)) self._config.add_configuration('Startup_InitTime', str(startup_init_time))
logger: LoggerABC = provider.get_service(LoggerABC) logger: LoggerABC = provider.get_service(LoggerABC)
logger.debug(__name__, f'Startup Init time: {startup_init_time}s') logger.debug(__name__, f'Startup Init time: {startup_init_time}s')

View File

@ -42,7 +42,7 @@ class MessageService(MessageServiceABC):
except Exception as e: except Exception as e:
self._logger.error(__name__, f'Deleting message failed', e) self._logger.error(__name__, f'Deleting message failed', e)
else: else:
self._clients.apppend_deleted_message_count(self._bot.user.id, guild_id, 1) self._clients.append_deleted_message_count(self._bot.user.id, guild_id, 1)
self._db.save_changes() self._db.save_changes()
self._logger.info(__name__, f'Deleted message {message}') self._logger.info(__name__, f'Deleted message {message}')
@ -55,7 +55,7 @@ class MessageService(MessageServiceABC):
self._logger.error(__name__, f'Send message to channel {channel.id} failed', e) self._logger.error(__name__, f'Send message to channel {channel.id} failed', e)
else: else:
self._logger.info(__name__, f'Sent message to channel {channel.id}') self._logger.info(__name__, f'Sent message to channel {channel.id}')
self._clients.apppend_sent_message_count(self._bot.user.id, channel.guild.id, 1) self._clients.append_sent_message_count(self._bot.user.id, channel.guild.id, 1)
self._db.save_changes() self._db.save_changes()
await self.delete_message(msg) await self.delete_message(msg)
@ -66,7 +66,7 @@ class MessageService(MessageServiceABC):
except Exception as e: except Exception as e:
self._logger.error(__name__, f'Send message to user {receiver.id} failed', e) self._logger.error(__name__, f'Send message to user {receiver.id} failed', e)
else: else:
self._clients.apppend_sent_message_count(self._bot.user.id, receiver.guild.id, 1) self._clients.append_sent_message_count(self._bot.user.id, receiver.guild.id, 1)
self._db.save_changes() self._db.save_changes()
self._logger.info(__name__, f'Sent message to user {receiver.id}') self._logger.info(__name__, f'Sent message to user {receiver.id}')
@ -87,6 +87,6 @@ class MessageService(MessageServiceABC):
self._logger.error(__name__, f'Send message to channel {ctx.channel.id} failed', e) self._logger.error(__name__, f'Send message to channel {ctx.channel.id} failed', e)
else: else:
self._logger.info(__name__, f'Sent message to channel {ctx.channel.id}') self._logger.info(__name__, f'Sent message to channel {ctx.channel.id}')
self._clients.apppend_sent_message_count(self._bot.user.id, ctx.guild.id, 1) self._clients.append_sent_message_count(self._bot.user.id, ctx.guild.id, 1)
self._db.save_changes() self._db.save_changes()
await self.delete_messages(List(discord.Message, [msg, ctx.message])) await self.delete_messages(List(discord.Message, [msg, ctx.message]))

View File

@ -41,7 +41,7 @@ class BootLog(ModuleABC, OnReadyABC):
self._logger.debug(__name__, f'Module {type(self)} started') self._logger.debug(__name__, f'Module {type(self)} started')
try: try:
start_time = self._config.get_configuration('Bot_StartTime') start_time = self._config.get_configuration('Bot_StartTime')
init_time = round((datetime.now() - start_time).total_seconds(), 2) init_time = round((datetime.now() - datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S.%f')).total_seconds(), 2)
self._config.add_configuration('InitTime', str(init_time)) self._config.add_configuration('InitTime', str(init_time))
self._logger.debug(__name__, f'Bot Init time: {init_time}s') self._logger.debug(__name__, f'Bot Init time: {init_time}s')
# print warning if initialisation took too long # print warning if initialisation took too long

View File

@ -63,7 +63,7 @@ class Database(ModuleABC, OnReadyABC):
def _validate_init_time(self): def _validate_init_time(self):
try: try:
start_time = self._config.get_configuration('Database_StartTime') start_time = self._config.get_configuration('Database_StartTime')
init_time = round((datetime.now() - start_time).total_seconds(), 2) init_time = round((datetime.now() - datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S.%f')).total_seconds(), 2)
self._config.add_configuration('Database_InitTime', str(init_time)) self._config.add_configuration('Database_InitTime', str(init_time))
self._logger.debug(__name__, f'Database Init time: {init_time}s') self._logger.debug(__name__, f'Database Init time: {init_time}s')
# print warning if initialisation took too long # print warning if initialisation took too long