A-0.3 - Basismodul #36
@ -10,7 +10,8 @@
|
||||
"boot-log": "src/modules/boot_log/boot-log.json",
|
||||
"level-generator": "tools/level_generator/level-generator.json",
|
||||
"ontime-calculator": "tools/ontime_calculator/ontime-calculator.json",
|
||||
"database": "src/modules/database/database.json"
|
||||
"database": "src/modules/database/database.json",
|
||||
"base": "src/modules/base/base.json"
|
||||
},
|
||||
"Scripts": {
|
||||
"build-start": "cd src/gismo_cli; echo 'gismo-cli:'; cpl build; cd ../gismo; echo 'gismo:'; cpl build; cd ../../dist/gismo/build/gismo; bash gismo",
|
||||
|
@ -18,6 +18,7 @@ from gismo_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from gismo_data.db_context import DBContext
|
||||
from gismo_data.service.server_repository_service import ServerRepositoryService
|
||||
from gismo_data.service.user_repository_service import UserRepositoryService
|
||||
from modules.base.base import Base
|
||||
from modules.boot_log.boot_log import BootLog
|
||||
from modules.database.database import Database
|
||||
from modules_core.abc.module_abc import ModuleABC
|
||||
@ -59,6 +60,7 @@ class Startup(StartupABC):
|
||||
services.add_transient(UserRepositoryABC, UserRepositoryService)
|
||||
|
||||
services.add_transient(ModuleABC, Database)
|
||||
services.add_transient(ModuleABC, Base)
|
||||
services.add_transient(ModuleABC, BootLog)
|
||||
|
||||
provider: ServiceProviderABC = services.build_service_provider()
|
||||
|
1
src/modules/base/__init__.py
Normal file
1
src/modules/base/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# imports:
|
43
src/modules/base/base.json
Normal file
43
src/modules/base/base.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"ProjectSettings": {
|
||||
"Name": "modules/base",
|
||||
"Version": {
|
||||
"Major": "0",
|
||||
"Minor": "0",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
"AuthorEmail": "",
|
||||
"Description": "",
|
||||
"LongDescription": "",
|
||||
"URL": "",
|
||||
"CopyrightDate": "",
|
||||
"CopyrightName": "",
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"sh_cpl-core>=2021.11.0.post1"
|
||||
],
|
||||
"PythonVersion": ">=3.9.2",
|
||||
"PythonPath": {
|
||||
"linux": ""
|
||||
},
|
||||
"Classifiers": []
|
||||
},
|
||||
"BuildSettings": {
|
||||
"ProjectType": "library",
|
||||
"SourcePath": "",
|
||||
"OutputPath": "../../dist",
|
||||
"Main": "modules/base.main",
|
||||
"EntryPoint": "modules/base",
|
||||
"IncludePackageData": false,
|
||||
"Included": [],
|
||||
"Excluded": [
|
||||
"*/__pycache__",
|
||||
"*/logs",
|
||||
"*/tests"
|
||||
],
|
||||
"PackageData": {},
|
||||
"ProjectReferences": []
|
||||
}
|
||||
}
|
29
src/modules/base/base.py
Normal file
29
src/modules/base/base.py
Normal file
@ -0,0 +1,29 @@
|
||||
import discord
|
||||
from cpl_core.logging.logger_abc import LoggerABC
|
||||
|
||||
from modules_core.abc.events.on_member_join_abc import OnMemberJoinABC
|
||||
from modules_core.abc.events.on_message_abc import OnMessageABC
|
||||
from modules_core.abc.events.on_voice_state_update_abc import OnVoiceStateUpdateABC
|
||||
from modules_core.abc.module_abc import ModuleABC
|
||||
|
||||
|
||||
class Base(ModuleABC, OnMemberJoinABC, OnMessageABC, OnVoiceStateUpdateABC):
|
||||
|
||||
def __init__(self, logger: LoggerABC):
|
||||
|
||||
self._logger = logger
|
||||
|
||||
ModuleABC.__init__(self)
|
||||
self._priorities[OnMemberJoinABC] = 1
|
||||
self._priorities[OnMessageABC] = 30
|
||||
self._priorities[OnVoiceStateUpdateABC] = 10
|
||||
self._logger.trace(__name__, f'Module {type(self)} loaded')
|
||||
|
||||
async def on_member_join(self, member: discord.Member):
|
||||
self._logger.debug(__name__, f'Module {type(self)} started')
|
||||
|
||||
async def on_message(self, message: discord.Message):
|
||||
self._logger.debug(__name__, f'Module {type(self)} started')
|
||||
|
||||
async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState):
|
||||
self._logger.debug(__name__, f'Module {type(self)} started')
|
Reference in New Issue
Block a user