Node.jsで画像を埋め込みメッセージ化が分からない

実現したいこと

/embedのコマンドを打った時、タイトルと説明、写真を添付させ、それをembed(埋め込みメッセージ)にしたい

発生している問題・分からないこと

写真添付後の写真の取得方法とembedの出力方法が分からない

該当のソースコード

JavaScript

1const { SlashCommandBuilder, EmbedBuilder } = require('@discordjs/builders');2const { AttachmentBuilder, Attachment, Message } = require('discord.js');3 4const embedCommand = new SlashCommandBuilder()5 .setName('embed')6 .setDescription('埋め込みメッセージを作成します')7 .addStringOption(option =>8 option.setName('title')9 .setDescription('タイトルを入力してください')10 .setRequired(true))11 12 .addStringOption(option =>13 option.setName('description')14 .setDescription('説明文を入力してください')15 .setRequired(true))16 17 .addAttachmentOption(option =>18 option.setName('photo')19 .setDescription('写真を選択してください')20 .setRequired(false));21 22module.exports = {23 data: embedCommand,24 async execute(interaction) {25 const title = interaction.options.getString('title');26 const description = interaction.options.getString('description');27 28 const embed = new EmbedBuilder()29 .setColor(0x0099ff)30 .setTitle(title)31 .setDescription(description)32 33 await interaction.reply({ embeds: [embed] });34 },35};

試したこと・調べたこと

上記の詳細・結果

知人に聞くとAttachmentBuilderを使うらしいのですが僕には分かりません

補足

特になし

コメントを投稿

0 コメント