A-0.1 - Modularer Aufbau #13

Merged
edraft merged 118 commits from 0.1 into Alpha 2021-11-25 21:02:12 +01:00
Showing only changes of commit 4edda07cee - Show all commits

View File

@ -28,16 +28,16 @@ class MessageService(MessageServiceABC):
async def delete_message(self, message: discord.Message): async def delete_message(self, message: discord.Message):
server_st: ServerSettings = self._config.get_configuration(f'DSERVER_{message.guild.id}') server_st: ServerSettings = self._config.get_configuration(f'DSERVER_{message.guild.id}')
await asyncio.sleep(server_st.message_delete_timer) 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: try:
await message.delete() await message.delete()
except Exception as e: except Exception as e:
self._logger.error(__name__, f'Deleting message failed', e) self._logger.error(__name__, f'Deleting message failed', e)
else: 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): 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 msg = None
try: try:
msg = await channel.send(message) msg = await channel.send(message)
@ -48,7 +48,7 @@ class MessageService(MessageServiceABC):
await self.delete_message(msg) await self.delete_message(msg)
async def send_dm_message(self, message: str, receiver: Union[discord.User, discord.Member]): 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: try:
await receiver.send(message) await receiver.send(message)
except Exception as e: except Exception as e:
@ -62,7 +62,7 @@ class MessageService(MessageServiceABC):
self._logger.debug(__name__, f'Message: {message}') self._logger.debug(__name__, f'Message: {message}')
return 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 msg = None
try: try:
if isinstance(message, discord.File): if isinstance(message, discord.File):