Improved logging
This commit is contained in:
parent
e951baa358
commit
4edda07cee
@ -28,16 +28,16 @@ class MessageService(MessageServiceABC):
|
||||
async def delete_message(self, message: discord.Message):
|
||||
server_st: ServerSettings = self._config.get_configuration(f'DSERVER_{message.guild.id}')
|
||||
await asyncio.sleep(server_st.message_delete_timer)
|
||||
self._logger.debug(__name__, f'Try to delete message: {message.content}')
|
||||
self._logger.debug(__name__, f'Try to delete message:\n\t{message}\n\t{message.content}')
|
||||
try:
|
||||
await message.delete()
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Deleting message failed', e)
|
||||
else:
|
||||
self._logger.info(__name__, f'Deleted message {message.content}')
|
||||
self._logger.info(__name__, f'Deleted message {message}')
|
||||
|
||||
async def send_channel_message(self, channel: discord.TextChannel, message: str):
|
||||
self._logger.debug(__name__, f'Try to send message {message} to channel {channel.id}')
|
||||
self._logger.debug(__name__, f'Try to send message\n\t{message}\n\tto: {channel}')
|
||||
msg = None
|
||||
try:
|
||||
msg = await channel.send(message)
|
||||
@ -48,7 +48,7 @@ class MessageService(MessageServiceABC):
|
||||
await self.delete_message(msg)
|
||||
|
||||
async def send_dm_message(self, message: str, receiver: Union[discord.User, discord.Member]):
|
||||
self._logger.debug(__name__, f'Try to send message {message} to user {receiver.id}')
|
||||
self._logger.debug(__name__, f'Try to send message\n\t{message}\n\tto: {receiver}')
|
||||
try:
|
||||
await receiver.send(message)
|
||||
except Exception as e:
|
||||
@ -62,7 +62,7 @@ class MessageService(MessageServiceABC):
|
||||
self._logger.debug(__name__, f'Message: {message}')
|
||||
return
|
||||
|
||||
self._logger.debug(__name__, f'Try to send message {message} to channel {ctx.channel.id}')
|
||||
self._logger.debug(__name__, f'Try to send message\t\t{message}\n\tto: {ctx.channel}')
|
||||
msg = None
|
||||
try:
|
||||
if isinstance(message, discord.File):
|
||||
|
Reference in New Issue
Block a user