diff --git a/kdb-bot/src/bot/module_list.py b/kdb-bot/src/bot/module_list.py index cde01cee..ba6be127 100644 --- a/kdb-bot/src/bot/module_list.py +++ b/kdb-bot/src/bot/module_list.py @@ -22,11 +22,11 @@ class ModuleList: return List(type, [ CoreModule, # has to be first! DataModule, + PermissionModule, + DatabaseModule, AutoRoleModule, BaseModule, - DatabaseModule, LevelModule, - PermissionModule, ApiModule, StatsModule, TechnicianModule, diff --git a/kdb-bot/src/modules/level/events/level_on_member_join_event.py b/kdb-bot/src/modules/level/events/level_on_member_join_event.py new file mode 100644 index 00000000..c8ce80cc --- /dev/null +++ b/kdb-bot/src/modules/level/events/level_on_member_join_event.py @@ -0,0 +1,23 @@ +import discord +from cpl_discord.events import OnMemberJoinABC + +from bot_core.helper.event_checks import EventChecks +from bot_core.logging.message_logger import MessageLogger +from modules.level.service.level_service import LevelService + + +class LevelOnMemberJoinEvent(OnMemberJoinABC): + + def __init__( + self, + logger: MessageLogger, + level: LevelService + ): + OnMemberJoinABC.__init__(self) + self._logger = logger + self._level = level + + @EventChecks.check_is_ready() + async def on_member_join(self, member: discord.Member): + self._logger.debug(__name__, f'Module {type(self)} started') + await self._level.check_level(member) diff --git a/kdb-bot/src/modules/level/level_module.py b/kdb-bot/src/modules/level/level_module.py index aeb57409..3502abad 100644 --- a/kdb-bot/src/modules/level/level_module.py +++ b/kdb-bot/src/modules/level/level_module.py @@ -9,6 +9,7 @@ from cpl_discord.service.discord_collection_abc import DiscordCollectionABC from bot_core.abc.module_abc import ModuleABC from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum from modules.level.command.level_group import LevelGroup +from modules.level.events.level_on_member_join_event import LevelOnMemberJoinEvent from modules.level.events.level_on_message_event import LevelOnMessageEvent from modules.level.events.level_on_voice_state_update_event import LevelOnVoiceStateUpdateEvent from modules.level.level_seeder import LevelSeeder @@ -36,3 +37,4 @@ class LevelModule(ModuleABC): # events self._dc.add_event(DiscordEventTypesEnum.on_message.value, LevelOnMessageEvent) self._dc.add_event(DiscordEventTypesEnum.on_voice_state_update.value, LevelOnVoiceStateUpdateEvent) + self._dc.add_event(DiscordEventTypesEnum.on_member_join.value, LevelOnMemberJoinEvent)