-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Bug]: 处置WS命令时发生无法恢复的异常 #1328
Labels
bug?
The issue author think this is a bug
Comments
试试把最后面的
改成
? |
import aiohttp
import asyncio
async def func():
async with aiohttp.ClientSession() as session:
async with session.ws_connect('ws://127.0.0.1:6700/api') as ws:
await ws.send_json({'action': 'send_private_msg', 'params':{
'user_id': 183713750, # 给这个人发条消息
'message': '2333' #消息内容
}})
data = await ws.receive_json()
return data
asyncio.run(func()) 这个呢?? |
可以了,谢谢 |
这里再提供一种不需要换aiohttp模块继续使用websocket模块的改法,之前的错误原因是因为单引号不是规范的json格式,cqhttp不识别,所以把
改为
这也是一种改法,websockets模块同理 |
应该是 把 ws.send(str(params)) 改为 ws.send(json.dumps(params, ensure_ascii=false)) 就行 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
请确保您已阅读以上注意事项,并勾选下方的确认框。
go-cqhttp 版本
v1.0.0-beta8-fix2
运行环境
Windows (64)
运行架构
No response
连接方式
WebSocket (正向)
使用协议
0 | iPad
重现步骤
使用正向WebSocket与机器人链接,调用API时报错
期望的结果是什么?
正常发送一条消息给用户
实际的结果是什么?
go-cqhttp报错:
go-cqhttp返回:
简单的复现代码/链接(可选)
日志记录(可选)
No response
补充说明(可选)
程序发送了两次请求,第一次请求gocq的日志显示:
不知道为啥参数后面没有任何东西
The text was updated successfully, but these errors were encountered: