使用 discord bot 向特定频道发送消息

Send a message to a specific channel with discord bot

我正在研究如何向特定频道发送消息。我看到有人用 client.channels.cache.get('channelidhere').send('text') 然而,整个事情对我来说是一个错误。 这是我的全部代码。为朋友开发票务机器人并不疯狂。

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```

对于仍在此处寻找答案的任何人来说。

对于普通消息做

message.guild.channels.cache.get('channel-id').send('message')

对于交互做

interaction.guild.channels.cache.get('channel-id').send('message')