diff --git a/nanobot/channels/discord.py b/nanobot/channels/discord.py index 1d3ddb6f8..6e6a4d9d2 100644 --- a/nanobot/channels/discord.py +++ b/nanobot/channels/discord.py @@ -10,7 +10,6 @@ from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Any, Literal -from loguru import logger from pydantic import Field from nanobot.bus.events import OutboundMessage @@ -309,8 +308,8 @@ if DISCORD_AVAILABLE: fallback = "\n".join(f"[attachment: {name} - send failed]" for name in failed_media) return split_message(fallback, MAX_MESSAGE_LEN) - @staticmethod def _build_reply_context( + self, channel: Messageable, reply_to: str | None, ) -> tuple[discord.PartialMessage | None, discord.AllowedMentions]: @@ -321,7 +320,7 @@ if DISCORD_AVAILABLE: try: message_id = int(reply_to) except ValueError: - logger.warning("Invalid reply target: {}", reply_to) + self._channel.logger.warning("Invalid reply target: {}", reply_to) return None, mention_settings return channel.get_partial_message(message_id), mention_settings diff --git a/nanobot/channels/websocket.py b/nanobot/channels/websocket.py index 39d953894..459276501 100644 --- a/nanobot/channels/websocket.py +++ b/nanobot/channels/websocket.py @@ -1089,8 +1089,8 @@ class WebSocketChannel(BaseChannel): finally: self._cleanup_connection(connection) - @staticmethod def _save_envelope_media( + self, media: list[Any], ) -> tuple[list[str], str | None]: """Decode and persist ``media`` items from a ``message`` envelope. @@ -1125,7 +1125,7 @@ class WebSocketChannel(BaseChannel): try: Path(p).unlink(missing_ok=True) except OSError as exc: - logger.warning( + self.logger.warning( "failed to unlink partial media {}: {}", p, exc ) return [], reason @@ -1150,7 +1150,7 @@ class WebSocketChannel(BaseChannel): except FileSizeExceeded: return _abort("size") except Exception as exc: - logger.warning("media decode failed: {}", exc) + self.logger.warning("media decode failed: {}", exc) return _abort("decode") if saved is None: return _abort("decode")