Comments (4)
我咋说当时咋测试都没用呢,还以为是 mirai-api-http 的问题。。
from mirai-js.
npm 上的包已经更新到 1.0.1。
更新后还存在问题请 reopen。
from mirai-js.
sendMessage 方法的 message 参数不能接受messageChain。
bot.on('FriendMessage', async data => {
await bot.sendMessage({
// 群号
group: '759568028',
// 是 http server 接口所需的原始格式,若提供则优先使用
message: [
{ type: 'Plain', text: 'hello world!' },
],
});
});
使用以上代码发送消息时会报错400。
PS > node .\app.js
(node:15408) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400
参数格式错误
at module.exports (node_modules\mirai-js\src\util\errorHandler.js:15:15)
at module.exports (node_modules\mirai-js\src\core\sendGroupMessage.js:31:9)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Bot.sendMessage (node_modules\mirai-js\src\Bot.js:252:24)
at async app.js:17:5
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15408) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:15408) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
将message替换为messageChain则可以正确发送消息,后台输出warning。
warning: 现在 sendMessage 方法的 message 参数可以同时接收 Message 实例或 messageChain,messageChain 参数将在未来被移除
from mirai-js.
npm 上的包已经更新到 1.0.2
from mirai-js.
Related Issues (20)
- pr #211 npm未同步更新,问题仍未解决 HOT 3
- Bot.groupPermission's behavior is not as expected HOT 2
- mirai-api-http v2.6.0 不兼容变更 HOT 5
- 在 v3 做好对 mirai-api-http 的运行时兼容性抽象
- bug: 发送的语音消息在 pc 客户端无法正常播放 HOT 1
- 关于Mirai-js v2.8.4上传语音PC端听不了的问题 HOT 2
- 关于mirai-js 类型定义与实际获取到的类型不一致问题 HOT 3
- Bot.setEssence 接口适配 HOT 1
- 当我启动时报错
- 当我运行时发生错误 mirai-js: error core.auth HOT 7
- 发送闪图却没有接受到 HOT 4
- 指定操作不支持 HOT 6
- FileManager中的sessionKey()函数修正 HOT 1
- 在通过webpack打包后,bot.uploadImage上传报 source.on is not function错误
- Error: 指定对象不存在 HOT 7
- faied HOT 1
- 考虑支持文件操作吗? HOT 1
- session失效或不存在 HOT 1
- 能在浏览器环境下运行吗? HOT 1
- [email protected]在搭配mirai-api-http-2.9.1使用时出现Unexpected server response: 404 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mirai-js.