Compare commits

...

60 Commits

Author SHA1 Message Date
6867245be3 🔖 1.5.3 2024-10-13 01:14:14 +08:00
dependabot[bot]
eebff0a8ad ⬆️ Bump pandas-stubs from 2.2.2.240909 to 2.2.3.241009 (#466)
Bumps [pandas-stubs](https://github.com/pandas-dev/pandas-stubs) from 2.2.2.240909 to 2.2.3.241009.
- [Changelog](https://github.com/pandas-dev/pandas-stubs/blob/main/docs/release_procedure.md)
- [Commits](https://github.com/pandas-dev/pandas-stubs/compare/v2.2.2.240909...v2.2.3.241009)

---
updated-dependencies:
- dependency-name: pandas-stubs
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 16:48:51 +00:00
74eef41506 🏷️ 添加一些 TypeAlias 2024-10-13 00:46:11 +08:00
5eb4771259 TETR.IO list 自动将 country 转大写 2024-10-13 00:45:36 +08:00
7a3a4d936d 🐛 修正一些 trigger 2024-10-13 00:38:37 +08:00
pre-commit-ci[bot]
03ca7c4486 ⬆️ auto update by pre-commit hooks (#463)
* ⬆️ auto update by pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.8 → v0.6.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.8...v0.6.9)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-10 21:43:13 +00:00
dependabot[bot]
b043d1da59 ⬆️ Bump yarl from 1.13.1 to 1.14.0 (#464)
Bumps [yarl](https://github.com/aio-libs/yarl) from 1.13.1 to 1.14.0.
- [Release notes](https://github.com/aio-libs/yarl/releases)
- [Changelog](https://github.com/aio-libs/yarl/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/yarl/compare/v1.13.1...v1.14.0)

---
updated-dependencies:
- dependency-name: yarl
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-10 21:24:46 +00:00
dependabot[bot]
c9659201b1 ⬆️ Bump nonebot-plugin-alconna from 0.52.3 to 0.53.0 (#462)
Bumps [nonebot-plugin-alconna](https://github.com/nonebot/plugin-alconna) from 0.52.3 to 0.53.0.
- [Release notes](https://github.com/nonebot/plugin-alconna/releases)
- [Commits](https://github.com/nonebot/plugin-alconna/compare/v0.52.3...v0.53.0)

---
updated-dependencies:
- dependency-name: nonebot-plugin-alconna
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-10 21:20:07 +00:00
dependabot[bot]
617d3ec658 ⬆️ Bump ruff from 0.6.8 to 0.6.9 (#461)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.8 to 0.6.9.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.8...0.6.9)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-10 21:16:06 +00:00
dependabot[bot]
57a1992675 ⬆️ Bump rich from 13.9.1 to 13.9.2 (#460)
Bumps [rich](https://github.com/Textualize/rich) from 13.9.1 to 13.9.2.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Textualize/rich/compare/v13.9.1...v13.9.2)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-10 21:11:59 +00:00
dependabot[bot]
8d1d2f329e ⬆️ Bump basedpyright from 1.18.3 to 1.18.4 (#465)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.18.3 to 1.18.4.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.18.3...v1.18.4)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-11 05:07:53 +08:00
dependabot[bot]
fa6cbd5c6d ⬆️ Bump rich from 13.8.1 to 13.9.1 (#459)
Bumps [rich](https://github.com/Textualize/rich) from 13.8.1 to 13.9.1.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Textualize/rich/compare/v13.8.1...v13.9.1)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-03 04:33:33 +08:00
pre-commit-ci[bot]
9f0f0b87f4 ⬆️ auto update by pre-commit hooks (#457)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.7 → v0.6.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.7...v0.6.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-02 15:59:02 +00:00
dependabot[bot]
96c298b1b8 ⬆️ Bump ruff from 0.6.7 to 0.6.8 (#451)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.7 to 0.6.8.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.7...0.6.8)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 15:35:25 +00:00
dependabot[bot]
df5ced235d ⬆️ Bump basedpyright from 1.17.5 to 1.18.3 (#458)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.17.5 to 1.18.3.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.17.5...v1.18.3)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 15:31:34 +00:00
dependabot[bot]
af83c7a2d9 ⬆️ Bump nonebot-adapter-qq from 1.5.1 to 1.5.2 (#455)
Bumps [nonebot-adapter-qq](https://github.com/nonebot/adapter-qq) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/nonebot/adapter-qq/releases)
- [Commits](https://github.com/nonebot/adapter-qq/compare/v1.5.1...v1.5.2)

---
updated-dependencies:
- dependency-name: nonebot-adapter-qq
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 15:26:22 +00:00
dependabot[bot]
bc41a91034 ⬆️ Bump yarl from 1.11.1 to 1.13.1 (#454)
Bumps [yarl](https://github.com/aio-libs/yarl) from 1.11.1 to 1.13.1.
- [Release notes](https://github.com/aio-libs/yarl/releases)
- [Changelog](https://github.com/aio-libs/yarl/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/yarl/compare/v1.11.1...v1.13.1)

---
updated-dependencies:
- dependency-name: yarl
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 15:22:33 +00:00
dependabot[bot]
d97291d1bc ⬆️ Bump aiocache from 0.12.2 to 0.12.3 (#449)
Bumps [aiocache](https://github.com/aio-libs/aiocache) from 0.12.2 to 0.12.3.
- [Release notes](https://github.com/aio-libs/aiocache/releases)
- [Changelog](https://github.com/aio-libs/aiocache/blob/master/.gitchangelog.rc)
- [Commits](https://github.com/aio-libs/aiocache/compare/v0.12.2...v0.12.3)

---
updated-dependencies:
- dependency-name: aiocache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 23:18:54 +08:00
5b56de9de1 🚨 添加一个 noqa( 2024-10-02 03:42:34 +08:00
0898a81331 优化数据库迁移脚本 2024-10-02 03:22:43 +08:00
pre-commit-ci[bot]
d464059c0a ⬆️ auto update by pre-commit hooks (#447)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.6.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.5...v0.6.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-24 06:21:04 +00:00
dependabot[bot]
6ea8b9328c ⬆️ Bump nonebot-plugin-alconna from 0.52.2 to 0.52.3 (#446)
Bumps [nonebot-plugin-alconna](https://github.com/nonebot/plugin-alconna) from 0.52.2 to 0.52.3.
- [Release notes](https://github.com/nonebot/plugin-alconna/releases)
- [Commits](https://github.com/nonebot/plugin-alconna/compare/v0.52.2...v0.52.3)

---
updated-dependencies:
- dependency-name: nonebot-plugin-alconna
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-24 06:18:24 +00:00
dependabot[bot]
773ff5545c ⬆️ Bump ruff from 0.6.6 to 0.6.7 (#445)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.6 to 0.6.7.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.6...0.6.7)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-24 06:14:09 +00:00
dependabot[bot]
94710b938b ⬆️ Bump nonebot-adapter-satori from 0.12.5 to 0.12.6 (#444)
Bumps [nonebot-adapter-satori](https://github.com/nonebot/adapter-satori) from 0.12.5 to 0.12.6.
- [Release notes](https://github.com/nonebot/adapter-satori/releases)
- [Commits](https://github.com/nonebot/adapter-satori/compare/v0.12.5...v0.12.6)

---
updated-dependencies:
- dependency-name: nonebot-adapter-satori
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-24 14:10:06 +08:00
ec09bb734d 📌 将 arclet-alconna 固定至 2.0.0 以下 2024-09-24 14:03:38 +08:00
dependabot[bot]
9e9a642847 ⬆️ Bump pandas from 2.2.2 to 2.2.3 (#443)
Bumps [pandas](https://github.com/pandas-dev/pandas) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/pandas-dev/pandas/releases)
- [Commits](https://github.com/pandas-dev/pandas/compare/v2.2.2...v2.2.3)

---
updated-dependencies:
- dependency-name: pandas
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-21 06:48:48 +00:00
dependabot[bot]
04e0b14e72 ⬆️ Bump ruff from 0.6.5 to 0.6.6 (#442)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.5 to 0.6.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.5...0.6.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-21 14:44:44 +08:00
dependabot[bot]
20ce9c64be ⬆️ Bump nonebot-adapter-onebot from 2.4.4 to 2.4.5 (#440)
Bumps [nonebot-adapter-onebot](https://github.com/nonebot/adapter-onebot) from 2.4.4 to 2.4.5.
- [Release notes](https://github.com/nonebot/adapter-onebot/releases)
- [Commits](https://github.com/nonebot/adapter-onebot/compare/v2.4.4...v2.4.5)

---
updated-dependencies:
- dependency-name: nonebot-adapter-onebot
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 15:16:22 +00:00
dependabot[bot]
8af07bf031 ⬆️ Bump basedpyright from 1.17.4 to 1.17.5 (#441)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.17.4 to 1.17.5.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.17.4...v1.17.5)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 13:20:49 +00:00
pre-commit-ci[bot]
3a904f67ad ⬆️ auto update by pre-commit hooks (#439)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.4 → v0.6.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.4...v0.6.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-19 12:24:51 +00:00
dependabot[bot]
fc9b751ac4 ⬆️ Bump types-lxml from 2024.8.7 to 2024.9.16 (#438)
Bumps [types-lxml](https://github.com/abelcheung/types-lxml) from 2024.8.7 to 2024.9.16.
- [Release notes](https://github.com/abelcheung/types-lxml/releases)
- [Commits](https://github.com/abelcheung/types-lxml/compare/2024.08.07...2024.09.16)

---
updated-dependencies:
- dependency-name: types-lxml
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-19 20:21:19 +08:00
cb4c6b96f0 🔖 1.5.2 2024-09-14 05:10:32 +08:00
dependabot[bot]
25c3777c0f ⬆️ Bump playwright from 1.46.0 to 1.47.0 (#437)
Bumps [playwright](https://github.com/Microsoft/playwright-python) from 1.46.0 to 1.47.0.
- [Release notes](https://github.com/Microsoft/playwright-python/releases)
- [Commits](https://github.com/Microsoft/playwright-python/compare/v1.46.0...v1.47.0)

---
updated-dependencies:
- dependency-name: playwright
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 21:05:13 +00:00
dependabot[bot]
193fd1da2a ⬆️ Bump ruff from 0.6.4 to 0.6.5 (#436)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.4 to 0.6.5.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.4...0.6.5)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 21:02:31 +00:00
dependabot[bot]
2cd609dd40 ⬆️ Bump basedpyright from 1.17.3 to 1.17.4 (#435)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.17.3 to 1.17.4.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.17.3...v1.17.4)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-13 20:58:38 +00:00
a206098805 ️ 试图提高截图速度 2024-09-14 04:50:37 +08:00
dependabot[bot]
d493ba5f0d ⬆️ Bump yarl from 1.11.0 to 1.11.1 (#433)
Bumps [yarl](https://github.com/aio-libs/yarl) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/aio-libs/yarl/releases)
- [Changelog](https://github.com/aio-libs/yarl/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/yarl/compare/v1.11.0...v1.11.1)

---
updated-dependencies:
- dependency-name: yarl
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-11 11:58:41 +00:00
dependabot[bot]
581d1f9674 ⬆️ Bump pandas-stubs from 2.2.2.240807 to 2.2.2.240909 (#434)
Bumps [pandas-stubs](https://github.com/pandas-dev/pandas-stubs) from 2.2.2.240807 to 2.2.2.240909.
- [Changelog](https://github.com/pandas-dev/pandas-stubs/blob/main/docs/release_procedure.md)
- [Commits](https://github.com/pandas-dev/pandas-stubs/compare/v2.2.2.240807...v2.2.2.240909)

---
updated-dependencies:
- dependency-name: pandas-stubs
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-11 11:54:55 +00:00
dependabot[bot]
01c99e8a8c ⬆️ Bump rich from 13.8.0 to 13.8.1 (#432)
Bumps [rich](https://github.com/Textualize/rich) from 13.8.0 to 13.8.1.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Textualize/rich/compare/v13.8.0...v13.8.1)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-11 19:51:24 +08:00
dependabot[bot]
eb3f4bea04 ⬆️ Bump yarl from 1.10.0 to 1.11.0 (#431)
Bumps [yarl](https://github.com/aio-libs/yarl) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/aio-libs/yarl/releases)
- [Changelog](https://github.com/aio-libs/yarl/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/yarl/compare/v1.10.0...v1.11.0)

---
updated-dependencies:
- dependency-name: yarl
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 19:38:35 +00:00
dependabot[bot]
ebbbd68b05 ⬆️ Bump basedpyright from 1.17.2 to 1.17.3 (#430)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.17.2 to 1.17.3.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.17.2...v1.17.3)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-10 03:35:03 +08:00
pre-commit-ci[bot]
10e0eb815e ⬆️ auto update by pre-commit hooks (#422)
* ⬆️ auto update by pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.2 → v0.6.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.2...v0.6.4)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-08 16:49:56 +08:00
dependabot[bot]
a57b04e181 ⬆️ Bump yarl from 1.9.4 to 1.10.0 (#429)
Bumps [yarl](https://github.com/aio-libs/yarl) from 1.9.4 to 1.10.0.
- [Release notes](https://github.com/aio-libs/yarl/releases)
- [Changelog](https://github.com/aio-libs/yarl/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/yarl/compare/v1.9.4...v1.10.0)

---
updated-dependencies:
- dependency-name: yarl
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-08 08:45:09 +00:00
dependabot[bot]
cc2e71f1a5 ⬆️ Bump nonebot-adapter-satori from 0.12.3 to 0.12.5 (#426)
Bumps [nonebot-adapter-satori](https://github.com/nonebot/adapter-satori) from 0.12.3 to 0.12.5.
- [Release notes](https://github.com/nonebot/adapter-satori/releases)
- [Commits](https://github.com/nonebot/adapter-satori/compare/v0.12.3...v0.12.5)

---
updated-dependencies:
- dependency-name: nonebot-adapter-satori
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-08 08:41:25 +00:00
dependabot[bot]
3384263bb2 ⬆️ Bump basedpyright from 1.17.1 to 1.17.2 (#425)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.17.1 to 1.17.2.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.17.1...v1.17.2)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-08 08:37:45 +00:00
dependabot[bot]
68f210dc4f ⬆️ Bump ruff from 0.6.2 to 0.6.4 (#428)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.2 to 0.6.4.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.2...0.6.4)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-08 16:34:07 +08:00
dependabot[bot]
00a85fe3e9 ⬆️ Bump nonebot-plugin-alconna from 0.52.1 to 0.52.2 (#419)
Bumps [nonebot-plugin-alconna](https://github.com/nonebot/plugin-alconna) from 0.52.1 to 0.52.2.
- [Release notes](https://github.com/nonebot/plugin-alconna/releases)
- [Commits](https://github.com/nonebot/plugin-alconna/compare/v0.52.1...v0.52.2)

---
updated-dependencies:
- dependency-name: nonebot-plugin-alconna
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 17:02:45 +00:00
dependabot[bot]
a10a7584ae ⬆️ Bump nonebot-plugin-user from 0.4.2 to 0.4.3 (#418)
Bumps [nonebot-plugin-user](https://github.com/he0119/nonebot-plugin-user) from 0.4.2 to 0.4.3.
- [Release notes](https://github.com/he0119/nonebot-plugin-user/releases)
- [Changelog](https://github.com/he0119/nonebot-plugin-user/blob/main/CHANGELOG.md)
- [Commits](https://github.com/he0119/nonebot-plugin-user/compare/v0.4.2...v0.4.3)

---
updated-dependencies:
- dependency-name: nonebot-plugin-user
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-29 16:58:37 +00:00
dependabot[bot]
95aac5e321 ⬆️ Bump basedpyright from 1.17.0 to 1.17.1 (#417)
Bumps [basedpyright](https://github.com/detachhead/basedpyright) from 1.17.0 to 1.17.1.
- [Release notes](https://github.com/detachhead/basedpyright/releases)
- [Commits](https://github.com/detachhead/basedpyright/compare/v1.17.0...v1.17.1)

---
updated-dependencies:
- dependency-name: basedpyright
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-30 00:56:00 +08:00
89d8c938e2 👷 改成在 CI 中运行 2024-08-28 00:50:19 +08:00
84db42f1ce 👷 改用 basedpyright 2024-08-28 00:40:24 +08:00
dependabot[bot]
0a660922bb ⬆️ Bump nonebot-plugin-alconna from 0.51.4 to 0.52.1 (#411)
Bumps [nonebot-plugin-alconna](https://github.com/nonebot/plugin-alconna) from 0.51.4 to 0.52.1.
- [Release notes](https://github.com/nonebot/plugin-alconna/releases)
- [Commits](https://github.com/nonebot/plugin-alconna/compare/v0.51.4...v0.52.1)

---
updated-dependencies:
- dependency-name: nonebot-plugin-alconna
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 22:35:47 +00:00
dependabot[bot]
56bc98cc79 ⬆️ Bump mypy from 1.11.1 to 1.11.2 (#412)
Bumps [mypy](https://github.com/python/mypy) from 1.11.1 to 1.11.2.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.11.1...v1.11.2)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 22:33:40 +00:00
pre-commit-ci[bot]
be61683b51 ⬆️ auto update by pre-commit hooks (#413)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.1...v0.6.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-27 06:31:38 +08:00
ccd5706a95 🔖 1.5.1 2024-08-26 11:43:51 +08:00
b69240caa5 👷 添加 Pyright 类型检查 2024-08-26 11:41:03 +08:00
49d00f4d0e 添加开发依赖 pyright 2024-08-26 11:38:44 +08:00
389a850025 🐛 修复打过但是没数据的爆炸
为啥会没数据??
2024-08-26 11:38:14 +08:00
20dcc2bc3d 🔖 1.5.0 2024-08-25 23:17:32 +08:00
606dddbca2 适配新赛季 list 2024-08-25 23:16:33 +08:00
25 changed files with 1255 additions and 852 deletions

View File

@@ -4,7 +4,7 @@ on:
push:
jobs:
Mypy:
TypeCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -25,3 +25,8 @@ jobs:
shell: bash
run: |
poetry run mypy ./nonebot_plugin_tetris_stats
- name: Run BasedPyright
shell: bash
run: |
poetry run basedpyright ./nonebot_plugin_tetris_stats/

View File

@@ -7,13 +7,13 @@ ci:
autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks'
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.6.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
stages: [commit]
stages: [pre-commit]
- id: ruff-format
stages: [commit]
stages: [pre-commit]
- repo: https://github.com/nonebot/nonemoji
rev: v0.1.4

View File

@@ -29,7 +29,7 @@ branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def migrate_old_data() -> None:
def migrate_old_data() -> None: # noqa: C901
from json import dumps, loads
Base = automap_base() # noqa: N806
@@ -47,6 +47,9 @@ def migrate_old_data() -> None:
TimeRemainingColumn(),
) as progress,
):
if session.query(OldHistoricalData).count() == 0:
logger.info('空表, 跳过')
return
task_id = progress.add_task('[cyan]Migrating:', total=session.query(OldHistoricalData).count())
pointer = 0
while pointer < session.query(OldHistoricalData).order_by(desc(OldHistoricalData.id)).limit(1).one().id:

View File

@@ -28,12 +28,6 @@ depends_on: str | Sequence[str] | None = None
def upgrade(name: str = '') -> None: # noqa: C901
if name:
return
from nonebot_plugin_tetris_stats.version import __version__
if __version__ != '1.0.3':
msg = '本迁移需要1.0.3版本, 请先锁定版本至1.0.3版本再执行本迁移'
logger.critical(msg)
raise RuntimeError(msg)
from nonebot.compat import PYDANTIC_V2, type_validate_json
from pydantic import BaseModel, ValidationError
@@ -46,10 +40,6 @@ def upgrade(name: str = '') -> None: # noqa: C901
TimeRemainingColumn,
)
from nonebot_plugin_tetris_stats.game_data_processor.schemas import ( # type: ignore[import-untyped]
BaseProcessedData,
)
Base = automap_base() # noqa: N806
Base.prepare(autoload_with=op.get_bind())
HistoricalData = Base.classes.nonebot_plugin_tetris_stats_historicaldata # noqa: N806
@@ -62,18 +52,33 @@ def upgrade(name: str = '') -> None: # noqa: C901
def model_to_json(value: BaseModel) -> str:
return value.json(by_alias=True)
models = BaseProcessedData.__subclasses__()
def json_to_model(value: str) -> BaseModel:
for i in models:
try:
return type_validate_json(i, value)
except ValidationError: # noqa: PERF203
...
raise ValueError
with Session(op.get_bind()) as session:
count = session.query(HistoricalData).count()
if count == 0:
logger.info('空表, 跳过')
return
from nonebot_plugin_tetris_stats.version import __version__
if __version__ != '1.0.3':
msg = '本迁移需要1.0.3版本, 请先锁定版本至1.0.3版本再执行本迁移'
logger.critical(msg)
raise RuntimeError(msg)
from nonebot_plugin_tetris_stats.game_data_processor.schemas import ( # type: ignore[import-untyped]
BaseProcessedData,
)
models = BaseProcessedData.__subclasses__()
def json_to_model(value: str) -> BaseModel:
for i in models:
try:
return type_validate_json(i, value)
except ValidationError: # noqa: PERF203
...
raise ValueError
with Progress(
TextColumn('[progress.description]{task.description}'),
BarColumn(),

View File

@@ -26,12 +26,7 @@ depends_on: str | Sequence[str] | None = None
def upgrade(name: str = '') -> None:
if name:
return
from nonebot_plugin_tetris_stats.version import __version__
if __version__ != '1.0.4':
msg = '本迁移需要1.0.4版本, 请先锁定版本至1.0.4版本再执行本迁移'
logger.critical(msg)
raise RuntimeError(msg)
from nonebot.compat import type_validate_json
from pydantic import ValidationError
from rich.progress import (
@@ -46,8 +41,6 @@ def upgrade(name: str = '') -> None:
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from nonebot_plugin_tetris_stats.game_data_processor.schemas import BaseUser # type: ignore[import-untyped]
with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op:
batch_op.add_column(sa.Column('user_unique_identifier', sa.String(length=32), nullable=True))
batch_op.create_index(
@@ -60,37 +53,48 @@ def upgrade(name: str = '') -> None:
Base.prepare(autoload_with=connection)
HistoricalData = Base.classes.nonebot_plugin_tetris_stats_historicaldata # noqa: N806
models: list[type[BaseUser]] = BaseUser.__subclasses__()
def json_to_model(value: str) -> BaseUser:
for i in models:
try:
return type_validate_json(i, value)
except ValidationError: # noqa: PERF203
...
raise ValueError
with Session(op.get_bind()) as session:
count = session.query(HistoricalData).count()
with Progress(
TextColumn('[progress.description]{task.description}'),
BarColumn(),
MofNCompleteColumn(),
TaskProgressColumn(),
TimeRemainingColumn(),
) as progress:
task_id = progress.add_task('[cyan]Updateing:', total=count)
for i in range(0, count, 100):
for j in session.scalars(
select(HistoricalData).where(HistoricalData.id > i).order_by(HistoricalData.id).limit(100)
):
model = json_to_model(j.game_user)
if count == 0:
logger.info('空表, 跳过')
else:
from nonebot_plugin_tetris_stats.version import __version__
if __version__ != '1.0.4':
msg = '本迁移需要1.0.4版本, 请先锁定版本至1.0.4版本再执行本迁移'
logger.critical(msg)
raise RuntimeError(msg)
from nonebot_plugin_tetris_stats.game_data_processor.schemas import BaseUser # type: ignore[import-untyped]
models: list[type[BaseUser]] = BaseUser.__subclasses__()
def json_to_model(value: str) -> BaseUser:
for i in models:
try:
j.user_unique_identifier = model.unique_identifier
except ValueError:
session.delete(j)
progress.update(task_id, advance=1)
session.commit()
return type_validate_json(i, value)
except ValidationError: # noqa: PERF203
...
raise ValueError
with Progress(
TextColumn('[progress.description]{task.description}'),
BarColumn(),
MofNCompleteColumn(),
TaskProgressColumn(),
TimeRemainingColumn(),
) as progress:
task_id = progress.add_task('[cyan]Updateing:', total=count)
for i in range(0, count, 100):
for j in session.scalars(
select(HistoricalData).where(HistoricalData.id > i).order_by(HistoricalData.id).limit(100)
):
model = json_to_model(j.game_user)
try:
j.user_unique_identifier = model.unique_identifier
except ValueError:
session.delete(j)
progress.update(task_id, advance=1)
session.commit()
with op.batch_alter_table('nonebot_plugin_tetris_stats_historicaldata', schema=None) as batch_op:
batch_op.alter_column('user_unique_identifier', existing_type=sa.VARCHAR(length=32), nullable=False)
logger.success('database upgrade success')

View File

@@ -23,7 +23,7 @@ command = Subcommand(
)
from . import bind, config, query, rank, record # noqa: E402
from . import bind, config, list, query, rank, record # noqa: E402
main_command.add(command)
@@ -31,6 +31,7 @@ __all__ = [
'alc',
'bind',
'config',
'list',
'query',
'rank',
'record',

View File

@@ -1,7 +1,6 @@
from typing import Literal, overload
from uuid import UUID
from msgspec import to_builtins
from nonebot.compat import type_validate_json
from yarl import URL
@@ -87,4 +86,4 @@ async def records(
async def get(url: URL, parameter: Parameter, extra_headers: dict | None = None) -> bytes:
return await Cache.get(url % to_builtins(parameter), extra_headers)
return await Cache.get(url % parameter.to_params(), extra_headers)

View File

@@ -1,7 +1,9 @@
from datetime import datetime
from typing import Literal
from pydantic import BaseModel
from pydantic import BaseModel, Field
from ...typing import Prisecter
class AggregateStats(BaseModel):
@@ -39,11 +41,29 @@ class Garbage(BaseModel):
cleared: int
class P(BaseModel): # what is P
class P(BaseModel):
pri: float
sec: float
ter: float
def to_prisecter(self) -> Prisecter:
return Prisecter(f'{self.pri}:{self.sec}:{self.ter}')
class ArCounts(BaseModel):
bronze: int | None = Field(default=None, alias='1')
silver: int | None = Field(default=None, alias='2')
gold: int | None = Field(default=None, alias='3')
platinum: int | None = Field(default=None, alias='4')
diamond: int | None = Field(default=None, alias='5')
issued: int | None = Field(default=None, alias='100')
top3: int | None = Field(default=None, alias='t3')
top5: int | None = Field(default=None, alias='t5')
top10: int | None = Field(default=None, alias='t10')
top25: int | None = Field(default=None, alias='t25')
top50: int | None = Field(default=None, alias='t50')
top100: int | None = Field(default=None, alias='t100')
class Cache(BaseModel):
status: str

View File

@@ -1,10 +1,15 @@
from typing import Annotated
from typing import Any
from msgspec import Meta, Struct
from pydantic import BaseModel, Field
from ...typing import Prisecter
class Parameter(Struct, omit_defaults=True):
after: str | None = None
before: str | None = None
limit: Annotated[int, Meta(ge=1, le=100)] = 25
class Parameter(BaseModel):
after: Prisecter | None = None
before: Prisecter | None = None
limit: int = Field(default=25, ge=1, le=100)
country: str | None = None
def to_params(self) -> dict[str, Any]:
return self.model_dump(exclude_defaults=True)

View File

@@ -4,22 +4,7 @@ from typing import Literal
from pydantic import BaseModel, Field
from ...typing import Rank, ValidRank
from ..base import FailedModel, P, SuccessModel
class ArCounts(BaseModel):
bronze: int | None = Field(default=None, alias='1')
silver: int | None = Field(default=None, alias='2')
gold: int | None = Field(default=None, alias='3')
platinum: int | None = Field(default=None, alias='4')
diamond: int | None = Field(default=None, alias='5')
issued: int | None = Field(default=None, alias='100')
top3: int | None = Field(default=None, alias='t3')
top5: int | None = Field(default=None, alias='t5')
top10: int | None = Field(default=None, alias='t10')
top25: int | None = Field(default=None, alias='t25')
top50: int | None = Field(default=None, alias='t50')
top100: int | None = Field(default=None, alias='t100')
from ..base import ArCounts, FailedModel, P, SuccessModel
class League(BaseModel):

View File

@@ -7,5 +7,4 @@ class User(BaseModel):
avatar_revision: int | None
banner_revision: int | None
country: str | None
verified: int | None = None
supporter: int

View File

@@ -1,10 +1,21 @@
from functools import partial
from typing import Literal
from nonebot.compat import PYDANTIC_V2
from pydantic import BaseModel, Field
from ...typing import Rank, S1Rank, S1ValidRank
from ..base import SuccessModel
if PYDANTIC_V2:
from pydantic import field_validator
custom_validator = partial(field_validator, mode='before')
else:
from pydantic import validator
custom_validator = partial(validator, pre=True, always=True) # type: ignore[assignment, arg-type]
class PastInner(BaseModel):
season: str
@@ -75,6 +86,13 @@ class NeverRatedData(BaseData):
percentile: Literal[-1]
percentile_rank: Literal['z']
@custom_validator('apm', 'pps', 'vs')
@classmethod
def _(cls, value: float | None) -> float:
if value is None:
return 0
return value
class RatedData(BaseData):
gamesplayed: int

View File

@@ -3,7 +3,7 @@ from typing import Literal
from pydantic import BaseModel, Field
from .base import FailedModel
from .base import ArCounts, FailedModel
from .base import SuccessModel as BaseSuccessModel
@@ -14,13 +14,19 @@ class Badge(BaseModel):
ts: datetime | Literal[False] | None = None
class Discord(BaseModel):
class Connection(BaseModel):
id: str
username: str
display_username: str
class Connections(BaseModel):
discord: Discord | None = None
discord: Connection | None = None
twitch: Connection | None = None
twitter: Connection | None = None
reddit: Connection | None = None
youtube: Connection | None = None
steam: Connection | None = None
class Distinguishment(BaseModel):
@@ -28,9 +34,9 @@ class Distinguishment(BaseModel):
class Data(BaseModel):
id: str = Field(..., alias='_id')
id: str = Field(default=..., alias='_id')
username: str
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop', 'banned']
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop', 'hidden', 'banned']
ts: datetime | None = None
botmaster: str | None = None
badges: list[Badge]
@@ -42,7 +48,6 @@ class Data(BaseModel):
badstanding: bool | None = None
supporter: bool | None = None # osk说是必有, 但实际上不是 fkosk
supporter_tier: int
verified: bool | None = None
avatar_revision: int | None = None
"""This user's avatar ID. Get their avatar at
@@ -57,6 +62,9 @@ class Data(BaseModel):
connections: Connections
friend_count: int | None = None
distinguishment: Distinguishment | None = None
achievements: list[int]
ar: int
ar_counts: ArCounts
class UserInfoSuccess(BaseSuccessModel):

View File

@@ -1,4 +1,4 @@
from typing import Literal
from typing import Literal, NewType
S1ValidRank = Literal[
'x+',
@@ -43,3 +43,5 @@ Records = Literal[
'blitz_recent',
'blitz_progression',
]
Prisecter = NewType('Prisecter', str)

View File

@@ -0,0 +1,91 @@
from nonebot_plugin_alconna import Args, Option, Subcommand
from nonebot_plugin_alconna.uniseg import UniMessage
from nonebot_plugin_session import EventSession
from nonebot_plugin_session_orm import get_session_persist_id # type: ignore[import-untyped]
from ...db import trigger
from ...utils.host import HostPage, get_self_netloc
from ...utils.metrics import get_metrics
from ...utils.render import render
from ...utils.render.schemas.tetrio.user.list_v2 import List, TetraLeague, User
from ...utils.screenshot import screenshot
from .. import alc
from . import command
from .api.leaderboards import by
from .api.schemas.base import P
from .api.schemas.leaderboards import Parameter
from .constant import GAME_TYPE
command.add(
Subcommand(
'list',
Option('--max-tr', Args['max_tr', float], help_text='TR的上限'),
Option('--min-tr', Args['min_tr', float], help_text='TR的下限'),
Option('--limit', Args['limit', int], help_text='查询数量'),
Option('--country', Args['country', str], help_text='国家代码'),
help_text='查询 TETR.IO 段位排行榜',
)
)
@alc.assign('TETRIO.list')
async def _(
event_session: EventSession,
max_tr: float | None = None,
min_tr: float | None = None,
limit: int | None = None,
country: str | None = None,
):
country = country.upper() if country is not None else None
async with trigger(
session_persist_id=await get_session_persist_id(event_session),
game_platform=GAME_TYPE,
command_type='list',
command_args=[
f'{key} {value}'
for key, value in zip(
('--max-tr', '--min-tr', '--limit', '--country'), (max_tr, min_tr, limit, country), strict=True
)
if value is not None
],
):
parameter = Parameter(
# ?: 似乎是只需要 pri 至少 league 榜的返回值只有 pri
after=P(pri=max_tr, sec=0, ter=0).to_prisecter() if max_tr is not None else None,
before=P(pri=min_tr, sec=0, ter=0).to_prisecter() if min_tr is not None else None,
limit=limit or 25,
country=country,
)
league = await by('league', parameter)
async with HostPage(
await render(
'v2/tetrio/user/list',
List(
show_index=True,
users=[
User(
id=i.id,
name=i.username.upper(),
avatar=f'https://tetr.io/user-content/avatars/{i.id}.jpg',
country=i.country,
tetra_league=TetraLeague(
rank=i.league.rank,
tr=round(i.league.tr, 2),
glicko=round(i.league.glicko, 2),
rd=round(i.league.rd, 2),
decaying=i.league.decaying,
pps=(metrics := get_metrics(pps=i.league.pps, apm=i.league.apm, vs=i.league.vs)).pps,
apm=metrics.apm,
apl=metrics.apl,
vs=metrics.vs,
adpl=metrics.adpl,
),
xp=i.xp,
join_at=None,
)
for i in league.data.entries
],
),
)
) as page_hash:
await UniMessage.image(raw=await screenshot(f'http://{get_self_netloc()}/host/{page_hash}.html')).finish()

View File

@@ -104,7 +104,7 @@ async def _( # noqa: PLR0913
session_persist_id=await get_session_persist_id(event_session),
game_platform=GAME_TYPE,
command_type='query',
command_args=[f'--default-template {template}'] if template is not None else [],
command_args=[f'--template {template}'] if template is not None else [],
):
async with get_session() as session:
bind = await query_bind_info(
@@ -131,7 +131,7 @@ async def _(user: NBUser, account: Player, event_session: EventSession, template
session_persist_id=await get_session_persist_id(event_session),
game_platform=GAME_TYPE,
command_type='query',
command_args=[f'--default-template {template}'] if template is not None else [],
command_args=[f'--template {template}'] if template is not None else [],
):
async with get_session() as session:
if template is None:
@@ -209,7 +209,6 @@ async def make_query_image_v2(player: Player) -> bytes:
friend_count=user_info.data.friend_count,
supporter_tier=user_info.data.supporter_tier,
bad_standing=user_info.data.badstanding or False,
verified=user_info.data.verified or False,
playtime=play_time,
join_at=user_info.data.ts,
),

View File

@@ -88,9 +88,7 @@ async def get_tetra_league_data() -> None:
prisecter = P(pri=9007199254740991, sec=9007199254740991, ter=9007199254740991) # * from ch.tetr.io
results: list[BySuccessModel] = []
while True:
model = await limit_by(
'league', Parameter(after=f'{prisecter.pri}:{prisecter.sec}:{prisecter.ter}', limit=100), x_session_id
)
model = await limit_by('league', Parameter(after=prisecter.to_prisecter(), limit=100), x_session_id)
prisecter = model.data.entries[-1].p
results.append(model)
if len(model.data.entries) < 100: # 分页值 # noqa: PLR2004

View File

@@ -32,12 +32,12 @@ command.add(
@alc.assign('TETRIO.rank.all')
async def _(event_session: EventSession, template: Template = 'v1'):
async def _(event_session: EventSession, template: Template | None = None):
async with trigger(
session_persist_id=await get_session_persist_id(event_session),
game_platform=GAME_TYPE,
command_type='rank',
command_args=['--all'],
command_args=['--all'] + ([f'--template {template}'] if template is not None else []),
):
async with get_session() as session:
latest_data = (
@@ -62,7 +62,7 @@ async def _(event_session: EventSession, template: Template = 'v1'):
)
).one()
match template:
case 'v1':
case 'v1' | None:
await UniMessage.image(raw=await make_image_v1(latest_data, compare_data)).finish()
case 'v2':
await UniMessage.image(raw=await make_image_v2(latest_data, compare_data)).finish()

View File

@@ -1,12 +1,14 @@
import sys
from collections.abc import Callable, Coroutine
from os import environ
from platform import system
from re import sub
from typing import Any, ClassVar
from nonebot import get_driver
from nonebot.log import logger
from playwright.__main__ import main
from playwright.async_api import Browser, async_playwright
from playwright.async_api import Browser, BrowserContext, async_playwright
driver = get_driver()
@@ -27,6 +29,7 @@ class BrowserManager:
"""浏览器管理类"""
_browser: Browser | None = None
_contexts: ClassVar[dict[str, BrowserContext]] = {}
@classmethod
async def init_playwright(cls) -> None:
@@ -72,7 +75,11 @@ class BrowserManager:
async def _start_browser(cls) -> Browser:
"""启动浏览器实例"""
playwright = await async_playwright().start()
cls._browser = await playwright.firefox.launch()
cls._browser = await playwright.firefox.launch(
firefox_user_prefs={
'network.http.max-persistent-connections-per-server': 64,
},
)
return cls._browser
@classmethod
@@ -80,8 +87,26 @@ class BrowserManager:
"""获取浏览器实例"""
return cls._browser or await cls._start_browser()
@classmethod
async def get_context(
cls, context_id: str = 'default', factory: Callable[[], Coroutine[Any, Any, BrowserContext]] | None = None
) -> BrowserContext:
"""获取浏览器上下文"""
return cls._contexts.setdefault(
context_id, await factory() if factory is not None else await (await cls.get_browser()).new_context()
)
@classmethod
async def del_context(cls, context_id: str) -> None:
"""删除浏览器上下文"""
if context_id in cls._contexts:
await cls._contexts[context_id].close()
del cls._contexts[context_id]
@classmethod
async def close_browser(cls) -> None:
"""关闭浏览器实例"""
for i in cls._contexts.values():
await i.close()
if isinstance(cls._browser, Browser):
await cls._browser.close()

View File

@@ -21,7 +21,7 @@ class User(BaseModel):
name: str
country: str | None
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop', 'banned']
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop', 'hidden', 'banned']
avatar: str | Avatar
banner: str | None
@@ -31,7 +31,6 @@ class User(BaseModel):
friend_count: int | None
supporter_tier: int
verified: bool
bad_standing: bool
badges: list[Badge]

View File

@@ -26,7 +26,6 @@ class User(BaseModel):
name: str
avatar: str | Avatar
country: str | None
verified: bool
tetra_league: TetraLeague
xp: Number
join_at: datetime | None

View File

@@ -1,4 +1,4 @@
from playwright.async_api import TimeoutError, ViewportSize
from playwright.async_api import BrowserContext, TimeoutError, ViewportSize
from ..config.config import config
from .browser import BrowserManager
@@ -6,13 +6,15 @@ from .retry import retry
from .time_it import time_it
async def context_factory() -> BrowserContext:
return await (await BrowserManager.get_browser()).new_context(device_scale_factor=config.tetris.screenshot_quality)
@retry(exception_type=TimeoutError, reply='截图失败, 重试中')
@time_it
async def screenshot(url: str) -> bytes:
browser = await BrowserManager.get_browser()
async with (
await browser.new_page(device_scale_factor=config.tetris.screenshot_quality) as page,
):
context = await BrowserManager.get_context('screenshot', factory=context_factory)
async with await context.new_page() as page:
await page.goto(url)
size: ViewportSize = await page.evaluate("""
() => {

View File

@@ -1,11 +1,11 @@
from typing import Literal
from typing import Literal, TypeAlias
Number = float | int
GameType = Literal['IO', 'TOP', 'TOS']
BaseCommandType = Literal['bind', 'query']
TETRIOCommandType = BaseCommandType | Literal['rank', 'config', 'list', 'record']
AllCommandType = BaseCommandType | TETRIOCommandType
Me = Literal[
Number: TypeAlias = float | int
GameType: TypeAlias = Literal['IO', 'TOP', 'TOS']
BaseCommandType: TypeAlias = Literal['bind', 'query']
TETRIOCommandType: TypeAlias = BaseCommandType | Literal['rank', 'config', 'list', 'record']
AllCommandType: TypeAlias = BaseCommandType | TETRIOCommandType
Me: TypeAlias = Literal[
'',
'自己',
'我等',

1678
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = 'nonebot-plugin-tetris-stats'
version = '1.4.18'
version = '1.5.3'
description = '一款基于 NoneBot2 的用于查询 Tetris 相关游戏数据的插件'
authors = ['scdhh <wallfjjd@gmail.com>']
readme = 'README.md'
@@ -21,26 +21,28 @@ nonebot-plugin-user = '>=0.2,<0.5'
nonebot-plugin-userinfo = '^0.2.4'
aiocache = '^0.12.2'
aiofiles = '>=23.2.1,<25.0.0'
arclet-alconna = '<2.0.0'
async-lru = '^2.0.4'
httpx = '^0.27.0'
jinja2 = '^3.1.3'
lxml = '^5.1.0'
msgspec = "^0.18.6"
msgspec = '^0.18.6'
pandas = '>=1.4.3,<3.0.0'
pillow = '^10.3.0'
playwright = '^1.41.2'
rich = '^13.7.1'
yarl = "^1.9.4"
yarl = '^1.9.4'
zstandard = '>=0.22,<0.24'
[tool.poetry.group.dev.dependencies]
basedpyright = '^1.17.0'
mypy = '>=1.9'
pandas-stubs = '>=1.5.2,<3.0.0'
ruff = '>=0.3.0'
types-aiofiles = '>=23.2.0.20240106,<25.0.0.0'
types-lxml = '^2024.2.9'
types-pillow = '^10.2.0.20240423'
types-ujson = '^5.9.0'
pandas-stubs = '>=1.5.2,<3.0.0'
nonebot2 = { extras = ['all'], version = '^2.3.0' }
nonebot-adapter-discord = '^0.1.3'
nonebot-adapter-kaiheila = '^0.3.4'
@@ -50,10 +52,10 @@ nonebot-adapter-satori = '>=0.11.4,<0.13.0'
nonebot-plugin-orm = { extras = ['default'], version = '>=0.3,<0.8' }
[tool.poetry.group.debug.dependencies]
matplotlib = "^3.9.2"
matplotlib = '^3.9.2'
memory-profiler = '^0.61.0'
objprint = '^0.2.2'
pyqt6 = "^6.7.1"
pyqt6 = '^6.7.1'
viztracer = '^0.16.2'
[build-system]
@@ -134,5 +136,11 @@ builtins-ignorelist = ['id']
[tool.ruff.format]
quote-style = 'single'
[tool.basedpyright]
pythonVersion = '3.10'
pythonPlatform = 'All'
defineConstant = { PYDANTIC_V2 = true }
typeCheckingMode = 'standard'
[tool.nonebot]
plugins = ['nonebot_plugin_tetris_stats']