Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ 更新数据库模型 #39

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,12 @@ body:
validations:
required: true

# Env | VM Arch
- type: dropdown
# Env | Nonebot 2 Version
- type: textarea
id: env-nb2-ver
attributes:
label: Nonebot 2 版本
description: 选择运行机器人 Nonebot 2 的系统架构
options:
- 2.0.1
- 2.1.0
- 2.1.1
- 其它(请在下方说明)
description: 选择运行机器人 Nonebot 2 的版本
validations:
required: true

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ on:
- nonebot_plugin_skland_arksign/**
- tests/**
- pyproject.toml
- poetry.lock
- pdm.lock
- .github/**
pull_request:
paths:
- nonebot_plugin_skland_arksign/**
- tests/**
- pyproject.toml
- poetry.lock
- pdm.lock
- .github/**

concurrency:
Expand All @@ -36,15 +36,15 @@ jobs:
PYTHON_VERSION: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v3

- name: Setup Python environment
uses: ./.github/actions/setup-python
- uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要改这里,不就是上面的./.github/actions/setup-python离得内容吗

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不知道为什么action全报错了,完整抄下一份发现能用

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉是你修改了哪个地方的问题(

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个pr之前commit的action test报错记录出错位置

不是很懂导入怎么出错了,反正是把他展开写进去以后能用了

with:
python-version: ${{ matrix.python-version }}

- name: Install prerequisites
run: pdm install

- name: Run Pytest
run: pdm run pytest -n auto
- name: Install dependencies
run: |
pdm sync -d -G test
- name: Run Tests
run: |
pdm run -v pytest tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有什么区别吗,为什么要sync一次?以前不是没问题

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

抄的 pdm 文档里的(

然后之前的 pr 没问题 但是这个 pr 里每次 commit 以后的 preview action 就全炸了

8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,4 @@ repos:
- id: black
stages: [commit]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.3
hooks:
- id: prettier
types_or: [javascript, jsx, ts, tsx, markdown, yaml, json]
exclude: "admin-frontend/"
stages: [commit]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里保留是考虑到还可以留着格式化yaml和md,就没删,删掉exclude那段就行

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最近的一次错误报告:对flag怎么写没什么头猪,直接删了(逃

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怪事 也没写这两个参数啊

exclude: "CHANGELOG.md"
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,26 @@ skland del 游戏账号ID/备注
```

> [!WARNING]
> 注意:非[超级用户](https://nonebot.dev/docs/appendices/config#superusers)只可删除自己绑定的账号,超级用户可以删除bot数据库内所有账号
> 超级用户可以删除bot数据库内的任意账号
>
> [OneBot V11](https://onebot.adapters.nonebot.dev/) 适配器中的 QQ 群管理员以上权限的用户可以在群内删除本群内的任意账号
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我认为在一个好的权限插件出来之前还是保留原状?这样也太平台特化了

>
> 非[超级用户](https://nonebot.dev/docs/appendices/config#superusers)只可在私聊中删除自己绑定的账号

### 列出账号

```shell
skland list
```

> [!WARNING]
> 仅超级用户可用

### 更新账号

```shell
skland update 游戏账号ID/备注 [-u 可选UID] [-t 可选token] [-n 可选备注]
```

> [!WARNING]
> 仅超级用户可用
> 因可能涉及token变更,本指令只允许[超级用户](https://nonebot.dev/docs/appendices/config#superusers)或单独的用户删除自己能处理的账户

### 立即手动签到

Expand All @@ -200,11 +201,7 @@ skland signin !all

## ♿️ FAQ

1. 为什么这么多仅超级用户可用的命令?
因为当前的数据库模型没有记录添加者的信息,只记录了需要发送到的用户信息,所以暂时只能通过超级用户来操作
未来可能会加入权限系统,以及增加数据库模型字段

2. 使用例子?
1. 使用例子?

```shell
skland add 114514 1919810 -n hhhaaa
Expand All @@ -218,22 +215,23 @@ skland signin !all
skland signin 1919810
```

3. 为什么我刚获取token并绑定好,一会就用不了了?
2. 为什么我刚获取token并绑定好,一会就用不了了?

- 当您使用浏览器获取token时,**不要去登出账号,否则鹰角网络通行证会失效!**
- 如果要添加多个账号,请删除浏览器缓存。或者使用浏览器自带的隐私浏览模式,拿到Token后,关闭隐私窗口,再登录一次即可
- 注意:电脑在用密码登录后,手机客户端有可能会被挤掉,但一定不要点客户端里的清理会话,否则所有的登录状态**都会被清空!**

4. 报错`{'code': 10001, 'message': '当前用户未经授权'}`?<!-- markdownlint-disable -->
3. 报错`{'code': 10001, 'message': '当前用户未经授权'}`?<!-- markdownlint-disable -->

- 参考 [#更新账号](#更新账号) 一栏重新绑定游戏账号ID
- 参考issue:[#29](https://github.com/GuGuMur/nonebot-plugin-skland-arksign/issues/29)

5. 报错`Client error '400 Bad Request' for url xxx`?<!-- markdownlint-disable -->
4. 报错`Client error '400 Bad Request' for url xxx`?<!-- markdownlint-disable -->

- 请检查token复制过程中是否有错漏,以及游戏账号ID是否与您输入的token相符
- 参考[#立即手动签到](#立即手动签到) 一栏执行手动签到操作

6. 报错`Client error '401 Unauthorized' for url xxx`?<!-- markdownlint-disable -->
5. 报错`Client error '401 Unauthorized' for url xxx`?<!-- markdownlint-disable -->

- 参考 [#配置](#配置) 一栏修改`skland_timestamp_delay`的数值
- 参考值:`5`,`10`
Expand Down
18 changes: 9 additions & 9 deletions nonebot_plugin_skland_arksign/alc_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@

from .config import plugin_config

skland_alc = Alconna(
skland_cmd = Alconna(
"skland",
Subcommand(
"add",
Args["uid", str]["token?", str],
Option("-n|--note", Args["note", str]),
help_text="添加一个新的签到账号",
),
Subcommand(
"bind",
Args["token", str],
help_text="在私聊绑定一个在群聊中添加的签到账号",
),
Subcommand(
"list",
help_text="列出所有签到账号",
),
Subcommand(
"del",
Args["identifier", str],
Args["identifier", str]["position?", int],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加position容易导致误删吧,万一在增删账号之后原来那个账号的位置改变了呢,我觉得不应该加

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发送指令以后能处理的列表就固定在 state 里了,position也只对这部分起效

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发送指令以后能处理的列表就固定在 state 里了,position也只对这部分起效

何意 没太看懂(

help_text="使用uid或者备注删除一个签到账号",
),
Subcommand(
"update",
Args["identifier", str],
Args["identifier", str]["position?", int],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的position也是

[
Option("-u|--uid", Args["uid", str]),
Option("-t|--token", Args["token", str]),
Option("-n|--note", Args["note", str]),
],
help_text="使用uid或者备注更新一个签到账号",
),
Subcommand(
"bind",
Args["token", str],
help_text="在私聊绑定一个在群聊中添加的签到账号",
),
Subcommand(
"signin",
Args["identifier", str],
Args["identifier", str]["position?", int],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有这里的position

help_text="使用uid或者备注立刻签到一个账号",
),
meta=CommandMeta(
Expand Down
Loading