Skip to content

Bug: Bot进入新群 配置未初始化 #46

@Hanserprpr

Description

@Hanserprpr

确认事项

  • 我已仔细阅读并了解上述注意事项。
  • 我已使用最新版本测试过,确认问题依旧存在。
  • 我确定在 GitHub Issues 中没有相同或相似的问题。

NoneBot 版本

v2.4.2

Eventmonitor 插件版本号或 Commit ID

v0.4.8

协议端

napcat4.8.94

问题描述

bot在加入新群聊后不会响应
在重启bot后才会写入配置 (调用update_missing_config

复现步骤

使用安装了本插件v0.4.8的bot加入新群聊 执行欢迎自己 戳一戳等动作没有响应 可能需要在加入群聊时初始化

期望的结果

No response

截图或日志

Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]: 07-24 16:25:46 [ERROR] nonebot | Running Matcher(type='notice', module=nonebot_plugin_eventmonitor, lineno=61) failed.
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]: Traceback (most recent call last):
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "<string>", line 17, in <module>
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 337, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     get_driver().run(*args, **kwargs)
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/drivers/fastapi.py", line 187, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     uvicorn.run(
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 580, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     server.run()
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     return asyncio.run(self.serve(sockets=sockets))
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     return runner.run(main)
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     return self._loop.run_until_complete(task)
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/utils.py", line 254, in run_coro_with_shield
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     return await coro
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/message.py", line 506, in check_and_run_matcher
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     await _run_matcher(
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]: > File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/message.py", line 458, in _run_matcher
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     await matcher.run(bot, event, state, stack, dependency_cache)
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 926, in run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     await self.simple_run(bot, event, state, stack, dependency_cache)
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 863, in simple_run
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     await handler(
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot_plugin_eventmonitor/handle.py", line 110, in add_user
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     if not (await utils.check_add_user(utils.g_temp, str(event.group_id))):
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:   File "/www/bot/Grade/.venv/lib/python3.11/site-packages/nonebot_plugin_eventmonitor/config.py", line 186, in check_add_user
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]:     return g_temp[gid]['add_user']
Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]: KeyError: '***********'群号打码Jul 24 16:25:46 RainYun-pGuanxBf nb[1508505]: 07-24 16:25:46 [DEBUG] nonebot | Checking for matchers completed

额外补充

No response

参与贡献

  • 我有足够的时间和能力,愿意为此提交 PR 来修复问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions