You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何删除Discord中interaction.channel.send发送的消息

解决方案

interaction.reply() 生成的回复属于交互绑定消息,需用 deleteReply() 删除;而 interaction.channel.send() 返回的是独立的 Message 实例,直接调用该实例的 delete() 方法即可实现自动删除。

修改后的函数如下:

export function del(message) {
  setTimeout(() => message.delete(), 1000);
}

使用示例:

调用 interaction.channel.send() 时,需通过 await 获取返回的消息对象,再传入 del 函数:

// 发送消息并自动删除
const sentMsg = await interaction.channel.send('这条消息1秒后会自动删除');
del(sentMsg);

内容的提问来源于stack exchange,提问作者user18928797

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 06:41:34