HibiKier / zhenxun_bot

基于 Nonebot2 开发,非常可爱的绪山真寻bot
GNU Affero General Public License v3.0
3.35k stars 605 forks source link

签到报错 #1321

Closed PackageInstaller closed 1 year ago

PackageInstaller commented 1 year ago

系统版本:6.2.5-arch1-1

真寻版本:0.1.6.7

错误截图

Screenshot_20230315_115111

日志截图

03-15 11:50:52 [ERROR] nonebot | Running Matcher(type='message', module=plugins.sign_in) failed. Traceback (most recent call last):

File "/home/Neko/QQBot/zhenxun_bot/bot.py", line 21, in nonebot.run() │ └ <function run at 0x7f3f0756fd90> └ <module 'nonebot' from '/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/noneb...

File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/init.py", line 273, in run get_driver().run(*args, **kwargs) │ │ └ {} │ └ () └ <function get_driver at 0x7f3f0756f6d0> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 172, in run uvicorn.run( │ └ <function run at 0x7f3f06272a70> └ <module 'uvicorn' from '/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/uvico... File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run server.run() │ └ <function Server.run at 0x7f3f06272c20> └ <uvicorn.server.Server object at 0x7f3e16b43580> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) │ │ │ │ └ None │ │ │ └ <function Server.serve at 0x7f3f06272cb0> │ │ └ <uvicorn.server.Server object at 0x7f3e16b43580> │ └ <function run at 0x7f3f08695630> └ <module 'asyncio' from '/usr/lib/python3.10/asyncio/init.py'> File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) │ │ └ <coroutine object Server.serve at 0x7f3e16b6e500> │ └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects> └ File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) │ │ │ │ │ │ └ {<function _command at 0x7f3f0724f6d0>: <Task finished name='Task-38622' coro=<_command() done, defined at /home/Neko/.cache/... │ │ │ │ │ └ <contextlib.AsyncExitStack object at 0x7f3eff40ae00> │ │ │ │ └ {'_prefix': {'command': None, 'raw_command': None, 'command_arg': None, 'command_start': None}, '_matched': '签到', '_matched_g... │ │ │ └ GroupMessageEvent(time=1678852275, self_id=3042447114, post_type='message', sub_type='normal', user_id=3042447114, message_ty... │ │ └ Bot(type='OneBot V11', self_id='3042447114') │ └ Matcher(type='message', module=plugins.sign_in) └ <function _run_matcher at 0x7f3f0719ab90>

