Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: F821 undefined name errors in channels
yorkhellen47735896850c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d4aa658d4..256328de7 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -33,7 +33,7 @@ jobs:run: uv sync --all-extras- name: Lint with ruff- run: uv run ruff check nanobot+ run: uv run ruff check nanobot --select F- name: Run testsrun: uv run pytest tests/diff --git a/nanobot/channels/discord.py b/nanobot/channels/discord.pyindex 10d569692..0cdea15cf 100644--- a/nanobot/channels/discord.py+++ b/nanobot/channels/discord.py@@ -314,13 +314,15 @@ if DISCORD_AVAILABLE:reply_to: str | None,) -> tuple[discord.PartialMessage | None, discord.AllowedMentions]:"""Build reply context for outbound messages."""+ from loguru import logger+mention_settings = discord.AllowedMentions(replied_user=False)if not reply_to:return None, mention_settingstry:message_id = int(reply_to)except ValueError:- self._channel.logger.warning("Invalid reply target: {}", reply_to)+ logger.warning("Invalid reply target: {}", reply_to)return None, mention_settingsreturn channel.get_partial_message(message_id), mention_settingsdiff --git a/nanobot/channels/qq.py b/nanobot/channels/qq.pyindex 4ef63238c..701be8b68 100644--- a/nanobot/channels/qq.py+++ b/nanobot/channels/qq.py@@ -38,6 +38,7 @@ from nanobot.bus.events import OutboundMessagefrom nanobot.bus.queue import MessageBusfrom nanobot.channels.base import BaseChannelfrom nanobot.config.schema import Base+from nanobot.security.network import validate_url_targetfrom nanobot.utils.logging_bridge import redirect_lib_loggingtry:diff --git a/nanobot/channels/websocket.py b/nanobot/channels/websocket.pyindex 7d4d20625..487454c0d 100644--- a/nanobot/channels/websocket.py+++ b/nanobot/channels/websocket.py@@ -1104,6 +1104,8 @@ class WebSocketChannel(BaseChannel):Shape: ``list[{"data_url": str, "name"?: str | None}]``."""+ from loguru import logger+image_count = 0video_count = 0for item in media:@@ -1125,7 +1127,7 @@ class WebSocketChannel(BaseChannel):try:Path(p).unlink(missing_ok=True)except OSError as exc:- self.logger.warning(+ logger.warning("failed to unlink partial media {}: {}", p, exc)return [], reason@@ -1150,7 +1152,7 @@ class WebSocketChannel(BaseChannel):except FileSizeExceeded:return _abort("size")except Exception as exc:- self.logger.warning("media decode failed: {}", exc)+ logger.warning("media decode failed: {}", exc)return _abort("decode")if saved is None:return _abort("decode")