Fixed some on member join stuff

This commit is contained in:
Sven Heidemann 2022-11-18 14:33:54 +01:00
parent f5a71a8450
commit 9b5033b80e
3 changed files with 27 additions and 2 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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)