Bugfixes for last changes
This commit is contained in:
parent
26963b2bef
commit
558d134bd7
@ -3,6 +3,7 @@
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<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$/src/gismo/logs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.vscode" />
|
||||
|
@ -106,7 +106,7 @@ class Startup(StartupABC):
|
||||
|
||||
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))
|
||||
logger: LoggerABC = provider.get_service(LoggerABC)
|
||||
logger.debug(__name__, f'Startup Init time: {startup_init_time}s')
|
||||
|
@ -42,7 +42,7 @@ class MessageService(MessageServiceABC):
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Deleting message failed', e)
|
||||
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._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)
|
||||
else:
|
||||
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()
|
||||
await self.delete_message(msg)
|
||||
|
||||
@ -66,7 +66,7 @@ class MessageService(MessageServiceABC):
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Send message to user {receiver.id} failed', e)
|
||||
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._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)
|
||||
else:
|
||||
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()
|
||||
await self.delete_messages(List(discord.Message, [msg, ctx.message]))
|
||||
|
@ -41,7 +41,7 @@ class BootLog(ModuleABC, OnReadyABC):
|
||||
self._logger.debug(__name__, f'Module {type(self)} started')
|
||||
try:
|
||||
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._logger.debug(__name__, f'Bot Init time: {init_time}s')
|
||||
# print warning if initialisation took too long
|
||||
|
@ -63,7 +63,7 @@ class Database(ModuleABC, OnReadyABC):
|
||||
def _validate_init_time(self):
|
||||
try:
|
||||
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._logger.debug(__name__, f'Database Init time: {init_time}s')
|
||||
# print warning if initialisation took too long
|
||||
|
Reference in New Issue
Block a user