project-mirai / mirai-api-http

Mirai HTTP API (console) plugin
GNU Affero General Public License v3.0
1.66k stars 343 forks source link

发送好友消息时提示无效参数 #573

Closed JerryWn12 closed 2 years ago

JerryWn12 commented 2 years ago

代码:index.js

 import axios from "axios";

 const clog = console.log;
 const path = "sendFriendMessage";

 axios
 .post(`http://localhost:8080/${path}`, {
     target: 000,
     messageChain: [
         { type: "Plain", text: "hello" }
     ]
 })
 .then(res => {
     clog(res);
 })
 .catch(err => {
     clog(err)
 })

响应:

{ code: 400, msg: '无效参数' }

部分请求信息:

headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'axios/0.27.2',
      'Content-Length': 70
},
method: 'post',
url: 'http://localhost:8080/sendFriendMessage',
data: '{"target":000,"messageChain":[{"type":"Plain","text":"hello"}]}'
JerryWn12 commented 2 years ago

已开启单例模式

ryoii commented 2 years ago

查看一下是否使用的错误版本的插件

目前由于升级的问题,该插件和core的版本适配关系如下

mah 2.5.0 -> core 2.11 mah 2.4.0 -> core 2.10

JerryWn12 commented 2 years ago

@ryoii 现在暂时无法测试了,账号被冻结了,提示涉嫌违规注册QQ账号,想问一下小号应该怎样最大程度避免冻结?

ryoii commented 2 years ago

违规注册应该不是bot造成的。尽量使用注册时长较长且有一定使用时间的账号,保持同一个device.json文件不要改变,尽量限制发送消息的频率,做好限流控制。如果服务人数实在过大,启动多个bot做好负载

JerryWn12 commented 2 years ago

@ryoii 好的,感谢