From b477a35a010559f746c2567b4e2cb42bb83e5480 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 17:09:18 +0000 Subject: [PATCH 1/4] :balloon: pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.9.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.9...v0.9.10) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ecab6bd2..2c38647e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: autoupdate_commit_msg: ":balloon: pre-commit autoupdate" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.9 + rev: v0.9.10 hooks: - id: ruff - id: ruff-format From 02368954a0d2dc913179413dd4a1ee94e6ad8cf0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 17:09:24 +0000 Subject: [PATCH 2/4] :balloon: auto fixes by pre-commit hooks --- astrbot/core/pipeline/whitelist_check/stage.py | 5 ++++- packages/astrbot/main.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/astrbot/core/pipeline/whitelist_check/stage.py b/astrbot/core/pipeline/whitelist_check/stage.py index cff215dac..85f911a60 100644 --- a/astrbot/core/pipeline/whitelist_check/stage.py +++ b/astrbot/core/pipeline/whitelist_check/stage.py @@ -51,7 +51,10 @@ class WhitelistCheckStage(Stage): and event.get_message_type() == MessageType.FRIEND_MESSAGE ): return - if event.unified_msg_origin not in self.whitelist and event.get_group_id() not in self.whitelist: + if ( + event.unified_msg_origin not in self.whitelist + and event.get_group_id() not in self.whitelist + ): if self.wl_log: logger.info( f"会话 ID {event.unified_msg_origin} 不在会话白名单中,已终止事件传播。请在配置文件中添加该会话 ID 到白名单。" diff --git a/packages/astrbot/main.py b/packages/astrbot/main.py index 93e370e39..9549fcd38 100644 --- a/packages/astrbot/main.py +++ b/packages/astrbot/main.py @@ -268,7 +268,10 @@ class Main(star.Star): UID: {user_id} 此 ID 可用于设置管理员。 /op 授权管理员, /deop 取消管理员。""" - if self.context.get_config()["platform_settings"]["unique_session"] and event.get_group_id(): + if ( + self.context.get_config()["platform_settings"]["unique_session"] + and event.get_group_id() + ): ret += f"\n\n当前处于独立会话模式, 此群 ID: {event.get_group_id()}, 也可将此 ID 加入白名单来放行整个群聊。" event.set_result(MessageEventResult().message(ret).use_t2i(False)) From 8b247054bb9aeef29a69390deb6583e5b429014f Mon Sep 17 00:00:00 2001 From: roeseth Date: Mon, 10 Mar 2025 19:07:45 -0700 Subject: [PATCH 3/4] update compose.yml to mount system time and tz --- compose.yml | 2 ++ packages/astrbot/main.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compose.yml b/compose.yml index 75380370c..805d30c11 100644 --- a/compose.yml +++ b/compose.yml @@ -12,3 +12,5 @@ services: - "11451:11451" # optional, gewechat default port volumes: - ./data:/AstrBot/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro diff --git a/packages/astrbot/main.py b/packages/astrbot/main.py index 93e370e39..415e58f02 100644 --- a/packages/astrbot/main.py +++ b/packages/astrbot/main.py @@ -1098,8 +1098,9 @@ UID: {user_id} 此 ID 可用于设置管理员。 req.prompt = user_info + req.prompt if self.enable_datetime: + # Including timezone current_time = ( - datetime.datetime.now().astimezone().strftime("%Y-%m-%d %H:%M") + datetime.datetime.now().astimezone().strftime("%Y-%m-%d %H:%M (%Z)") ) req.system_prompt += f"\nCurrent datetime: {current_time}\n" From 0ba494e0bab242d725d015d4f28e4bfd1ff8b985 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 02:11:25 +0000 Subject: [PATCH 4/4] :balloon: auto fixes by pre-commit hooks --- astrbot/core/pipeline/whitelist_check/stage.py | 5 ++++- packages/astrbot/main.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/astrbot/core/pipeline/whitelist_check/stage.py b/astrbot/core/pipeline/whitelist_check/stage.py index cff215dac..85f911a60 100644 --- a/astrbot/core/pipeline/whitelist_check/stage.py +++ b/astrbot/core/pipeline/whitelist_check/stage.py @@ -51,7 +51,10 @@ class WhitelistCheckStage(Stage): and event.get_message_type() == MessageType.FRIEND_MESSAGE ): return - if event.unified_msg_origin not in self.whitelist and event.get_group_id() not in self.whitelist: + if ( + event.unified_msg_origin not in self.whitelist + and event.get_group_id() not in self.whitelist + ): if self.wl_log: logger.info( f"会话 ID {event.unified_msg_origin} 不在会话白名单中,已终止事件传播。请在配置文件中添加该会话 ID 到白名单。" diff --git a/packages/astrbot/main.py b/packages/astrbot/main.py index 415e58f02..c8ed2564d 100644 --- a/packages/astrbot/main.py +++ b/packages/astrbot/main.py @@ -268,7 +268,10 @@ class Main(star.Star): UID: {user_id} 此 ID 可用于设置管理员。 /op 授权管理员, /deop 取消管理员。""" - if self.context.get_config()["platform_settings"]["unique_session"] and event.get_group_id(): + if ( + self.context.get_config()["platform_settings"]["unique_session"] + and event.get_group_id() + ): ret += f"\n\n当前处于独立会话模式, 此群 ID: {event.get_group_id()}, 也可将此 ID 加入白名单来放行整个群聊。" event.set_result(MessageEventResult().message(ret).use_t2i(False))