From 227b1af9865e12e0a2c1d15f2c51bc732fb2bc7e Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Wed, 22 Mar 2023 22:05:17 +0100 Subject: [PATCH] Fix issue with private messages. --- fjerkroa_bot/discord_bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fjerkroa_bot/discord_bot.py b/fjerkroa_bot/discord_bot.py index 64d59bd..64b02a2 100644 --- a/fjerkroa_bot/discord_bot.py +++ b/fjerkroa_bot/discord_bot.py @@ -68,7 +68,11 @@ class FjerkroaBot(commands.Bot): await self.respond(msg, message.channel) async def respond(self, message: AIMessage, channel: TextChannel) -> None: - logging.info(f"handle message {str(message)} for channel {channel.name}") + try: + channel_name = channel.name + except Exception: + channel_name = str(channel.id) + logging.info(f"handle message {str(message)} for channel {channel_name}") async with channel.typing(): response = await self.airesponder.send(message) if response.hack: