【发布时间】:2021-06-17 19:25:50
【问题描述】:
所以基本上我最近在删除我的机器人发送的消息时总是收到以下错误。该消息不再被 Bot 使用,但由于某种原因,它总是在删除后崩溃。
C:\Users\Admin\Documents\Disc-Bots\discordBot_SGE-EventManager\node_modules\discord.js\src\rest\RequestHandler.js:154
throw new DiscordAPIError(request.path, data, request.method, res.status);
^
DiscordAPIError: Unknown Message
at RequestHandler.execute (C:\Users\Admin\Documents\Disc-Bots\discordBot_SGE-EventManager\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async RequestHandler.push (C:\Users\Admin\Documents\Disc-Bots\discordBot_SGE-EventManager\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
at async MessageManager.delete (C:\Users\Admin\Documents\Disc-Bots\discordBot_SGE-EventManager\node_modules\discord.js\src\managers\MessageManager.js:126:5) {
method: 'delete',
path: '/channels/822433440103268362/messages/822874032402726952',
code: 10008,
httpStatus: 404
}
这里是总是有问题的命令的代码:
module.exports = {
name: 'hostit',
aliases: ['hostits'],
execute: async function (message, args, client) {
message.delete()
switch(args[0]){
//Patrol Command
case "patrol":
let title = "[SGE] Event - Patrol"
let description = `A new patrol has been hosted by ${message.author}!\nCome down to the patrol and get some activity!\n\nhttps://placeholder.com`
// Notification that it was sent
const confirmationembled = new MessageEmbed()
.setColor('GREEN')
.setDescription('Success! Patrol hosted in <#'+eventChannelId+'>!')
message.channel.send(confirmationembled)
message.delete({ timeout: 5000 })
// Actual event channel
const patrolembed = new MessageEmbed()
patrolembed.setColor('GREEN')
.setTitle(title)
.setDescription(description)
//Log Event Creation
client.channels.cache.get(config.logChannelId).send("[**<@"+message.author+">**] hosted a patrol at "+new Date().toLocaleString())
// Send Event to Eventchannel
const channel = message.guild.channels.cache.get(config.eventChannelId)
if (!channel) {
const { owner } = await client.fetchApplication()
return owner.send("Channel does not exist, please check your config.json file.")
}
channel.send(patrolembed)
channel.send('NoGhostPing!').then(msg => msg.delete())
break;
// Not an host command
default:
message.reply("This Command does not exists, please use -help to see all commands!").then(msg => { msg.delete({ timeout: 5000 })})
break;
}
}
}
如您所见,我实际上从不想编辑我使用机器人发送的任何消息。
【问题讨论】:
-
你能添加你的代码吗?
-
你应该发布你的代码,查看how to ask
标签: javascript discord discord.js