From c839b442569739ff599b57ec6775084c5b417659 Mon Sep 17 00:00:00 2001 From: ThelevenFD <104363913+ThelevenFD@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:36:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E6=8D=A2specify=5Fprobability?= =?UTF-8?q?=E4=B8=BAfloat=20=E5=A2=9E=E5=8A=A0=E9=89=B4=E6=9D=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20(#2067)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 转换specify_probability为float * 解决#2045 添加密钥配置 * Revise access token configuration in .env.example Updated comments and modified access token configuration. --------- Co-authored-by: HibiKier <45528451+HibiKier@users.noreply.github.com> --- .env.example | 6 +++++- zhenxun/builtin_plugins/sign_in/_data_source.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 015a950c..edc03d3b 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,9 @@ SESSION_EXPIRE_TIMEOUT=00:00:30 ALCONNA_USE_COMMAND_START=True +# ws连接密钥,若bot能被公网访问则建议打开该注释并设置该配置项 +# ONEBOT_ACCESS_TOKEN="" + # 全局图片统一使用bytes发送,当真寻与协议端不在同一服务器上时为True IMAGE_TO_BYTES = True @@ -29,6 +32,7 @@ DB_URL = "" # NONE: 不使用缓存, MEMORY: 使用内存缓存, REDIS: 使用Redis缓存 CACHE_MODE = NONE + # REDIS配置,使用REDIS替换Cache内存缓存 # REDIS地址 # REDIS_HOST = "127.0.0.1" @@ -86,4 +90,4 @@ PORT = 8080 # ' # application_commands的{"*": ["*"]}代表将全部应用命令注册为全局应用命令 -# {"admin": ["123", "456"]}则代表将admin命令注册为id是123、456服务器的局部命令,其余命令不注册 \ No newline at end of file +# {"admin": ["123", "456"]}则代表将admin命令注册为id是123、456服务器的局部命令,其余命令不注册 diff --git a/zhenxun/builtin_plugins/sign_in/_data_source.py b/zhenxun/builtin_plugins/sign_in/_data_source.py index 7310e13f..3dd8968b 100644 --- a/zhenxun/builtin_plugins/sign_in/_data_source.py +++ b/zhenxun/builtin_plugins/sign_in/_data_source.py @@ -175,7 +175,7 @@ class SignManage: impression_added = (secrets.randbelow(99) + 1) / 100 rand = random.random() add_probability = float(user.add_probability) - specify_probability = user.specify_probability + specify_probability = float(user.specify_probability) if rand + add_probability > 0.97 or rand < specify_probability: impression_added *= 2 await SignUser.sign(user, impression_added, session.self_id, platform)