File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) │ │ │ │ │ │ └ {<function _command at 0x7f3f0724f6d0>: <Task finished name='Task-38622' coro=<_command() done, defined at /home/Neko/.cache/... │ │ │ │ │ └ <contextlib.AsyncExitStack object at 0x7f3eff40ae00> │ │ │ │ └ {'_prefix': {'command': None, 'raw_command': None, 'command_arg': None, 'command_start': None}, '_matched': '签到', '_matched_g... │ │ │ └ GroupMessageEvent(time=1678852275, self_id=3042447114, post_type='message', sub_type='normal', user_id=3042447114, message_ty... │ │ └ Bot(type='OneBot V11', self_id='3042447114') │ └ <function Matcher.run at 0x7f3f0724f370> └ Matcher(type='message', module=plugins.sign_in) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) │ │ │ │ │ │ └ {<function _command at 0x7f3f0724f6d0>: <Task finished name='Task-38622' coro=<_command() done, defined at /home/Neko/.cache/... │ │ │ │ │ └ <contextlib.AsyncExitStack object at 0x7f3eff40ae00> │ │ │ │ └ {'_prefix': {'command': None, 'raw_command': None, 'command_arg': None, 'command_start': None}, '_matched': '签到', '_matched_g... │ │ │ └ GroupMessageEvent(time=1678852275, self_id=3042447114, post_type='message', sub_type='normal', user_id=3042447114, message_ty... │ │ └ Bot(type='OneBot V11', self_id='3042447114') │ └ <function Matcher.simple_run at 0x7f3f0724f2e0> └ Matcher(type='message', module=plugins.sign_in) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 702, in simplerun await handler( └ Dependent(call=) File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) │ │ │ │ │ │ └ {'event': GroupMessageEvent(time=1678852275, self_id=3042447114, post_type='message', sub_type='normal', userid=3042447114, ... │ │ │ │ │ └ <function at 0x7f3ecb293370> │ │ │ │ └ Dependent(call=_) │ │ │ └ ~R │ │ └ typing.Awaitable │ └ typing.Callable └ <function cast at 0x7f3f08719480>

File "/home/Neko/QQBot/zhenxun_bot/plugins/signin/init.py", line 117, in await group_user_check_in(nickname, event.user_id, event.group_id), │ │ │ │ │ └ 781618760 │ │ │ │ └ GroupMessageEvent(time=1678852275, self_id=3042447114, post_type='message', sub_type='normal', user_id=3042447114, message_ty... │ │ │ └ 3042447114 │ │ └ GroupMessageEvent(time=1678852275, self_id=3042447114, post_type='message', sub_type='normal', user_id=3042447114, message_ty... │ └ '绪山真寻' └ <function group_user_check_in at 0x7f3ecb292560>

File "/home/Neko/QQBot/zhenxun_bot/plugins/sign_in/group_user_checkin.py", line 40, in group_user_check_in return await _handle_check_in(nickname, user_qq, group, present) # ok │ │ │ │ └ datetime.datetime(2023, 3, 15, 11, 50, 51, 124019) │ │ │ └ 781618760 │ │ └ 3042447114 │ └ '绪山真寻' └ <function _handle_check_in at 0x7f3ecb292c20>

File "/home/Neko/QQBot/zhenxun_bot/plugins/sign_in/group_user_checkin.py", line 93, in _handle_check_in return await get_card(user, nickname, impression_added, gold, gift) │ │ │ │ │ └ '额外金币 + 1' │ │ │ │ └ 61 │ │ │ └ 0.85 │ │ └ '绪山真寻' │ └ <SignGroupUser: 514> └ <function get_card at 0x7f3ecb2928c0>

File "/home/Neko/QQBot/zhenxun_bot/plugins/sign_in/utils.py", line 87, in get_card uid = await GroupInfoUser.get_group_member_uid(user.user_qq, user.group_id) │ │ │ │ │ └ 781618760 │ │ │ │ └ <SignGroupUser: 514> │ │ │ └ 3042447114 │ │ └ <SignGroupUser: 514> │ └ <classmethod(<function GroupInfoUser.get_group_member_uid at 0x7f3ed10fadd0>)> └ <class 'models.group_member_info.GroupInfoUser'>

File "/home/Neko/QQBot/zhenxun_bot/models/group_member_info.py", line 98, in get_group_member_uid _max_uiduser, = await cls.get_or_create(user_qq=114514, group_id=114514) │ └ <classmethod(<function Model.get_or_create at 0x7f3f06b58b80>)> └ <class 'models.group_member_info.GroupInfoUser'>

File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/tortoise/models.py", line 1059, in get_or_create await cls.select_for_update().filter(**kwargs).using_db(connection).get(), │ │ │ └ <tortoise.backends.asyncpg.client.TransactionWrapper object at 0x7f3e15e378e0> │ │ └ {'user_qq': 114514, 'group_id': 114514} │ └ <classmethod(<function Model.select_for_update at 0x7f3f06b58c10>)> └ <class 'models.group_member_info.GroupInfoUser'> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/tortoise/queryset.py", line 1008, in _execute instance_list = await self._db.executor_class( │ └ <member '_db' of 'QuerySet' objects> └ <tortoise.queryset.QuerySet object at 0x7f3e16b77450> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/tortoise/backends/base/executor.py", line 139, in execute_select instance: "Model" = self.model._init_from_db( │ │ └ <classmethod(<function Model._init_from_db at 0x7f3f06b5ff40>)> │ └ <class 'models.group_member_info.GroupInfoUser'> └ <tortoise.backends.asyncpg.executor.AsyncpgExecutor object at 0x7f3f01c5ad40> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/tortoise/models.py", line 742, in _init_from_db setattr(self, model_field, field.to_python_value(kwargs[key])) │ │ │ │ │ └ 'user_join_time' │ │ │ │ └ {'user_join_time': datetime.datetime(1, 1, 1, 0, 0), 'id': 1, 'user_name': '', 'uid': 332, 'user_qq': 114514, 'group_id': 114... │ │ │ └ <function DatetimeField.to_python_value at 0x7f3f06fa9000> │ │ └ <tortoise.fields.data.DatetimeField object at 0x7f3ed0f22620> │ └ 'user_join_time' └ <GroupInfoUser: 1> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/tortoise/fields/data.py", line 365, in to_python_value value = timezone.make_aware(value, get_timezone()) │ │ │ └ <function get_timezone at 0x7f3f06f72c20> │ │ └ datetime.datetime(1, 1, 1, 0, 0) │ └ <function make_aware at 0x7f3f06fa8280> └ <module 'tortoise.timezone' from '/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-pack... File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/tortoise/timezone.py", line 97, in make_aware return tz.localize(value, is_dst=is_dst) │ │ │ └ None │ │ └ datetime.datetime(1, 1, 1, 0, 0) │ └ <function DstTzInfo.localize at 0x7f3f06f71630> └ <DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD> File "/home/Neko/.cache/pypoetry/virtualenvs/zhenxun-bot-PzlhPUjk-py3.10/lib/python3.10/site-packages/pytz/tzinfo.py", line 323, in localize loc_dt = dt + delta │ └ datetime.timedelta(days=-1) └ datetime.datetime(1, 1, 1, 0, 0)

OverflowError: date value out of range

错误说明

看起来已经加进数据库了,但是图没有发出来

PackageInstaller commented 1 year ago

尝试解决: update group_info_users set user_join_time=NULL where user_qq = '114514' update group_info_users set user_join_time=NULL where group_id = '114514' 附上图 image

PackageInstaller commented 1 year ago

呃呃,好了一天又寄了

Nenot233 commented 1 year ago

03-25 12:27:46 [ERROR] nonebot | Running Matcher(type='message', module=plugins.sign_in) failed. Traceback (most recent call last): File "D:\BOT\zhenxun_bot\bot.py", line 22, in nonebot.run() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot__init__.py", line 273, in run get_driver().run(*args, *kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\drivers\fastapi.py", line 172, in run uvicorn.run( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\uvicorn\main.py", line 569, in run server.run() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 634, in run_until_complete self.run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 601, in run_forever self._run_once() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1905, in _run_once handle._run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run await handler( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\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\plugins\sign_in\init_.py", line 117, in await group_user_check_in(nickname, event.user_id, event.group_id), File "D:\BOT\zhenxun_bot\plugins\sign_in\group_user_checkin.py", line 40, in group_user_check_in return await _handle_check_in(nickname, user_qq, group, present) # ok File "D:\BOT\zhenxun_bot\plugins\sign_in\group_user_checkin.py", line 65, in _handle_checkin user, = await SignGroupUser.get_or_create(user_qq=user_qq, group_id=group) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\models.py", line 1059, in get_or_create await cls.select_for_update().filter(**kwargs).using_db(connection).get(), File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\queryset.py", line 1008, in _execute instance_list = await self._db.executor_class( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\executor.py", line 139, in execute_select instance: "Model" = self.model._init_from_db( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\models.py", line 742, in _init_from_db setattr(self, model_field, field.to_python_value(kwargs[key])) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\fields\data.py", line 365, in to_python_value value = timezone.make_aware(value, get_timezone()) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\timezone.py", line 97, in make_aware return tz.localize(value, is_dst=is_dst) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\pytz\tzinfo.py", line 323, in localize loc_dt = dt + delta OverflowError: date value out of range 我也遇到了

PackageInstaller commented 1 year ago

而且这个报错有的人会有有的人没有,不知道怎么回事

HibiKier commented 1 year ago

更新

PackageInstaller commented 1 year ago

更新

已是最新版真寻,将项目中signin插件单独下载覆盖后还是上面的报错

INSide-734 commented 1 year ago

报错+1

Nenot233 commented 1 year ago

而且这个报错有的人会有有的人没有,不知道怎么回事

随机挑选幸运观众,目前我也是这个问题,将项目中signin插件单独下载覆盖后还是上面的报错

MobiusT commented 1 year ago

目前我进行的尝试:

  1. win系统直接git clone部署1.6.7,使用独立数据库(正常)

  2. linux 检查更新真寻升级至1.6.7,并替换包括model/sign_group_user 和plugin/sign_in 在内的昨天之前的所有commit(无效)

  3. 手动将表字段签到时间由-infinity改成2023-1-1后签到(可行,但新用户使用道具后仍会复现)

  4. 修改表字段默认值为0001-1-1(无效)

  5. 删除原表后重启真寻,待自动建表后回导数据,并且将主键id的seq指向正确位置(无效)

  6. 卸载并重装tortoise-orm,更新pytz至2022.7.1依赖(无效)

结论:至今没找到为什么我的win环境正常,linux环境不行,因为已知有人linux环境正常,所以排除了系统原因,实际原因仍未找到(心态爆炸

PackageInstaller commented 1 year ago

我在一个第三方插件中也遇到了这个问题 Issues链接 https://github.com/sophisticate9008/draw_wife/issues/9#issuecomment-1484548021

作者给出了一个方法,不知是否有效,等我上课完回去试试

MobiusT commented 1 year ago

我在一个第三方插件中也遇到了这个问题 Issues链接 https://github.com/sophisticate9008/draw_wife/issues/9#issuecomment-1484548021

作者给出了一个方法,不知是否有效,等我上课完回去试试

不用试了 那三句话就是我打的,对应上面第六点 无效

PackageInstaller commented 1 year ago

我在一个第三方插件中也遇到了这个问题 Issues链接 sophisticate9008/draw_wife#9 (comment) 作者给出了一个方法,不知是否有效,等我上课完回去试试

不用试了 那三句话就是我打的,对应上面第六点 无效

行吧,那就等大佬们修了

MobiusT commented 1 year ago

提供一个可能可行的办法:

  1. 既有数据处理: UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'

  2. 新增数据处理: 如图修改models/sign_group_user.py后重启 image

不能保证一定修复,请注意备份源文件

PackageInstaller commented 1 year ago

提供一个可能可行的办法:

  1. 既有数据处理: UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'
  2. 新增数据处理: 如图修改models/sign_group_user.py后重启 image

不能保证一定修复,请注意备份源文件

好的,我现在马上试试

PackageInstaller commented 1 year ago

提供一个可能可行的办法:

  1. 既有数据处理: UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'
  2. 新增数据处理: 如图修改models/sign_group_user.py后重启 image

不能保证一定修复,请注意备份源文件

操作后还是报错(有记入数据库,但是发不出图),以下是报错截图及log image image

Screenshot_20230329_222522 Screenshot_20230329_222529 Screenshot_20230329_222539 2023-03-29 (1).log(今日的log文件过大,所以我截图了报错的那部分)

然后我自己签到后还是那报错 Screenshot_20230329_224320

MobiusT commented 1 year ago

上面是获取头像的网络问题 下面的你看下数据库里这条数据内容

PackageInstaller commented 1 year ago

上面是获取头像的网络问题 下面的你看下数据库里这条数据内容

image

PackageInstaller commented 1 year ago

更迷的是这个报错不仅会出现在签到中 image

MobiusT commented 1 year ago

这就比较迷惑了 我这么修改可以正常使用

PackageInstaller commented 1 year ago

我是不是可以考虑格库重装真寻了(((

MobiusT commented 1 year ago

是我眼瞎了 ,今天才发现,后面报的错和之前的不是同一个表,可以尝试下 UPDATE "group_info_users" SET "user_join_time" = '0001-01-02 00:00:00+08:05:43' WHERE "user_join_time" ='-infinity'

PackageInstaller commented 1 year ago

是我眼瞎了 ,今天才发现,后面报的错和之前的不是同一个表,可以尝试下 UPDATE "group_info_users" SET "user_join_time" = '0001-01-02 00:00:00+08:05:43' WHERE "user_join_time" ='-infinity'

好了好了,感谢大佬

Nenot233 commented 1 year ago

上面是获取头像的网络问题 下面的你看下数据库里这条数据内容

image

想询问一下这个表要怎么看,我应该也是这个情况 以及这个指令需要在哪使用?

PackageInstaller commented 1 year ago

上面是获取头像的网络问题 下面的你看下数据库里这条数据内容

image

想询问一下这个表要怎么看,我应该也是这个情况 以及这个指令需要在哪使用?

数据库里面用 select * from group_info_users where user_qq = xxx

示例:image

Nenot233 commented 1 year ago

image 目前我找到了,但是这个数据后面一部分都是-infinity 这个有办法处理吗?

PackageInstaller commented 1 year ago

image 目前我找到了,但是这个数据后面一部分都是-infinity 这个有办法处理吗?

https://github.com/HibiKier/zhenxun_bot/issues/1321#issuecomment-1506522000

PackageInstaller commented 1 year ago

image 目前我找到了,但是这个数据后面一部分都是-infinity 这个有办法处理吗?

#1321 (comment)

这个指令用过了,无效

哥啊,不是让你照抄啊,你要根据你实际情况来改,你这出问题的是checkin_time_last而不是user_join_t ime

Nenot233 commented 1 year ago

UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity' 解决

Nenot233 commented 1 year ago

UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity' 解决

04-20 22:36:33 [ERROR] nonebot | Running Matcher(type='message', module=plugins.sign_in) failed. Traceback (most recent call last): File "D:\BOT\zhenxun_bot\bot.py", line 22, in nonebot.run() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot__init__.py", line 273, in run get_driver().run(*args, *kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\drivers\fastapi.py", line 172, in run uvicorn.run( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\uvicorn\main.py", line 569, in run server.run() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 634, in run_until_complete self.run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 601, in run_forever self._run_once() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1905, in _run_once handle._run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run await handler( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\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\plugins\sign_in\init_.py", line 117, in await group_user_check_in(nickname, event.user_id, event.group_id), File "D:\BOT\zhenxun_bot\plugins\sign_in\group_user_checkin.py", line 40, in group_user_check_in return await _handle_check_in(nickname, user_qq, group, present) # ok File "D:\BOT\zhenxun_bot\plugins\sign_in\group_user_checkin.py", line 65, in _handle_checkin user, = await SignGroupUser.get_or_create(user_qq=user_qq, group_id=group) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\models.py", line 1059, in get_or_create await cls.select_for_update().filter(**kwargs).using_db(connection).get(), File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\queryset.py", line 1008, in _execute instance_list = await self._db.executor_class( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\executor.py", line 139, in execute_select instance: "Model" = self.model._init_from_db( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\models.py", line 742, in _init_from_db setattr(self, model_field, field.to_python_value(kwargs[key])) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\fields\data.py", line 365, in to_python_value value = timezone.make_aware(value, get_timezone()) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\timezone.py", line 97, in make_aware return tz.localize(value, is_dst=is_dst) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\pytz\tzinfo.py", line 323, in localize loc_dt = dt + delta OverflowError: date value out of range

但是还是会报错,复现了上面的情况表字段签到时间由-infinity改成0001-01-02 00:00:00+08:05:43后签到(可行,但新用户使用道具/签到后仍会复现) 就是不太明白是如何找group_info_users的思路,表报错是如何看的

PackageInstaller commented 1 year ago

UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity' 解决

04-20 22:36:33 [ERROR] nonebot | Running Matcher(type='message', module=plugins.sign_in) failed. Traceback (most recent call last): File "D:\BOT\zhenxun_bot\bot.py", line 22, in nonebot.run() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebotinit.py", line 273, in run get_driver().run(*args, *kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\drivers\fastapi.py", line 172, in run uvicorn.run( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\uvicorn\main.py", line 569, in run server.run() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 634, in run_until_complete self.run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 601, in run_forever self._run_once() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1905, in _run_once handle._run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run await handler( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\dependenciesinit.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(values) File "D:\BOT\zhenxun_bot\plugins\signininit.py", line 117, in await group_user_check_in(nickname, event.user_id, event.group_id), File "D:\BOT\zhenxun_bot\plugins\sign_in\group_user_checkin.py", line 40, in group_user_check_in return await _handle_check_in(nickname, user_qq, group, present) # ok File "D:\BOT\zhenxun_bot\plugins\sign_in\group_user_checkin.py", line 65, in _handle_checkin user, = await SignGroupUser.get_or_create(user_qq=user_qq, group_id=group) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\models.py", line 1059, in get_or_create await cls.select_for_update().filter(kwargs).using_db(connection).get(), File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\queryset.py", line 1008, in _execute instance_list = await self._db.executor_class( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\executor.py", line 139, in execute_select instance: "Model" = self.model._init_from_db( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\models.py", line 742, in _init_from_db setattr(self, model_field, field.to_python_value(kwargs[key])) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\fields\data.py", line 365, in to_python_value value = timezone.make_aware(value, get_timezone()) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\timezone.py", line 97, in make_aware return tz.localize(value, is_dst=is_dst) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\pytz\tzinfo.py", line 323, in localize loc_dt = dt + delta OverflowError: date value out of range

但是还是会报错,复现了上面的情况表字段签到时间由-infinity改成0001-01-02 00:00:00+08:05:43后签到(可行,但新用户使用道具后仍会复现) 就是不太明白是如何找group_info_users的思路,表报错是如何看的

新用户使用道具会报错嘛,我试试

Nenot233 commented 1 year ago

还包括签到

Nenot233 commented 1 year ago

1682038294687 目前新用户报错是这样的

PackageInstaller commented 1 year ago

1682038294687 目前新用户报错是这样的

你再去对应的表看看还有没有负无穷的时间,改正常,然后按照https://github.com/HibiKier/zhenxun_bot/issues/1321#issuecomment-1488509084 的第二点改一下试试

Nenot233 commented 1 year ago

04-21 12:41:01 [ERROR] nonebot | Error when running RunPreProcessors. Running cancelled! Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 173, in _run_matcher await asyncio.gather(*coros) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\utils.py", line 157, in run_coro_with_catch return await coro File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\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\basic_plugins\hooks\authhook.py", line 21, in await AuthChecker().auth(matcher, bot, event) File "D:\BOT\zhenxun_bot\basic_plugins\hooks_utils.py", line 157, in auth await self.auth_basic(plugin_name, bot, event) File "D:\BOT\zhenxun_bot\basic_plugins\hooks_utils.py", line 518, in auth_basic or await BanUser.is_ban(user_id) File "D:\BOT\zhenxun_bot\models\ban_user.py", line 72, in is_ban if await cls.check_ban_time(user_qq): File "D:\BOT\zhenxun_bot\models\ban_user.py", line 52, in check_ban_time if user := await cls.filter(user_qq=user_qq).first(): File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\queryset.py", line 1008, in _execute instance_list = await self._db.executor_class( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\executor.py", line 131, in executeselect , raw_results = await self.db.execute_query(query.get_sql()) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base_postgres\client.py", line 34, in _translate_exceptions return await self._translate_exceptions(func, *args, *kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\asyncpg\client.py", line 82, in _translate_exceptions return await func(self, args, kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\asyncpg\client.py", line 129, in execute_query async with self.acquire_connection() as connection: File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\client.py", line 328, in aenter self.connection = await self.pool.acquire() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\asyncpg\pool.py", line 838, in _acquire raise exceptions.InterfaceError('pool is closing') asyncpg.exceptions._base.InterfaceError: pool is closing 04-21 12:41:01 [ERROR] nonebot | Error when running RunPreProcessors. Running cancelled! Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\message.py", line 173, in _run_matcher await asyncio.gather(*coros) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\nonebot\utils.py", line 157, in run_coro_with_catch return await coro File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\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\basic_plugins\hooks\authhook.py", line 21, in await AuthChecker().auth(matcher, bot, event) File "D:\BOT\zhenxun_bot\basic_plugins\hooks_utils.py", line 157, in auth await self.auth_basic(plugin_name, bot, event) File "D:\BOT\zhenxun_bot\basic_plugins\hooks_utils.py", line 518, in auth_basic or await BanUser.is_ban(user_id) File "D:\BOT\zhenxun_bot\models\ban_user.py", line 72, in is_ban if await cls.check_ban_time(user_qq): File "D:\BOT\zhenxun_bot\models\ban_user.py", line 52, in check_ban_time if user := await cls.filter(user_qq=user_qq).first(): File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\queryset.py", line 1008, in _execute instance_list = await self._db.executor_class( File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\executor.py", line 131, in executeselect , raw_results = await self.db.execute_query(query.get_sql()) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base_postgres\client.py", line 34, in _translate_exceptions return await self._translate_exceptions(func, *args, *kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\asyncpg\client.py", line 82, in _translate_exceptions return await func(self, args, kwargs) File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\asyncpg\client.py", line 129, in execute_query async with self.acquire_connection() as connection: File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\tortoise\backends\base\client.py", line 328, in aenter__ self.connection = await self.pool.acquire() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\asyncpg\pool.py", line 839, in _acquire self._check_init() File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-l9AehN_x-py3.9\lib\site-packages\asyncpg\pool.py", line 964, in _check_init raise exceptions.InterfaceError('pool is closed') asyncpg.exceptions._base.InterfaceError: pool is closed

会跟这个报错有关系吗?

PackageInstaller commented 1 year ago

这个报错我有时也有,但是不影响的样子?

Nenot233 commented 1 year ago

image image 目前是使用“UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'”可以解决-infinity的问题 但是当新增用户的时候,还是会出现这个情况,继续用“UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'”后签到两次可以解决 只是不太明白这个有一劳永逸的解决方案吗,还是因为这有可能是某些插件影响到了数据库

PackageInstaller commented 1 year ago

image image 目前是使用“UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'”可以解决-infinity的问题 但是当新增用户的时候,还是会出现这个情况,继续用“UPDATE "sign_group_users" SET "checkin_time_last" = '0001-01-02 00:00:00+08:05:43' WHERE "checkin_time_last" ='-infinity'”后签到两次可以解决 只是不太明白这个有一劳永逸的解决方案吗,还是因为这有可能是某些插件影响到了数据库

我刚刚找了新用户测试了签到和使用道具,没问题,你有按照

https://github.com/HibiKier/zhenxun_bot/issues/1321#issuecomment-1488509084

的第二点来修改代码吗

Nenot233 commented 1 year ago

有的,上面代码截图已经改了

PackageInstaller commented 1 year ago

那你再看看 "sign_group_users"这个表里面有没有-inf,改正常,再去”group_info_users“这个表也看看,有问题都改回来再去测试看看?

MobiusT commented 1 year ago

asyncpg.exceptions._base.InterfaceError: pool is closed

会跟这个报错有关系吗?

#15

关于签到问题如果仍然不行的话建议回退版本或者等后续阿咪重构这块功能 目前已知三人均能按之前我提供的方法提供,没法复现出你的问题