首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >不一致机器人问题嵌入缩略图附件

不一致机器人问题嵌入缩略图附件
EN

Stack Overflow用户
提问于 2021-09-10 15:27:08
回答 4查看 222关注 0票数 0

我不是很有经验的javascript,我有一个问题,以显示我的附加图像。当有人输入#1机器人发送一个带有字符的嵌入,我也想发布图像!我不知道是格式错误还是应该先加载图像。因此,该图像是我的本地文件夹,与我的index.js文件位于同一目录中

我对颜色也有问题!我没有设法修改它!我没有设法修改它,我希望能够更改名称、标题或描述的颜色,但我不知道是否有可能我的测试不成功,您能帮我一点忙吗?这是我的代码。提前谢谢。

代码语言:javascript
运行
复制
const { token, prefix } = require('../config.json');


const Discord = require('discord.js');
const client = new Discord.Client();


// Listen to the Bot being ready
client.once('ready', () => onClientReady());

function onClientReady()
    {
        // Listen to Messages in the channel
        client.on('message', (message) => onMessageReceived(message));
    }

    // Upon a message being received, handle how we interact
function onMessageReceived(message)
{    
    if(message.author.bot) return;
    if (message.content.toLowerCase().includes('#1'))
    message.channel.send({ embed: {
        color: 3447003,
        title: "SpaceShips #1 New_York",
        url: "http://google.com",
        description: "RANK: 74 / SCORE: 121",
        Thumbnail: (url="attachment://000793.jpg"),
       fields: [{
           name: "__**POWER**__",
           value: "A-G 0: **39**",
           "inline": true
          },
         {
           name: "__**POWER**__",
           value: "E-W: **76**",
               "inline": true
         },
         {
           name: "__**AUTONOMY**__",
           value: "EY-W Nrg: **74**",
               "inline": true
         },
         {
           name: "__**AUTONOMY**__",
           value: "B-P 0 Nrg: **73**",
               "inline": true
          },
         {
           name: "__**DISPLACEMENT**__",
           value: "L-A: **79**",
           "inline": true
          },
         {
           name: "__**DISPLACEMENT**__",
           value: "3D-V: **67**",
               "inline": true
         },
         {
           name: "__**SPECIALS**__",
           value: "EM-W: **34**",
               "inline": true
          },
         {
           name: "__**SPECIALS**__",
           value: "3D-W: **42**",
               "inline": true
          }
        ],
      }
    });
}


client.login(token);
EN

Stack Overflow用户

发布于 2021-09-10 18:08:59

您可以简单地向要发送的embed对象添加一个图像值,如下所示:

代码语言:javascript
运行
复制
message.channel.send({ embed: {
        color: 3447003,
        title: "SpaceShips #1 New_York",
        url: "http://google.com",
        description: "RANK: 74 / SCORE: 121",
        thumbnail: { 
        url: "attachment://000793.jpg"
         },
      }
    }); // Removed fields to clear up the clutter, you may add them like before!

至于颜色,它是一个RGB值,你可以在谷歌上搜索你喜欢的颜色的值,然后替换它!

票数 0
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69134552

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档