Discord.js邮件附件图片 [英] Discord.js message attachments picture

查看:79
本文介绍了Discord.js邮件附件图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

message.channel.sendMessage(text).attachments
["",{url:"http://openweathermap.org/img/w/"+icon+".png" }];

我用 node-js(discord.js)制作了一些机器人/ code>。

I made some bot, with node-js ( discord.js ).

我想发送带图片的消息(不带URL),因此,我在文档中找到了功能附件。
但是,当我在控制台中放入消息(文本)和附件时,我得到:

I want to send message with picture(without URL) so, I found fuction attachments, in documentation. But, when I put in message (text) and attachments some picture, in the console,I get:


读取未定义的属性'#< Object>'

"Cannot read property '# < Object >' of undefined"

我该怎么解决这个问题?

What should I do fix this problem?

推荐答案

根据文档,您将需要传递一个包含文件URL或 FileOptions 对象。您可以这样做

According to the docs, you will need to pass an object containing the file URL or a FileOptions object. You would do this like

message.channel.send("some text", {
    file: "http://link.to/your.file" // Or replace with FileOptions object
});

这篇关于Discord.js邮件附件图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