diff --git a/kdb-bot/src/modules/base/helper/base_reaction_handler.py b/kdb-bot/src/modules/base/helper/base_reaction_handler.py index eb75a54a..a5fd0099 100644 --- a/kdb-bot/src/modules/base/helper/base_reaction_handler.py +++ b/kdb-bot/src/modules/base/helper/base_reaction_handler.py @@ -3,6 +3,7 @@ from cpl_core.logging import LoggerABC from cpl_discord.service import DiscordBotServiceABC from discord import RawReactionActionEvent +from bot_core.helper.log_message_helper import LogMessageHelper from bot_data.abc.server_repository_abc import ServerRepositoryABC from bot_data.abc.user_repository_abc import UserRepositoryABC from modules.base.abc.base_helper_abc import BaseHelperABC @@ -36,6 +37,20 @@ class BaseReactionHandler: self._logger.warn(__name__, f'User {payload.user_id} in {guild.name} not found - skipping') return + try: + log_msg = f'{member.name} reacted' + if payload.emoji.name is not None: + log_msg += f' with {payload.emoji.name}' + try: + channel = guild.get_channel(payload.channel_id) + message = await channel.fetch_message(payload.message_id) + self._logger.info(__name__, f'{log_msg} to message {LogMessageHelper.get_log_string(message)}') + except Exception as e: + self._logger.error(__name__, f'Getting message for reaction logging failed', e) + self._logger.info(__name__, f'{log_msg} to message {payload.message_id}') + except Exception as e: + self._logger.error(__name__, f'Reaction logging failed', e) + if member.bot: return