Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Q:如何使用这个适配器 #45

Closed
greenhandzdl opened this issue Jul 24, 2023 · 4 comments
Closed

Q:如何使用这个适配器 #45

greenhandzdl opened this issue Jul 24, 2023 · 4 comments
Labels
question Further information is requested

Comments

@greenhandzdl
Copy link

下面是启动报错

07-24 23:55:24 [ERROR] nonebot | QQ Guild | Error while process data from websocket wss://sandbox.api.sgroup.qq.com/websocket. Trying to reconnect...
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 70, in run
    loop.run_until_complete(self._serve())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
> File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/adapters/qqguild/adapter.py", line 151, in _forward_ws
    result = await self._authenticate(bot, ws, shard)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/adapters/qqguild/adapter.py", line 251, in _authenticate
    assert isinstance(
AssertionError: Received unexpected payload: InvalidSession(opcode=<Opcode.INVALID_SESSION: 9>, d=False)
07-24 23:55:24 [ERROR] nonebot | QQ Guild | Error while setup websocket to wss://sandbox.api.sgroup.qq.com/websocket. Trying to reconnect...
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/drivers/none.py", line 70, in run
    loop.run_until_complete(self._serve())
  File "/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
> File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/adapters/qqguild/adapter.py", line 180, in _forward_ws
    self.bot_disconnect(bot)
  File "/mnt/data/project/universal_bot/.venv/lib/python3.11/site-packages/nonebot/internal/adapter/adapter.py", line 70, in bot_disconnect
    raise RuntimeError(f"{bot} not found in adapter {self.get_name()}")
RuntimeError: Bot(type='QQ Guild', self_id=删除) not found in adapter QQ Guild
^C07-24 23:55:26 [INFO] nonebot | Shutting down
07-24 23:55:26 [INFO] nonebot | Waiting for application shutdown.
Shutting down process [140750]...
07-24 23:55:26 [INFO] nonebot | Application shutdown complete.
Stopped reloader.

文件树

➜  universal_bot tree
.
├── adapter-qqguild.config.backup
├── pyproject.toml
├── README.md
└── src
    └── plugins

3 directories, 3 files
➜  universal_bot 
➜  universal_bot cat .env
ENVIRONMENT=dev
DRIVER=~aiohttp



QQGUILD_IS_SANDBOX=true
QQGUILD_BOTS='
[
  {
    "id": "删除",
    "token": "删除",
    "secret": 删除",
    "intent": {
      "guild_messages": true,
      "at_messages": false
    }
  }
]
'
@yanyongyu
Copy link
Member

yanyongyu commented Jul 24, 2023

请确认下你的token是否正确填写了

另外你的bot是否是私域类型,公域请勿使用guild messages的intent

@greenhandzdl
Copy link
Author

token这些都是直接复制的,bot是私域

@yanyongyu
Copy link
Member

鉴权失败的话只能是你的 id、token 或者 intents 填错了,或者你没有配置沙箱环境

@yanyongyu yanyongyu added the question Further information is requested label Jul 25, 2023
@greenhandzdl
Copy link
Author

哦,刚刚上号发现机器人是公域,太久没上号了。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

2 participants