Skip to content

Commit

Permalink
Merge pull request #93 from Ljzd-PRO/dev
Browse files Browse the repository at this point in the history
更新至 v0.2.8
  • Loading branch information
ERZATZ Type AK9 authored May 3, 2023
2 parents fe3e942 + e66a8e4 commit bea8ad3
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 39 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@
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/**'
- '.github/workflows/codeql-analysis.yml'

permissions:
contents: read
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ name: Multiple Python Versions Test
on:
workflow_dispatch:
push:
branches: [ "stable", "dev" ]
paths:
- 'src/nonebot_plugin_mystool/**'
- '.github/workflows/python-package.yml'
pull_request:
branches: [ "stable", "dev" ]
paths:
- 'src/nonebot_plugin_mystool/**'
- '.github/workflows/python-package.yml'

permissions:
contents: read
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@

# mysTool - 米游社辅助工具插件

**版本 - v0.2.7**
**版本 - v0.2.8**

### 📣 更新内容

#### 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 插件捕获的问题
- 增加支持星穹铁道的商品兑换
Expand All @@ -37,13 +42,6 @@
- 精简接收的命令
- 更正 `device_save` "设备保存" 日志文本的错误

#### 2023.3.18
- 增加导出Cookies功能
- 增加删除账号数据功能
- 在用户所有账号都登录失效的情况下关闭通知
- 修复原神游戏签到失败问题
- 规范化代码

## 功能和特性

- 短信验证登录,免抓包获取 Cookie
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-plugin-mystool"
version = "v0.2.7"
version = "v0.2.8"
description = "NoneBot2插件|米游社工具-每日米游币任务、游戏签到、商品兑换、免抓包登录、原神树脂提醒"
license = "MIT"
authors = [
Expand Down
4 changes: 2 additions & 2 deletions src/nonebot_plugin_mystool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
# mysTool - 米游社辅助工具插件
**版本 - v0.2.6**
**版本 - v0.2.8**
## 使用说明
Expand Down Expand Up @@ -39,7 +39,7 @@

from .data import create_files

VERSION = "v0.2.6"
VERSION = "v0.2.8"
'''插件版本号'''

__plugin_meta__ = PluginMetadata(
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_mystool/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -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设置'
Expand Down
4 changes: 1 addition & 3 deletions src/nonebot_plugin_mystool/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
17 changes: 12 additions & 5 deletions src/nonebot_plugin_mystool/gameSign.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"ys": "e202009291139501",
"bh3": "e202207181446311",
"bh2": "e202203291431091",
"xq": "e202304121516551",
"wd": "e202202251749321"
}
URLS = {
Expand All @@ -39,6 +40,12 @@
"&region={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"]),
"&region={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"]),
Expand Down Expand Up @@ -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:
Expand All @@ -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`说明失败
Expand Down Expand Up @@ -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对象
Expand Down Expand Up @@ -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]:
"""
Expand Down Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_mystool/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '跟随指引,通过电话获取短信方式绑定米游社账户,配置完成后会自动开启签到、米游币任务,后续可制定米游币自动兑换计划。'

Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_mystool/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/nonebot_plugin_mystool/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}通知设置』命令。'

Expand All @@ -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=5, block=True)
account_setting.name = "账号设置"
account_setting.usage = "配置游戏自动签到、米游币任务是否开启、设备平台、频道任务相关选项"

Expand Down Expand Up @@ -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=5, block=True)
global_setting.name = "通知设置"
global_setting.usage = "设置每日签到后是否进行QQ通知"

Expand Down

0 comments on commit bea8ad3

Please sign in to comment.