所以我試圖讓我的廣播命令在一段時間后自動刪除廣播。我為其構建 EBS 機器人的人希望它在 30 分鐘后自動刪除。我們讓它按照他的意愿發送到所有文本頻道,但試圖讓它自動刪除會觸發以下錯誤:(node:23) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.這是我的broadcast.js文件:broadcast.jsconst Commando = require('discord.js-commando');const prefix = (process.env.BOT_PREFIX);require('dotenv').config();module.exports = class BroadcastCommand extends Commando.Command { constructor(client) { super(client, { name: 'broadcast', aliases: [ 'ebcast', 'bcast', 'bc', 'ebc' ], group: 'ebs', memberName: 'broadcast', userPermissions: [ 'MANAGE_MESSAGES', 'MANAGE_CHANNELS' ], description: 'Send an Emergency Broadcast to all text channels in the guild', examples: [ `Usage: ${prefix}bc <message.content>`, `Details: '<>' flags indicate a required field. '[]' flags indicates an optional field.`, `Note: Do not include the '<>' or '[]' flags in the command.` ], args: [ { key: 'text', prompt: 'What would you like the bot to announce?', type: 'string', }, ], }) }; run(msg, { text }) { msg.guild.channels.cache .filter(channel => channel.type === 'text') .forEach((textChannel) => { textChannel.send(text, { tts: true }).then(sentMessage => { sentMessage.delete(108000000).cache(console.error); }); }) }};我們想知道如何設置它在 30 分鐘后自動刪除消息。我使用這篇文章中的一個示例來自動刪除代碼,這顯然對我不起作用:讓機器人在超時后刪除自己的消息幫助我將其發送到所有頻道的帖子來自:Discord.js Commando Broadcast All 命令錯誤我假設sentMessage標志是錯誤的,但我可能是錯的。任何幫助將非常感激。該機器人內置discord.js-commando并使用node.js ^12.16.4和discord.js ^12.0.1。discordjs/Commando它從主分支運行 discord.js-commando
廣播所有命令不自動刪除廣播 - Discord.js-Commando
慕工程0101907
2023-04-14 15:10:29