0.3 #146

Merged
edraft merged 359 commits from 0.3 into master 2023-01-12 07:04:40 +01:00
8 changed files with 16 additions and 0 deletions
Showing only changes of commit 5cdf2834cc - Show all commits

View File

@ -3,6 +3,7 @@ from cpl_discord.events.on_raw_reaction_add_abc import OnRawReactionAddABC
from cpl_discord.service import DiscordBotServiceABC
from discord import RawReactionActionEvent
from bot_core.helper.event_checks import EventChecks
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from modules.auto_role.helper.reaction_handler import ReactionHandler
@ -26,6 +27,7 @@ class AutoRoleOnRawReactionAddEvent(OnRawReactionAddABC):
self._auto_roles = auto_roles
self._reaction_handler = reaction_handler
@EventChecks.check_is_ready()
async def on_raw_reaction_add(self, payload: RawReactionActionEvent):
self._logger.debug(__name__, f'Module {type(self)} started')

View File

@ -3,6 +3,7 @@ from cpl_discord.events.on_raw_reaction_remove_abc import OnRawReactionRemoveABC
from cpl_discord.service import DiscordBotServiceABC
from discord import RawReactionActionEvent
from bot_core.helper.event_checks import EventChecks
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from modules.auto_role.helper.reaction_handler import ReactionHandler
@ -26,6 +27,7 @@ class AutoRoleOnRawReactionRemoveEvent(OnRawReactionRemoveABC):
self._auto_roles = auto_roles
self._reaction_handler = reaction_handler
@EventChecks.check_is_ready()
async def on_raw_reaction_remove(self, payload: RawReactionActionEvent):
self._logger.debug(__name__, f'Module {type(self)} started')

View File

@ -9,6 +9,7 @@ from cpl_discord.events import OnMemberJoinABC
from cpl_translation import TranslatePipe
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.helper.event_checks import EventChecks
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
@ -91,6 +92,7 @@ class BaseOnMemberJoinEvent(OnMemberJoinABC):
except Exception as e:
self._logger.error(__name__, f'Cannot get user {member.id}', e)
@EventChecks.check_is_ready()
async def on_member_join(self, member: discord.Member):
self._logger.debug(__name__, f'Module {type(self)} started')
self._check_for_known_user(member)

View File

@ -8,6 +8,7 @@ from cpl_discord.events import OnMemberRemoveABC
from cpl_translation import TranslatePipe
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.helper.event_checks import EventChecks
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
@ -59,6 +60,7 @@ class BaseOnMemberRemoveEvent(OnMemberRemoveABC):
except Exception as e:
self._logger.error(__name__, f'Cannot get user {member.id}', e)
@EventChecks.check_is_ready()
async def on_member_remove(self, member: discord.Member):
self._logger.debug(__name__, f'Module {type(self)} started')
await self._remove_user(member)

View File

@ -5,6 +5,7 @@ from cpl_core.database.context import DatabaseContextABC
from cpl_discord.events import OnMessageABC
from cpl_discord.service import DiscordBotServiceABC
from bot_core.helper.event_checks import EventChecks
from bot_core.helper.log_message_helper import LogMessageHelper
from bot_core.logging.message_logger import MessageLogger
from bot_data.abc.client_repository_abc import ClientRepositoryABC
@ -70,6 +71,7 @@ class BaseOnMessageEvent(OnMessageABC):
self._logger.debug(__name__, f'User {user} sent message. xp: from {old_xp} to {user.xp}')
@EventChecks.check_is_ready()
async def on_message(self, message: discord.Message):
self._logger.debug(__name__, f'Module {type(self)} started')
self._logger.info(__name__, f'Received message: {LogMessageHelper.get_log_string(message)}')

View File

@ -7,6 +7,7 @@ from cpl_core.database.context import DatabaseContextABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnVoiceStateUpdateABC
from bot_core.helper.event_checks import EventChecks
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
@ -83,6 +84,7 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
except Exception as e:
self._logger.error(__name__, f'Ontime validation failed', e)
@EventChecks.check_is_ready()
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')
self._logger.trace(__name__, f'Detected on_voice_state_update {member.id} from {before} to {after}')

View File

@ -1,6 +1,7 @@
import discord
from cpl_discord.events import OnMessageABC
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.message_logger import MessageLogger
from modules.level.service.level_service import LevelService
@ -16,6 +17,7 @@ class LevelOnMessageEvent(OnMessageABC):
self._logger = logger
self._level = level
@EventChecks.check_is_ready()
async def on_message(self, message: discord.Message):
self._logger.debug(__name__, f'Module {type(self)} started')
await self._level.check_level(message.author)

View File

@ -2,6 +2,7 @@ import discord
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnVoiceStateUpdateABC
from bot_core.helper.event_checks import EventChecks
from modules.level.service.level_service import LevelService
@ -18,6 +19,7 @@ class LevelOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
self._logger.info(__name__, f'Module {type(self)} loaded')
@EventChecks.check_is_ready()
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')
await self._level.check_level(member)