0.3.1 #187

Merged
edraft merged 46 commits from 0.3.1 into master 2023-01-14 10:39:27 +01:00
Showing only changes of commit d10c33c6c2 - Show all commits

View File

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