问题
在启动时报错.
已多次检查mirai以及mirai-api-http的配置,并使用不同版本的py尝试运行,且更新了框架,仍无法解决问题. 也无法在日志中找出问题的关键.
看了closed的issue无果(如果是我看漏了拜托指个路)
(曾经可以在此环境下运行)
使用环境:
- 系统:
- MAH 版本: 请原谅我不知道什么是mah,如果是mirai的话,版本应该是:2.13.2
- Ariadne 版本: 0.10.2
- Python 版本: 3.9.13
- 其他 Graia 库版本:
- graia-amnesia 0.7.1
- graia-ariadne 0.10.2
- graia-broadcast 0.19.1
- graia-saya 0.0.17
- graia-scheduler 0.1.4
- 其他 有关 库版本:
- mirai-api-http-2.6.2
- mcl-addon-2.1.1
- 系统版本: windows server 2012r2
日志/截图
日志:
Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。
C:\Users\Administrator\Desktop\QMGR\bot>python bot.py
C:\Users\Administrator\Desktop\QMGR\bot>C:\Users\Administrator\AppData\Local\Pro
grams\Python\Python39\python bot.py
2023-01-03 20:50:06.938 | INFO | launart.manager:launch_blocking:480 - Start
ing launart main task...
2023-01-03 20:50:06.938 | INFO | launart.manager:launch:333 - Launching 5 co
mponents as async task...
2023-01-03 20:50:07.000 | INFO | graia.ariadne.service:base_telemetry:144 -
_ _ _
/ \ _ __(_) __ _ __| |_ __ ___
/ _ \ | '__| |/ _` |/ _` | '_ \ / _ \
/ ___ \| | | | (_| | (_| | | | | __/
/_/ \_\_| |_|\__,_|\__,_|_| |_|\___|
graia-amnesia: 0.7.1
graia-ariadne: 0.10.2
graia-broadcast: 0.19.1
launart: 0.6.2
statv: 0.3.2
2023-01-03 20:50:07.000 | INFO | launart.manager:_launchable_task_done_callback:68 - [elizabeth.connection.3520295800.http_client_connection] completed.
2023-01-03 20:50:07.000 | SUCCESS | launart.manager:launch:385 - Layer #1:[cache.client/memcache, http.client/aiohttp] preparation completed.
2023-01-03 20:50:07.000 | SUCCESS | launart.manager:launch:385 - Layer #3:[elizabeth.service] preparation completed.
2023-01-03 20:50:07.000 | INFO | launart.manager:launch:390 - All components prepared, start blocking phase.
2023-01-03 20:50:07.000 | ERROR | launart.manager:_launchable_task_done_callback:43 - [elizabeth.connection.3520295800.websocket_client_connection] raised aexception.
Traceback (most recent call last):
> File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\graia\ariadne\connection\ws.py", line 178, in launch
async with self.stage("blocking"):
│ └ <function Launchable.stage at 0x00000061039B31F0>
└ <WebsocketClientConnection <ConnectionStatus connected=False alive=False verified=False stage=finished> with 2 callbacks>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\contextlib.py", line 181, in __aenter__
return await self.gen.__anext__()
│ │ └ <slot wrapper '__anext__' of 'async_generator' objects>
│ └ <async_generator object Launchable.stage at 0x0000006104B8E550>
└ <contextlib._AsyncGeneratorContextManager object at 0x0000006104D86790>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\launart\component.py", line 154, in stage
self.status.stage = "blocking"
│ │ └ <statv.Stats object at 0x00000061039CB1F0>
│ └ <ConnectionStatus connected=False alive=False verified=False stage=finished>
└ <WebsocketClientConnection <ConnectionStatus connected=False alive=False verified=False stage=finished> with 2 callbacks>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\statv.py", line 67, in __set__
value = self._validator(self, past_value, value)
│ │ │ │ └ 'blocking'
│ │ │ └ 'finished'
│ │ └ <statv.Stats object at 0x00000061039CB1F0>
│ └ <function LaunchableStatus._ at 0x00000061039C0A60>
└ <statv.Stats object at 0x00000061039CB1F0>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\launart\component.py", line 79, in _
raise ValueError(f"Invalid stage transition: {past} -> {current}")
ValueError: Invalid stage transition: finished -> blocking
程序:
from graia.ariadne.event.message import GroupMessage
from graia.ariadne.app import Ariadne
from graia.ariadne.entry import config
from graia.ariadne.message.chain import MessageChain
from graia.ariadne.model import Group
app = Ariadne(
config(
verify_key="ServiceVerifyKey", # 填入 VerifyKey
account='原本是qq号', # 你的机器人的 qq 号
),
)
@app.broadcast.receiver(GroupMessage)
async def friend_message_listener(app: Ariadne, msg: MessageChain, group: Group):
if group.id == '原本是群号':
await app.send_message(group, "test")
app.launch_blocking()
配置文件:
# file: "MCL/config/net.mamoe.mirai-api-http/setting.yml"
## 配置文件中的值,全为默认值
## 启用的 adapter, 内置有 http, ws, reverse-ws, webhook
adapters:
- http
- ws
## 是否开启认证流程, 若为 true 则建立连接时需要验证 verifyKey
enableVerify: true
verifyKey: ServiceVerifyKey
## 开启一些调试信息
debug: false
## 是否开启单 session 模式, 不建议开启
singleMode: false
## 历史消息的缓存大小
## 同时,也是 http adapter 的消息队列容量
cacheSize: 4096
## adapter 的单独配置,键名与 adapters 项配置相同
## 注意: 如果 mirai 读取配置时出错可以尝试删除并重新写入
adapterSettings:
## HTTP 服务的主机, 端口和跨域设置
http:
host: localhost
port: 8080
cors: ["*"]
## Websocket 服务的主机, 端口和事件同步ID设置
ws:
host: localhost
port: 8080
reservedSyncId: -1
bug