DiscordJS 有编辑消息的方法
答案 0 :(得分:0)
要做到这一点,我们只需要将它传递给函数,即客户端变量。
exports.myNewFunction = async function myNewTestFunction(client)
首先,为了使用 Discord.JS API 编辑消息,我们需要找到服务器的 GuildID。
const guild = client.guilds.cache.get(`Your Guild ID`);
现在,我们需要找到消息所在的频道。为此,我们将使用频道 ID
const channel = guild.channels.cache.find(c => c.id === `Your message Channel` && c.type === 'text');
最后,让我们进入消息的编辑部分。为此,我们只需要提供您要编辑的消息的 ID。
channel.messages.fetch(`Your Message ID`).then(message => {
message.edit("New message Text");
}).catch(err => {
console.error(err);
});