Giter Club home page Giter Club logo

Comments (4)

Drincann avatar Drincann commented on September 28, 2024

我咋说当时咋测试都没用呢,还以为是 mirai-api-http 的问题。。

from mirai-js.

Drincann avatar Drincann commented on September 28, 2024

npm 上的包已经更新到 1.0.1。

更新后还存在问题请 reopen。

from mirai-js.

guation avatar guation commented on September 28, 2024

sendMessage 方法的 message 参数不能接受messageChain。
QQ截图20210226155417

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.

Drincann avatar Drincann commented on September 28, 2024

npm 上的包已经更新到 1.0.2

from mirai-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.