Added ctrl+c support
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from cpl_core.application import ApplicationABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.console import Console
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
|
||||
from gismo_core.abc.bot_service_abc import BotServiceABC
|
||||
from gismo_core.service.bot_service import BotService
|
||||
|
||||
@@ -22,6 +22,15 @@ class Application(ApplicationABC):
|
||||
try:
|
||||
self._logger.trace(__name__, f'Try to start {BotService}')
|
||||
await self._bot.start_async()
|
||||
self._logger.trace(__name__, f'Stopped {BotService}')
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'Start failed', e)
|
||||
|
||||
async def stop_async(self):
|
||||
try:
|
||||
self._logger.trace(__name__, f'Try to stop {BotService}')
|
||||
await self._bot.close()
|
||||
self._logger.trace(__name__, f'Stopped {BotService}')
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, 'stop failed', e)
|
||||
|
||||
Console.write_line()
|
||||
|
Reference in New Issue
Block a user