Updated discord test app #143

This commit is contained in:
Sven Heidemann 2022-12-08 11:02:54 +01:00
parent 2f8dc63cdc
commit 604bb8f55c
6 changed files with 65 additions and 12 deletions

View File

@ -1 +1,26 @@
# -*- coding: utf-8 -*-
"""
discord-bot
~~~~~~~~~~~~~~~~~~~
:copyright: (c)
:license:
"""
__title__ = 'discord_bot'
__author__ = ''
__license__ = ''
__copyright__ = 'Copyright (c) '
__version__ = '0.0.0'
from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='0', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.7.0" "cpl-core==2022.12.0"
], ],
"DevDependencies": [ "DevDependencies": [
"cpl-cli>=2022.7.0" "cpl-cli==2022.12.0"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": {}, "PythonPath": {},
@ -39,6 +39,8 @@
"*/tests" "*/tests"
], ],
"PackageData": {}, "PackageData": {},
"ProjectReferences": [] "ProjectReferences": [
"../modules/hello_world/hello-world.json"
]
} }
} }

View File

@ -7,7 +7,7 @@ from discord_bot.application import Application
from discord_bot.startup import Startup from discord_bot.startup import Startup
class Main: class Program:
def __init__(self): def __init__(self):
self._app: Optional[Application] = None self._app: Optional[Application] = None
@ -23,8 +23,8 @@ class Main:
if __name__ == '__main__': if __name__ == '__main__':
main = Main() program = Program()
try: try:
asyncio.run(main.main()) asyncio.run(program.main())
except KeyboardInterrupt: except KeyboardInterrupt:
asyncio.run(main.stop()) asyncio.run(program.stop())

View File

@ -1,5 +1,6 @@
from cpl_core.application import StartupABC from cpl_core.application import StartupABC
from cpl_core.configuration import ConfigurationABC from cpl_core.configuration import ConfigurationABC
from cpl_core.console import Console
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
from cpl_core.environment import ApplicationEnvironment from cpl_core.environment import ApplicationEnvironment
from cpl_discord import get_discord_collection from cpl_discord import get_discord_collection
@ -16,7 +17,7 @@ class Startup(StartupABC):
StartupABC.__init__(self) StartupABC.__init__(self)
def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC:
configuration.add_json_file('appsettings.json', optional=True) configuration.add_json_file('appsettings.json', optional=False)
configuration.add_environment_variables('CPL_') configuration.add_environment_variables('CPL_')
configuration.add_environment_variables('DISCORD_') configuration.add_environment_variables('DISCORD_')

View File

@ -1 +1,26 @@
# -*- coding: utf-8 -*-
"""
discord-bot
~~~~~~~~~~~~~~~~~~~
:copyright: (c)
:license:
"""
__title__ = 'modules.hello_world'
__author__ = ''
__license__ = ''
__copyright__ = 'Copyright (c) '
__version__ = '0.0.0'
from collections import namedtuple
# imports: # imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='0', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.7.0" "cpl-core==2022.12.0"
], ],
"DevDependencies": [ "DevDependencies": [
"cpl-cli>=2022.7.0.post1" "cpl-cli==2022.12.0"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": {}, "PythonPath": {},
@ -29,8 +29,8 @@
"ProjectType": "library", "ProjectType": "library",
"SourcePath": "", "SourcePath": "",
"OutputPath": "../../dist", "OutputPath": "../../dist",
"Main": "hello_world.main", "Main": "",
"EntryPoint": "hello-world", "EntryPoint": "",
"IncludePackageData": false, "IncludePackageData": false,
"Included": [], "Included": [],
"Excluded": [ "Excluded": [