I am looking on how to send a message to a specific channel. I saw some people to use
client.channels.cache.get('channelidhere').send('text')
however that whole thing is an error for me.
Here is my whole code. working on a ticket bot for a friend not anything crazy.
import { ICommand } from "wokcommands";
export default {
category: 'Utility',
description: 'Makes a support ticket.',
slash: false,
testOnly: true,
callback: async({ message, args, client, guild, member }) => {
let number = 0
let timeout = 200
const channel = await message.guild?.channels.create('Ticket', {
permissionOverwrites: [
{
id: message.author,
allow: ['VIEW_CHANNEL', 'READ_MESSAGE_HISTORY'],
}
],
})
channel?.setParent('956314466201514064')
console.log(channel?.id)
let setID = channel?.id
client.channels.cache.get('956314466201514064').send('')
}
} as ICommand```
For anyone still looking for an answer here it is.
For regular messages do
message.guild.channels.cache.get('channel-id').send('message')
For interactions do
interaction.guild.channels.cache.get('channel-id').send('message')