KeuHeum
KeuHeum
DIAdiscord.js - Imagine an app
Created by KeuHeum on 8/14/2023 in #djs-questions
ChannelNotCached Error when make thread
Version discord.js - 14.12.1 node js - 18.6.0 Question I got an error when I try to make a thread which connect with sent message. Code
import { SlashCommandBuilder } from 'discord.js';

export const data = new SlashCommandBuilder()
.setName('make_thread')
.setDescription('make thread if true')
.addBooleanOption(option => option
.setName('thread')
.setDescription('if true, you get thread')
.setRequired(false)
);

export async function execute(interaction) {
await interaction.deferReply();
let msg = await interaction.editReply('thread');

if (interaction.options.get('thread')['value'] == true){
await msg.startThread({
name: `new`,
type: 'GUILD_PUBLIC_THREAD'
});
}
}
import { SlashCommandBuilder } from 'discord.js';

export const data = new SlashCommandBuilder()
.setName('make_thread')
.setDescription('make thread if true')
.addBooleanOption(option => option
.setName('thread')
.setDescription('if true, you get thread')
.setRequired(false)
);

export async function execute(interaction) {
await interaction.deferReply();
let msg = await interaction.editReply('thread');

if (interaction.options.get('thread')['value'] == true){
await msg.startThread({
name: `new`,
type: 'GUILD_PUBLIC_THREAD'
});
}
}
Error
Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
at Message.startThread (F:\javascript\baekjoon\node_modules\discord.js\src\structures\Message.js:871:46)
at Module.execute (file:///F:/javascript/commands/name.js:19:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (file:///F:/javascript/index.js:96:9) {
code: 'ChannelNotCached'
}
Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
at Message.startThread (F:\javascript\baekjoon\node_modules\discord.js\src\structures\Message.js:871:46)
at Module.execute (file:///F:/javascript/commands/name.js:19:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (file:///F:/javascript/index.js:96:9) {
code: 'ChannelNotCached'
}
6 replies