P粉0068477502023-08-04 11:26:05
如果你正在使用 discord.js v14,那麼你需要更新回覆訊息時使用嵌入訊息(Embeds)的方法。只需將程式碼變更為以下內容:
client.on('guildCreate', guild => { const channel = guild.channels.cache.find(channel => channel.type === 'text' && channel.permissionsFor(guild.me).has('SEND_MESSAGES')); if (channel) { const exampleEmbed = new EmbedBuilder() .setColor(0xF99CF8) .setTitle('**B**') .setAuthor('S') .setThumbnail('https://i.imgur.com/N4') .setDescription('H') channel.send({ embeds: [exampleEmbed] }); }});
另外,你需要將第一行修改為:
const { Client, GatewayIntentBits, EmbedBuilder} = require('discord.js');
只需刪除第三行以使你的程式碼更清晰。
要了解更多細節,請造訪此處 : https://discordjs.guide/popular-topics/embeds.html#embed-preview
#