From 8b47319e5f2ad8669fba4d2813dd43135ed55763 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 2 Dec 2023 09:15:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BE=BF=E7=AC=BA=E5=BC=80=E6=8B=93?= =?UTF-8?q?=E5=8A=9B=E6=94=B9=E7=94=A8=E5=8F=98=E9=87=8F=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=AF=8F=E6=97=A5=E5=AE=9E=E8=AE=AD/=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E5=AE=87=E5=AE=99=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/plan.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nonebot_plugin_mystool/plan.py b/src/nonebot_plugin_mystool/plan.py index b9ce8d0d..54892a42 100644 --- a/src/nonebot_plugin_mystool/plan.py +++ b/src/nonebot_plugin_mystool/plan.py @@ -538,7 +538,7 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: if note.current_stamina >= account.user_stamina_threshold: # 防止重复提醒 if not starrail_notice.current_stamina_full: - if note.current_stamina >= 180: + if note.current_stamina >= note.max_stamina: starrail_notice.current_stamina_full = True msg += '❕您的开拓力已经溢出\n' do_notice = True @@ -552,21 +552,21 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: starrail_notice.current_stamina_full = False # 每日实训状态提醒 - if note.current_train_score == note.max_train_score: + if note.current_train_score != note.max_train_score: # 防止重复提醒 if not starrail_notice.current_train_score: starrail_notice.current_train_score = True - msg += '❕您的每日实训已完成\n' + msg += '❕您的每日实训未完成\n' do_notice = True else: starrail_notice.current_train_score = False # 每周模拟宇宙积分提醒 - if note.current_rogue_score == note.max_rogue_score: + if note.current_rogue_score != note.max_rogue_score: # 防止重复提醒 if not starrail_notice.current_rogue_score: starrail_notice.current_rogue_score = True - msg += '❕您的模拟宇宙积分已经打满了\n\n' + msg += '❕您的模拟宇宙积分还没打满\n\n' do_notice = True else: starrail_notice.current_rogue_score = False @@ -576,7 +576,7 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: msg += "❖星穹铁道·实时便笺❖" \ f"\n🆔账户 {account.bbs_uid}" \ - f"\n⏳开拓力数量:{note.current_stamina} / 180" \ + f"\n⏳开拓力数量:{note.current_stamina} / {note.max_stamina}" \ f"\n⏱开拓力{note.stamina_recover_text}" \ f"\n📒每日实训:{note.current_train_score} / {note.max_train_score}" \ f"\n📅每日委托:{note.accepted_expedition_num} / 4" \ From 386ea428d3be4c7eba2d2d7378059ad220e05255 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 2 Dec 2023 10:56:12 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0notice=5Ftime=EF=BC=8C?= =?UTF-8?q?=E4=B8=BAplan=5Ftime=E5=BB=B6=E5=90=8E=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=B0=8F=E6=97=B6=E5=BC=80=E5=A7=8B=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/plan.py | 10 +++++++--- src/nonebot_plugin_mystool/plugin_data.py | 10 +++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/nonebot_plugin_mystool/plan.py b/src/nonebot_plugin_mystool/plan.py index 54892a42..c39f5373 100644 --- a/src/nonebot_plugin_mystool/plan.py +++ b/src/nonebot_plugin_mystool/plan.py @@ -4,6 +4,7 @@ import asyncio import threading from typing import Union, Optional, Type, Iterable, Dict +from datetime import datetime, time from nonebot import on_command, get_adapters from nonebot.adapters.onebot.v11 import MessageSegment as OneBotV11MessageSegment, Adapter as OneBotV11Adapter, \ @@ -554,8 +555,10 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: # 每日实训状态提醒 if note.current_train_score != note.max_train_score: # 防止重复提醒 - if not starrail_notice.current_train_score: - starrail_notice.current_train_score = True + #if not starrail_notice.current_train_score: + if not starrail_notice.current_train_score \ + and _conf.preference.notice_time: #注意此处添加notice_time是为了防止每日唯一一次推送通知在4:00后一段时间 + starrail_notice.current_train_score = True #例如便笺检查在xx:20,便笺检查间隔1h,则每日唯一一次通知在04:20 msg += '❕您的每日实训未完成\n' do_notice = True else: @@ -564,7 +567,8 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: # 每周模拟宇宙积分提醒 if note.current_rogue_score != note.max_rogue_score: # 防止重复提醒 - if not starrail_notice.current_rogue_score: + if not starrail_notice.current_rogue_score \ + and _conf.preference.notice_time: #notice_time同理 starrail_notice.current_rogue_score = True msg += '❕您的模拟宇宙积分还没打满\n\n' do_notice = True diff --git a/src/nonebot_plugin_mystool/plugin_data.py b/src/nonebot_plugin_mystool/plugin_data.py index 3d305035..01ca6f86 100644 --- a/src/nonebot_plugin_mystool/plugin_data.py +++ b/src/nonebot_plugin_mystool/plugin_data.py @@ -3,7 +3,7 @@ """ import json import os -from datetime import time, timedelta +from datetime import time, timedelta, datetime from json import JSONDecodeError from pathlib import Path from typing import Union, Optional, Tuple, Any, Dict, TYPE_CHECKING, AbstractSet, \ @@ -119,6 +119,14 @@ def _(cls, v: Optional[Path]): elif not os.access(absolute_path, os.W_OK): logger.warning(f"程序没有写入日志文件 {absolute_path} 的权限") return v + + @property + def notice_time(self) -> bool: + now_time = datetime.now().time() + note_time = datetime.strptime(self.plan_time, "%H:%M") + note_time = note_time + timedelta(hours=1) + return now_time > note_time.time() + class GoodListImageConfig(BaseModel): From 97cba445917421acb5c7e2b34d996b21a57f3757 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 2 Dec 2023 11:08:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9notice=5Ftime=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/plan.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nonebot_plugin_mystool/plan.py b/src/nonebot_plugin_mystool/plan.py index c39f5373..a764905c 100644 --- a/src/nonebot_plugin_mystool/plan.py +++ b/src/nonebot_plugin_mystool/plan.py @@ -557,9 +557,9 @@ async def starrail_note_check(user: UserData, user_ids: Iterable[str], matcher: # 防止重复提醒 #if not starrail_notice.current_train_score: if not starrail_notice.current_train_score \ - and _conf.preference.notice_time: #注意此处添加notice_time是为了防止每日唯一一次推送通知在4:00后一段时间 - starrail_notice.current_train_score = True #例如便笺检查在xx:20,便笺检查间隔1h,则每日唯一一次通知在04:20 - msg += '❕您的每日实训未完成\n' + and _conf.preference.notice_time: #注意此处添加notice_time是为了防止每日首次推送通知在4:00后一段时间 + starrail_notice.current_train_score = True #notice_time = plan_time +1h + msg += '❕您的每日实训未完成\n' #通知逻辑变动后,如不添加notice_time,便笺检查在xx:20,便笺检查间隔1h,则每日首次通知在04:20 do_notice = True else: starrail_notice.current_train_score = False From 0c1262380132b52a5fc969b46e5ee4acc83484c0 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 2 Dec 2023 13:13:23 +0800 Subject: [PATCH 4/4] =?UTF-8?q?mission=5Fgames=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E6=94=B9=E5=B0=8F=E5=86=99=E4=BB=A5=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/myb_missions_api.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nonebot_plugin_mystool/myb_missions_api.py b/src/nonebot_plugin_mystool/myb_missions_api.py index 3422bd35..9c5a1ed3 100644 --- a/src/nonebot_plugin_mystool/myb_missions_api.py +++ b/src/nonebot_plugin_mystool/myb_missions_api.py @@ -89,7 +89,7 @@ class BaseMission: """ 米游币任务基类 """ - NAME = "" + name = "" """米游社分区名字""" GIDS = 0 FID = 0 @@ -385,7 +385,7 @@ class GenshinImpactMission(BaseMission): """ 原神 米游币任务 """ - NAME = "原神" + name = "原神" GIDS = 2 FID = 26 @@ -394,7 +394,7 @@ class HonkaiImpact3Mission(BaseMission): """ 崩坏3 米游币任务 """ - NAME = "崩坏3" + name = "崩坏3" GIDS = 1 FID = 1 @@ -403,7 +403,7 @@ class HoukaiGakuen2Mission(BaseMission): """ 崩坏学园2 米游币任务 """ - NAME = "崩坏学园2" + name = "崩坏学园2" GIDS = 3 FID = 30 @@ -412,7 +412,7 @@ class TearsOfThemisMission(BaseMission): """ 未定事件簿 米游币任务 """ - NAME = "未定事件簿" + name = "未定事件簿" GIDS = 4 FID = 37 @@ -421,7 +421,7 @@ class StarRailMission(BaseMission): """ 崩坏:星穹铁道 米游币任务 """ - NAME = "崩坏:星穹铁道" + name = "崩坏:星穹铁道" GIDS = 6 FID = 52 @@ -430,7 +430,7 @@ class BBSMission(BaseMission): """ 大别野 米游币任务 """ - NAME = "综合" + name = "综合" GIDS = 5 # TODO: bbs fid暂时未知 @@ -439,7 +439,7 @@ class ZenlessZoneZero(BaseMission): """ 绝区零 米游币任务 """ - NAME = "绝区零" + name = "绝区零" GIDS = 8 # TODO: fid暂时未知