gpt4 book ai didi

javascript - "DiscordAPIError: Unknown Message"试图编辑消息时

转载 作者:行者123 更新时间:2023-12-03 12:18:59 28 4
gpt4 key购买 nike

我正在尝试编辑几天前用我的机器人发送的消息,但它不允许我编辑它。

我敢肯定这是因为已经大约 7 天了,但即便如此,我还是想知道是否有办法编辑该消息。

client.on('message', async (message) => {
if (message.content === '!update-info') {
if (!message.member.hasPermission('MANAGE_MESSAGES')) {
return message.channel.send('Only server moderators can run this command!')
}
const guild = client.guilds.cache.get('734517639732396122');
if (!guild) return console.log('Unable to find guild.');

const channel = guild.channels.cache.find(c => c.id === '737363248126492772' && c.type === 'text');
if (!channel) return console.log('Unable to find channel.');

try {
const messageedit = await message.channel.messages.fetch('815522275344252928');
if (!message) return console.log('Unable to find message.');

await messageedit.edit("__**Reacciona para activar notificacioness**__\n\n`Actualizaciones:` <:update:815505836880429087> \n`Twitter:` <:twitter:815505836842942474> \n`Facebook:` <:facebook:815505775278424084>\n`Instagram:` <:instagram:815505836608454667>");
console.log('Mensaje de informacion actualizado.');
} catch(err) {
console.error(err);
}
message.delete();
}
});

DiscordAPIError: Unknown Message

at RequestHandler.execute (/home/bungee/Discord-Bots/Uniito-bot/node_modules/discord.js/src/rest/RequestHandler.js:154:13)

at processTicksAndRejections (internal/process/task_queues.js:97:5)at async RequestHandler.push (/home/bungee/Discord-Bots/Uniito-bot/node_modules/discord.js/src/rest/RequestHandler.js:39:14)

at async MessageManager._fetchId (/home/bungee/Discord-Bots/Uniito-bot/node_modules/discord.js/src/managers/MessageManager.js:135

at async Client. (/home/bungee/Discord-Bots/Uniito-bot/client.js:105:33) {method: 'get',path: '/channels/738226897690820680/messages/815522275344252928',code: 10008,httpStatus: 404}

最佳答案

错误是正确的,但您没有发现错误,因为您的逻辑混淆了。

        const messageedit = await message.channel.messages.fetch('815522275344252928');
if (!message) return console.log('Unable to find message.');

我相信你应该是

        const messageedit = await message.channel.messages.fetch('815522275344252928');
if (!messageedit) return console.log('Unable to find message.');

这种情况将检查获取请求的响应..

关于javascript - "DiscordAPIError: Unknown Message"试图编辑消息时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66458881/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com