Coder Social home page Coder Social logo

nonebot-plugin-skland-arksign's Introduction

Hi there 👋

  • 🧐 I'm GuGuMur(咕咕mur), or Cateon (cat + pigeon) Huo.
  • 🌱 I'm currently learning CSS & TS & C(C++)...
  • 🤔 Trying to put ideas into practice...
  • 🥲 Only available: SAT. 8:00 p.m. ~ SUN. 6:00 p.m.
  • 🎮 Game in progress: Arknights(CN), Arcaea, osu!, Danmaku Kagura, TouHou Project STGs(as well as Fanmade Games)
  • 🎵 Favored music: TouHou Project's OST (as well as some Fanmade Games!), Eurobeat, Artcore

Metrics

nonebot-plugin-skland-arksign's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nonebot-plugin-skland-arksign's Issues

[Bug]: TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已经仔细阅读插件的 README
  • 我的Python版本满足>= 3.10
  • 我已经将插件和机器人环境依赖都安装到了推荐/最新版本
  • 我确定指令输入并无错误
  • 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。

运行环境

Ubuntu

Nonebot 2 版本

2.0.1

重现步骤

什么都没动过突然出现了这个错误,经检查和问chatgpt应该不是插件的错误是我自己的问题,但是由于是小白再加上ai给的方法都没用,只能在这里问问
立即执行签到操作完成!
签到失败:AsyncConnectionPool.init() got an unexpected keyword argument 'socket_options'

期望的结果是什么?

.

实际的结果是什么?

.

简单的复现代码/链接(可选)

No response

日志记录(可选)

TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'
_GatheringFuture exception was never retrieved
future: <_GatheringFuture finished exception=TypeError("AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'")>
Traceback (most recent call last):
  File "/root/yukino/.venv/lib/python3.10/site-packages/nonebot_plugin_steam_game_status/__init__.py", line 81, in get_status
    async with AsyncClient(verify=False) as client:
  File "/root/yukino/.venv/lib/python3.10/site-packages/httpx/_client.py", line 1397, in __init__
    self._transport = self._init_transport(
  File "/root/yukino/.venv/lib/python3.10/site-packages/httpx/_client.py", line 1445, in _init_transport
    return AsyncHTTPTransport(
  File "/root/yukino/.venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 275, in __init__
    self._pool = httpcore.AsyncConnectionPool(
TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'

补充说明(可选)

No response

允许 github-actions[bot] 直接 push 仓库

在设置里允许
github-actions[bot]
github-actions[bot]@users.noreply.github.com
直接 push 仓库

[main b4d[9](https://github.com/GuGuMur/nonebot-plugin-skland-arksign/actions/runs/7398556132/job/20127944244?pr=42#step:6:10)2d3] :memo: Update changelog
 1 file changed, 25 insertions(+)
remote: error: GH006: Protected branch update failed for refs/heads/main.        
remote: error: Changes must be made through a pull request.        
To https://github.com/GuGuMur/nonebot-plugin-skland-arksign
 ! [remote rejected] main -> main (protected branch hook declined)
error: failed to push some refs to 'https://github.com/GuGuMur/nonebot-plugin-skland-arksign'
Error: Process completed with exit code 1.

[Bug]: 使用 Pydantic V2 会导致 nonebot 本体无法正常启动

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已经仔细阅读插件的 README
  • 我的Python版本满足>= 3.10
  • 我已经将插件和机器人环境依赖都安装到了推荐/最新版本
  • 我确定指令输入并无错误
  • 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。

运行环境

Linux

Nonebot 2 版本

2.1.1

重现步骤

更新 nonebot-plugin-skland-arksign 至 0.7.0
然后 nb run

期望的结果是什么?

正常工作

实际的结果是什么?

报错

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "F:\YC\Code\Nonebot_Project\nonebot-plugin-osu-tournament\.venv\Lib\site-packages\nonebot\adapters\onebot\__init__.py", line 12, in <module>
    from .v11 import Bot as V11Bot
  File "F:\YC\Code\Nonebot_Project\nonebot-plugin-osu-tournament\.venv\Lib\site-packages\nonebot\adapters\onebot\v11\__init__.py", line 15, in <module>
    from .adapter import Adapter as Adapter
  File "F:\YC\Code\Nonebot_Project\nonebot-plugin-osu-tournament\.venv\Lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 31, in <module>
    from nonebot.adapters.onebot.collator import Collator
  File "F:\YC\Code\Nonebot_Project\nonebot-plugin-osu-tournament\.venv\Lib\site-packages\nonebot\adapters\onebot\collator.py", line 10, in <module>
    from pydantic.fields import ModelField
ImportError: cannot import name 'ModelField' from 'pydantic.fields' (F:\YC\Code\Nonebot_Project\nonebot-plugin-osu-tournament\.venv\Lib\site-packages\pydantic\fields.py)

简单的复现代码/链接(可选)

No response

日志记录(可选)

No response

补充说明(可选)

See nonebot/nonebot2#2574
目前 nonebot 本体不兼容 Pydantic V2

[Feature]: cred 缓存与失败重签

起因:

在目前的签到流程中,每次签到都会进行令牌请求,这会在短时间内造成大量的API使用 (yj: 警觉),可能会导致服务器拒绝签到(只能说已经碰到了)。

签到失败:Client error '400 Bad Request' for url 'https://as.hypergryph.com/user/oauth2/v2/grant'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

此外,目前没有机制来识别并重试由于这些特定错误导致的签到失败。
感觉是时候添加缓存机制来存储cred,以及对失败签到在一定时间后重试的功能了。

方案:

  1. 签到时缓存cred: 修改签到流程,将成功签到时获取的cred缓存到数据库。签到时优先使用缓存的cred,如果cred签到失败,则重新使用token请求新的cred并缓存。

  2. 识别失败的签到: 判定特定错误导致的签到失败,例如上文的400 Bad Request。通过分析签到过程中收到的响应,识别错误代码或错误信息等手段实现。

  3. 重试失败的签到: 识别到失败的签到尝试后,将本次失败的签到用户进行记录,创建一个<签到重试间隔>后执行的定时器,对这些用户进行重新签到。对此应该有签到重试间隔最大签到重试次数配置

预期:

  1. 提升性能:缓存cred将减少令牌请求次数,从而提升性能并减少API使用量。
  2. 加快签到流程:使用缓存的cred,签到流程将更快,因为不需要为每次尝试进行令牌请求 降低被yj击毙的可能
  3. 提升用户体验:通过识别并自动重试失败的签到,可以减少发现签到失败之后的手动触发签到操作。

步骤:

  1. 确定缓存cred的位置。
  2. 实现缓存机制,在签到流程中存储、获取、刷新cred。
  3. 识别并记录签到失败的尝试。
  4. 实现重试机制,在固定间隔后对可重签失败重新触发签到。
  5. 实施适当的日志记录和监控,跟踪缓存和重试机制的成功情况。

其他考虑事项:

  • 是否需要记录签到用户的当前签到状态和重签次数,并提供相应的查询命令?

ToDo List:

  • 签到流程中缓存、使用、刷新 cred
  • 强制手动刷新 cred 的命令
  • 自动重签机制

[Bug]:

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已经仔细阅读插件的 README
  • 我的Python版本满足>= 3.10
  • 我已经将插件和机器人环境依赖都安装到了推荐/最新版本
  • 我确定指令输入并无错误
  • 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。

运行环境

Windows (64)

Nonebot 2 版本

2.0.1

重现步骤

根据依赖安装插件后报错,无法启动seesion-saa

期望的结果是什么?

正常启动

实际的结果是什么?

ImportError: cannot import name 'SupportedAdapter' from 'nonebot_plugin_session.const' (C:\Users\Administrator\QQ-bot1.venv\lib\site-packages\nonebot_plugin_session\const.py)

简单的复现代码/链接(可选)

No response

日志记录(可选)

11-28 00:32:42 [ERROR] nonebot | Failed to import "nonebot_plugin_session_saa"
Traceback (most recent call last):
  File "<string>", line 22, in <module>
  File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml
    return load_all_plugins(plugins, plugin_dirs)
  File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins
    return manager.load_all_plugins()
  File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins
    return set(
  File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in <genexpr>
    filter(None, (self.load_plugin(name) for name in self.available_plugins))
> File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot\plugin\manager.py", line 142, in load_plugin
    module = importlib.import_module(name)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot_plugin_session_saa\__init__.py", line 34, in <module>
    from nonebot_plugin_session.const import SupportedAdapter, SupportedPlatform
ImportError: cannot import name 'SupportedAdapter' from 'nonebot_plugin_session.const' (C:\Users\Administrator\QQ-bot1\.venv\lib\site-packages\nonebot_plugin_session\const.py)

补充说明(可选)

已发现为 nonebot_plugin_session更新0.2.2版本后,删除了nonebot_plugin_session\const.py中SupportedAdapter这部分的代码,导致无法启动。根据0.2.1版本内容手动添加后可以正常使用。

适配python3.9申请

#20 same issue
此错误似乎是由 Python 的类型提示引起的,具体来说是使用了 | 符号来表示联合类型。如在这段代码中:token: str | None = None
这里|符号用于 Python 3.10 及更高版本的类型提示,表示 token 变量可以是 str 类型或 NoneType。然而,这在 Python 3.9 及以下版本是不支持的,于是报错:TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
为了后续版本更新跟进,希望能够进行python3.10以下版本的适配。

启动插件时出现类型错误

Traceback (most recent call last):
File "/root/Pallas-Bot/bot.py", line 26, in
nonebot.load_from_toml("pyproject.toml")
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot/plugin/load.py", line 130, in load_from_toml
return load_all_plugins(plugins, plugin_dirs)
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot/plugin/load.py", line 64, in load_all_plugins
return manager.load_all_plugins()
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 176, in load_all_plugins
return set(
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 177, in
filter(None, (self.load_plugin(name) for name in self.available_plugins))
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 142, in load_plugin
module = importlib.import_module(name)
File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot/plugin/manager.py", line 242, in exec_module
super().exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot_plugin_skland_arksign/init.py", line 12, in
from .command import skland as skland
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot_plugin_skland_arksign/command.py", line 13, in
from .sched import sched_sign
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot_plugin_skland_arksign/sched.py", line 10, in
from .utils import run_sign
File "/root/Pallas-Bot/lib/python3.9/site-packages/nonebot_plugin_skland_arksign/utils.py", line 121, in
url: str, method: Literal["get", "post"], body: dict | None, old_header: dict, sign_token: str
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType

nonebot-plugin-session破坏性更新导致插件无法正常使用

安装 nonebot-plugin-skland-arksign 时会自动安装 nonebot_plugin_session==0.2.0,由于其新版本的破坏性更新导致本插件无法正常使用。

10-22 22:20:32 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=nonebot_plugin_skland_arksign.command, lineno=24)
10-22 22:20:32 [INFO] nonebot | AlconnaMatcher(type='', module=nonebot_plugin_skland_arksign.command, lineno=24) running complete
10-22 22:20:32 [ERROR] nonebot | Running AlconnaMatcher(type='', module=nonebot_plugin_skland_arksign.command, lineno=24) failed.
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 201, in run
    uvicorn.run(
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\uvicorn\main.py", line 587, in run
    server.run()
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\uvicorn\server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "C:\Program Files\Python311\Lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 607, in run_forever
    self._run_once()
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 1922, in _run_once
    handle._run()
  File "C:\Program Files\Python311\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 846, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 821, in simple_run
    await handler(
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot\dependencies\__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\si_hen\Desktop\skland\.venv\Lib\site-packages\nonebot_plugin_skland_arksign\command.py", line 43, in add
    user_account = event_session.get_saa_target()
AttributeError: 'Session' object has no attribute 'get_saa_target'

NotImplementedError

09-04 14:44:42 [ERROR] nonebot | Running Matcher(type='message', module=extensive_plugin.nonebot_plugin_skland_arksign.command) failed.
Traceback (most recent call last):
File "D:\BOT\zhenxun_bot\bot.py", line 22, in
nonebot.run()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_init_.py", line 309, in run
get_driver().run(*args, **kwargs)
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\drivers\fastapi.py", line 198, in run
uvicorn.run(
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\main.py", line 578, in run
server.run()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
self.run_forever()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
super().run_forever()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
self._run_once()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1906, in _run_once
handle._run()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 467, in check_and_run_matcher
await _run_matcher(
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 419, in run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 753, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 728, in simple_run
await handler(
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\dependencies_init
.py", line 108, in call
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "D:\BOT\zhenxun_bot\extensive_plugin\nonebot_plugin_skland_arksign\command.py", line 44, in _
user_account = session.get_saa_target()
File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_plugin_session\session.py", line 86, in get_saa_target
raise NotImplementedError
NotImplementedError

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.