From 8546dc3654624639e9daecdc530daab506a68ef9 Mon Sep 17 00:00:00 2001 From: root <27204037@163.com> Date: Fri, 28 Apr 2023 14:02:35 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=AF=B9=E8=AF=9D=E4=BC=98=E5=85=88=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/address.py | 2 +- src/nonebot_plugin_mystool/login.py | 2 +- src/nonebot_plugin_mystool/setting.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nonebot_plugin_mystool/address.py b/src/nonebot_plugin_mystool/address.py index 95188695..c83f2853 100644 --- a/src/nonebot_plugin_mystool/address.py +++ b/src/nonebot_plugin_mystool/address.py @@ -72,7 +72,7 @@ async def get(account: UserAccount, retry: bool = True) -> Union[List[Address], return address_list -get_address = on_command(conf.COMMAND_START + '地址') +get_address = on_command(conf.COMMAND_START + '地址', priority=4, block=True) get_address.name = '地址' get_address.usage = '跟随指引,获取地址ID,用于兑换米游币商品。在获取地址ID前,如果你还没有设置米游社收获地址,请前往官网或App设置' diff --git a/src/nonebot_plugin_mystool/login.py b/src/nonebot_plugin_mystool/login.py index f0096c54..3d6a1510 100644 --- a/src/nonebot_plugin_mystool/login.py +++ b/src/nonebot_plugin_mystool/login.py @@ -188,7 +188,7 @@ async def get_3(self, captcha: str, retry: bool = True) -> Literal[1, -1, -2, -3 return -2 -get_cookie = on_command(conf.COMMAND_START + '登录') +get_cookie = on_command(conf.COMMAND_START + '登录', priority=4, block=True) get_cookie.name = '登录' get_cookie.usage = '跟随指引,通过电话获取短信方式绑定米游社账户,配置完成后会自动开启签到、米游币任务,后续可制定米游币自动兑换计划。' diff --git a/src/nonebot_plugin_mystool/setting.py b/src/nonebot_plugin_mystool/setting.py index 41a18a66..315213b0 100644 --- a/src/nonebot_plugin_mystool/setting.py +++ b/src/nonebot_plugin_mystool/setting.py @@ -15,7 +15,7 @@ from .mybMission import GAME_ID from .utils import COMMAND_BEGIN -setting = on_command(conf.COMMAND_START + '设置') +setting = on_command(conf.COMMAND_START + '设置', priority=4) setting.name = "设置" setting.usage = f'如需配置是否开启每日任务、设备平台、频道任务等相关选项,请使用『{COMMAND_BEGIN}账号设置』命令。\n如需设置米游币任务和游戏签到后是否进行QQ通知,请使用『{COMMAND_BEGIN}通知设置』命令。' @@ -26,7 +26,7 @@ async def _(event: MessageEvent): await setting.send(msg) -account_setting = on_command(conf.COMMAND_START + '账号设置') +account_setting = on_command(conf.COMMAND_START + '账号设置', priority=4) account_setting.name = "账号设置" account_setting.usage = "配置游戏自动签到、米游币任务是否开启、设备平台、频道任务相关选项" @@ -173,7 +173,7 @@ async def _(event: PrivateMessageEvent, state: T_State, arg=ArgPlainText('missio await account_setting.finish(f"💬执行米游币任务的频道已更改为『{arg}』") -global_setting = on_command(conf.COMMAND_START + '通知设置') +global_setting = on_command(conf.COMMAND_START + '通知设置', priority=4) global_setting.name = "通知设置" global_setting.usage = "设置每日签到后是否进行QQ通知" From 2e57313db3793c9693f1419cabbfdb429cfb3f39 Mon Sep 17 00:00:00 2001 From: root <27204037@163.com> Date: Fri, 28 Apr 2023 14:18:16 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=AF=B9=E8=AF=9D=E4=BC=98=E5=85=88=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/setting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nonebot_plugin_mystool/setting.py b/src/nonebot_plugin_mystool/setting.py index 315213b0..fbb1158d 100644 --- a/src/nonebot_plugin_mystool/setting.py +++ b/src/nonebot_plugin_mystool/setting.py @@ -26,7 +26,7 @@ async def _(event: MessageEvent): await setting.send(msg) -account_setting = on_command(conf.COMMAND_START + '账号设置', priority=4) +account_setting = on_command(conf.COMMAND_START + '账号设置', priority=5, block=True) account_setting.name = "账号设置" account_setting.usage = "配置游戏自动签到、米游币任务是否开启、设备平台、频道任务相关选项" @@ -173,7 +173,7 @@ async def _(event: PrivateMessageEvent, state: T_State, arg=ArgPlainText('missio await account_setting.finish(f"💬执行米游币任务的频道已更改为『{arg}』") -global_setting = on_command(conf.COMMAND_START + '通知设置', priority=4) +global_setting = on_command(conf.COMMAND_START + '通知设置', priority=5, block=True) global_setting.name = "通知设置" global_setting.usage = "设置每日签到后是否进行QQ通知" From c37a29236253d1a3af3fec567cc96e10063b9929 Mon Sep 17 00:00:00 2001 From: root <27204037@163.com> Date: Fri, 28 Apr 2023 15:42:43 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=98=9F=E7=A9=B9?= =?UTF-8?q?=E9=93=81=E9=81=93=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/gameSign.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/nonebot_plugin_mystool/gameSign.py b/src/nonebot_plugin_mystool/gameSign.py index 0d245e34..b6dd0331 100644 --- a/src/nonebot_plugin_mystool/gameSign.py +++ b/src/nonebot_plugin_mystool/gameSign.py @@ -18,6 +18,7 @@ "ys": "e202009291139501", "bh3": "e202207181446311", "bh2": "e202203291431091", + "xq": "e202304121516551", "wd": "e202202251749321" } URLS = { @@ -39,6 +40,12 @@ "®ion={region}&uid={uid}")), "sign": "https://api-takumi.mihoyo.com/event/luna/sign" }, + "xq": { + "reward": "https://api-takumi.mihoyo.com/event/luna/home?lang=zh-cn&act_id={}".format(ACT_ID["xq"]), + "info": "".join(("https://api-takumi.mihoyo.com/event/luna/info?lang=zh-cn&act_id={}".format(ACT_ID["xq"]), + "®ion={region}&uid={uid}")), + "sign": "https://api-takumi.mihoyo.com/event/luna/sign" + }, "wd": { "reward": "https://api-takumi.mihoyo.com/event/luna/home?lang=zh-cn&act_id={}".format(ACT_ID["wd"]), "info": "".join(("https://api-takumi.mihoyo.com/event/luna/info?lang=zh-cn&act_id={}".format(ACT_ID["wd"]), @@ -159,7 +166,7 @@ class GameSign: """ 游戏签到相关(需先初始化对象) """ - SUPPORTED_GAMES = ["ys", "bh3", "bh2", "wd"] + SUPPORTED_GAMES = ["ys", "bh3", "bh2", "xq", "wd"] '''目前支持签到的游戏''' def __init__(self, account: UserAccount) -> None: @@ -169,7 +176,7 @@ def __init__(self, account: UserAccount) -> None: '''签到返回结果''' @staticmethod - async def reward(game: Literal["ys", "bh3"], retry: bool = True): + async def reward(game: Literal["ys", "bh3", "xq"], retry: bool = True): """ 获取签到奖励信息,若返回`None`说明失败 @@ -197,7 +204,7 @@ async def reward(game: Literal["ys", "bh3"], retry: bool = True): logger.debug(f"{conf.LOG_HEAD}网络请求返回: {res.text}") logger.debug(f"{conf.LOG_HEAD}{traceback.format_exc()}") - async def info(self, game: Literal["ys", "bh3"], game_uid: str, region: str = None, retry: bool = True) -> Union[ + async def info(self, game: Literal["ys", "bh3", "xq"], game_uid: str, region: str = None, retry: bool = True) -> Union[ Info, Literal[-1, -2, -3, -4]]: """ 获取签到记录,返回Info对象 @@ -264,7 +271,7 @@ async def info(self, game: Literal["ys", "bh3"], game_uid: str, region: str = No logger.debug(f"{conf.LOG_HEAD}{traceback.format_exc()}") return -3 - async def sign(self, game: Literal["ys", "bh3", "bh2", "wd"], game_uid: str, + async def sign(self, game: Literal["ys", "bh3", "xq", "bh2", "wd"], game_uid: str, platform: Literal["ios", "android"] = "ios", retry: bool = True) -> Literal[ 1, -1, -2, -3, -4, -5, -6]: """ @@ -342,7 +349,7 @@ async def sign(self, game: Literal["ys", "bh3", "bh2", "wd"], game_uid: str, self.signResult = res.json() if game == "ys" and self.signResult["message"] == "旅行者,你已经签到过了": return 1 - if game not in ["bh3", "wd", "bh2"] and self.signResult["data"]["risk_code"] != 0: + if game not in ["bh3", "xq", "wd", "bh2"] and self.signResult["data"]["risk_code"] != 0: logger.warning( f"{conf.LOG_HEAD}签到 - 用户 {self.account.phone} 可能被验证码阻拦") logger.debug(f"{conf.LOG_HEAD}网络请求返回: {res.text}") From f01801f255aca7d7aeff5973d4bdc8a72b47c8cc Mon Sep 17 00:00:00 2001 From: black_zero <53086059+black-zero358@users.noreply.github.com> Date: Sat, 29 Apr 2023 10:45:00 +0800 Subject: [PATCH 04/10] Update plan.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改一处文本错误 --- src/nonebot_plugin_mystool/plan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nonebot_plugin_mystool/plan.py b/src/nonebot_plugin_mystool/plan.py index ccb55719..6217e818 100644 --- a/src/nonebot_plugin_mystool/plan.py +++ b/src/nonebot_plugin_mystool/plan.py @@ -31,7 +31,7 @@ async def _(event: Union[GroupMessageEvent, PrivateMessageEvent]): """ bot = get_bot(str(event.self_id)) if not UserData.read_account_all(event.user_id): - await manually_game_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录") + await manually_game_sign.finish(f"⚠️你尚未绑定米游社,请先使用『{COMMAND_BEGIN}登录』进行登录") await perform_game_sign(bot=bot, qq=event.user_id, is_auto=False, group_event=event) @@ -141,7 +141,7 @@ async def perform_game_sign(bot: Bot, qq: int, is_auto: bool, if sign_flag == -1: message = f"⚠️账户 {account.phone if not group_event else blur(account.phone)} 🎮『{game_name}』签到时服务器返回登录失效,请尝试重新登录绑定账户" elif sign_flag == -5: - message = f"⚠️账户 {account.phone if not group_event else blur(account.phone)} 🎮『{game_name}』签到时可能遇到验证码拦截,请尝试使用命令『/账户设置』更改设备平台,若仍失败请手动前往米游社签到" + message = f"⚠️账户 {account.phone if not group_event else blur(account.phone)} 🎮『{game_name}』签到时可能遇到验证码拦截,请尝试使用命令『/账号设置』更改设备平台,若仍失败请手动前往米游社签到" else: message = f"⚠️账户 {account.phone if not group_event else blur(account.phone)} 🎮『{game_name}』签到失败,请稍后再试" if UserData.is_notice(qq) or not is_auto: From 9312c0eaf53c199fc0a0aef0208f70ea390c301f Mon Sep 17 00:00:00 2001 From: black_zero <53086059+black-zero358@users.noreply.github.com> Date: Sat, 29 Apr 2023 10:57:09 +0800 Subject: [PATCH 05/10] Update plan.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~~改错了一个地方~~ --- src/nonebot_plugin_mystool/plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nonebot_plugin_mystool/plan.py b/src/nonebot_plugin_mystool/plan.py index 6217e818..b7077a4d 100644 --- a/src/nonebot_plugin_mystool/plan.py +++ b/src/nonebot_plugin_mystool/plan.py @@ -31,7 +31,7 @@ async def _(event: Union[GroupMessageEvent, PrivateMessageEvent]): """ bot = get_bot(str(event.self_id)) if not UserData.read_account_all(event.user_id): - await manually_game_sign.finish(f"⚠️你尚未绑定米游社,请先使用『{COMMAND_BEGIN}登录』进行登录") + await manually_game_sign.finish(f"⚠️你尚未绑定米游社账户,请先使用『{COMMAND_BEGIN}登录』进行登录") await perform_game_sign(bot=bot, qq=event.user_id, is_auto=False, group_event=event) From d97c4e296a9fbf0f6539bc1a48513dfe1e8098e5 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO Date: Sat, 29 Apr 2023 13:03:13 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=9C=AA=E5=AE=9A?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=B0=BF=E5=95=86=E5=93=81=E5=85=91=E6=8D=A2?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98(not=5Fin=5Fsale)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nonebot_plugin_mystool/exchange.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/nonebot_plugin_mystool/exchange.py b/src/nonebot_plugin_mystool/exchange.py index 5b35ee6e..eb16ee58 100644 --- a/src/nonebot_plugin_mystool/exchange.py +++ b/src/nonebot_plugin_mystool/exchange.py @@ -151,12 +151,10 @@ def time(self) -> Optional[int]: # "type" 为 1 时商品只有在指定时间开放兑换;为 0 时商品任何时间均可兑换 if self.good_dict["type"] != 1 and self.good_dict["next_time"] == 0: return None - elif self.good_dict["status"] != "not_in_sell": - return self.good_dict["next_time"] elif "sale_start_time" in self.good_dict: return int(self.good_dict["sale_start_time"]) else: - return self.time_by_detail + return self.good_dict["next_time"] @property def num(self) -> Union[None, int]: From 81ced502aa68450f3e09334b20413d63c4c91b3f Mon Sep 17 00:00:00 2001 From: Ljzd-PRO Date: Thu, 4 May 2023 01:49:34 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++-------- pyproject.toml | 2 +- src/nonebot_plugin_mystool/__init__.py | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 52f8293c..733f90f9 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,13 @@ # mysTool - 米游社辅助工具插件 -**版本 - v0.2.7** +**版本 - v0.2.8** ### 📣 更新内容 +#### 2023.5.4 +- 增加对星穹铁道的签到功能的支持 + #### 2023.4.28 - 修复插件命令被其他 nonebot 插件捕获的问题 - 增加支持星穹铁道的商品兑换 @@ -37,13 +40,6 @@ - 精简接收的命令 - 更正 `device_save` "设备保存" 日志文本的错误 -#### 2023.3.18 -- 增加导出Cookies功能 -- 增加删除账号数据功能 -- 在用户所有账号都登录失效的情况下关闭通知 -- 修复原神游戏签到失败问题 -- 规范化代码 - ## 功能和特性 - 短信验证登录,免抓包获取 Cookie diff --git a/pyproject.toml b/pyproject.toml index 70b85d71..51d5024b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-plugin-mystool" -version = "v0.2.7" +version = "v0.2.8" description = "NoneBot2插件|米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神树脂提醒" license = "MIT" authors = [ diff --git a/src/nonebot_plugin_mystool/__init__.py b/src/nonebot_plugin_mystool/__init__.py index 4323b89a..3c0d82dd 100644 --- a/src/nonebot_plugin_mystool/__init__.py +++ b/src/nonebot_plugin_mystool/__init__.py @@ -1,7 +1,7 @@ """ # mysTool - 米游社辅助工具插件 -**版本 - v0.2.6** +**版本 - v0.2.8** ## 使用说明 @@ -39,7 +39,7 @@ from .data import create_files -VERSION = "v0.2.6" +VERSION = "v0.2.8" '''插件版本号''' __plugin_meta__ = PluginMetadata( From 8d19c85dc32451d6e7d6f5d483f0d95a72e26ddf Mon Sep 17 00:00:00 2001 From: Ljzd-PRO Date: Thu, 4 May 2023 02:29:13 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codeql-analysis.yml | 14 ++------------ .github/workflows/python-package.yml | 6 ++++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c5a79a3b..bd24a2b4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,19 +12,9 @@ name: "CodeQL" on: - push: - branches: - - stable - - dev - - v0.2.2-beta1 pull_request: - # The branches below must be a subset of the branches above - branches: - - stable - - dev - - v0.2.2-beta1 - schedule: - - cron: '31 10 * * 6' + paths: + - 'src/**' permissions: contents: read diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0ee0045f..3e965fa8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -6,9 +6,11 @@ name: Multiple Python Versions Test on: workflow_dispatch: push: - branches: [ "stable", "dev" ] + paths: + - 'src/nonebot_plugin_mystool/**' pull_request: - branches: [ "stable", "dev" ] + paths: + - 'src/nonebot_plugin_mystool/**' permissions: contents: read From ca60c8fd921063f0ef1b86fa9f31b1e8fd207dc2 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO Date: Thu, 4 May 2023 02:30:07 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codeql-analysis.yml | 1 + .github/workflows/python-package.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bd24a2b4..06937c34 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -15,6 +15,7 @@ on: pull_request: paths: - 'src/**' + - '.github/workflows/codeql-analysis.yml' permissions: contents: read diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 3e965fa8..2e0b883b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -8,9 +8,11 @@ on: push: paths: - 'src/nonebot_plugin_mystool/**' + - '.github/workflows/python-package.yml' pull_request: paths: - 'src/nonebot_plugin_mystool/**' + - '.github/workflows/python-package.yml' permissions: contents: read From e66a8e4a53042e639a0f2df66006d686691f05a1 Mon Sep 17 00:00:00 2001 From: Ljzd-PRO Date: Thu, 4 May 2023 03:55:53 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 733f90f9..48e51fc1 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,9 @@ ### 📣 更新内容 #### 2023.5.4 -- 增加对星穹铁道的签到功能的支持 +- 增加对星穹铁道的签到功能的支持 - [#89](https://github.com/Ljzd-PRO/nonebot-plugin-mystool/pull/89) by @ayakasuki +- 修复插件命令优先度问题 - [#88](https://github.com/Ljzd-PRO/nonebot-plugin-mystool/pull/88) by @ayakasuki +- 部分文本错误修正 - [#90](https://github.com/Ljzd-PRO/nonebot-plugin-mystool/pull/90) by @black-zero358 #### 2023.4.28 - 修复插件命令被其他 nonebot 插件捕获的问题