Improved bot startup logic
This commit is contained in:
@@ -20,8 +20,6 @@ __version__ = '0.1.0'
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
import nest_asyncio
|
||||
nest_asyncio.apply()
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='0', minor='1', micro='0')
|
||||
|
@@ -5,7 +5,6 @@ from cpl_core.logging import LoggerABC
|
||||
|
||||
from gismo_core.abc.bot_service_abc import BotServiceABC
|
||||
from gismo_core.service.bot_service import BotService
|
||||
from modules_core.abc.module_service_abc import ModuleServiceABC
|
||||
|
||||
|
||||
class Application(ApplicationABC):
|
||||
@@ -23,5 +22,6 @@ 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)
|
||||
|
@@ -18,6 +18,14 @@
|
||||
},
|
||||
|
||||
"Bot": {
|
||||
"Prefix": "!dev-g"
|
||||
"Prefix": "!dev-g",
|
||||
"Servers": [
|
||||
{
|
||||
"Id": "511824600884051979"
|
||||
},
|
||||
{
|
||||
"Id": "910199451145076828"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import asyncio
|
||||
|
||||
from cpl_core.application import ApplicationBuilder, ApplicationABC
|
||||
from cpl_core.application import ApplicationABC, ApplicationBuilder
|
||||
|
||||
from gismo.application import Application
|
||||
from gismo.startup import Startup
|
||||
@@ -14,7 +14,6 @@ async def main():
|
||||
app: ApplicationABC = await app_builder.build_async()
|
||||
await app.run_async()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ml = asyncio.get_event_loop()
|
||||
ml.run_until_complete(main())
|
||||
|
@@ -6,7 +6,7 @@ from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import (ServiceCollectionABC,
|
||||
ServiceProviderABC)
|
||||
from cpl_core.environment import ApplicationEnvironment
|
||||
from cpl_core.logging.logger_abc import LoggerABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
|
||||
from gismo_core.abc.bot_service_abc import BotServiceABC
|
||||
from gismo_core.service.bot_service import BotService
|
||||
|
Reference in New Issue
Block a user