d.js not able to fetch message from channel.
For some reason i came upon this error while trying to fetch message from channel
error:
code (it is inside async function):
data:
Message is in that channel, bot has perms, Intents are there as well. I'm clueless on why it won't load when everything is fine
(C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\@discordjs\rest\dist\index.js:667:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\@discordjs\rest\dist\index.js:464:14)
at async REST.request (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\@discordjs\rest\dist\index.js:910:22)
at async MessageManager._fetchSingle (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\discord.js\src\managers\MessageManager.js:101:18)
at async InteractionCollector.<anonymous> (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\commands\reaction.js:220:23) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'GET',
url: 'https://discord.com/api/v10/channels/923718926507077672/messages/1069025646874988554'
}
(C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\@discordjs\rest\dist\index.js:667:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\@discordjs\rest\dist\index.js:464:14)
at async REST.request (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\@discordjs\rest\dist\index.js:910:22)
at async MessageManager._fetchSingle (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\node_modules\discord.js\src\managers\MessageManager.js:101:18)
at async InteractionCollector.<anonymous> (C:\Users\szalikdev\Documents\GitHub\discord-bot-rewritten\commands\reaction.js:220:23) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'GET',
url: 'https://discord.com/api/v10/channels/923718926507077672/messages/1069025646874988554'
}
const channel = data[1].value;
const message_id = data[2].value;
const message = await channel.messages.fetch(message_id);
console.log(message);
const channel = data[1].value;
const message_id = data[2].value;
const message = await channel.messages.fetch(message_id);
console.log(message);
[
{ key: 'emoji', value: '�' },
{
key: 'channel_id',
value: TextChannel {
type: 0,
guild: [Guild],
guildId: '892722239089278996',
parentId: '923718817866199050',
permissionOverwrites: [PermissionOverwriteManager],
messages: [MessageManager],
threads: [GuildTextThreadManager],
nsfw: false,
flags: [ChannelFlagsBitField],
id: '923718926507077672',
name: 'polish',
rawPosition: 34,
topic: null,
lastMessageId: '1069022546311262228',
rateLimitPerUser: 0
}
},
{ key: 'message_id', value: '1069022546311262228' },
{ key: 'action_type', value: 'toggle' },
{ key: 'role_id', value: '917391022990954507' }
]
[
{ key: 'emoji', value: '�' },
{
key: 'channel_id',
value: TextChannel {
type: 0,
guild: [Guild],
guildId: '892722239089278996',
parentId: '923718817866199050',
permissionOverwrites: [PermissionOverwriteManager],
messages: [MessageManager],
threads: [GuildTextThreadManager],
nsfw: false,
flags: [ChannelFlagsBitField],
id: '923718926507077672',
name: 'polish',
rawPosition: 34,
topic: null,
lastMessageId: '1069022546311262228',
rateLimitPerUser: 0
}
},
{ key: 'message_id', value: '1069022546311262228' },
{ key: 'action_type', value: 'toggle' },
{ key: 'role_id', value: '917391022990954507' }
]
2 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yes
or i think i know where the issue is was storing wrong id inside message_id
my bad