Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Discord.js将消息发送到特定通道_Javascript_Node.js_Discord_Discord.js - Fatal编程技术网

Javascript Discord.js将消息发送到特定通道

Javascript Discord.js将消息发送到特定通道,javascript,node.js,discord,discord.js,Javascript,Node.js,Discord,Discord.js,我想发出一个poll命令,但无法让它向特定频道发送消息 这是我的代码: const{tprefix,pollchannel}=require('../config.json'); const Discord=require('Discord.js'); const client=new Discord.client(); module.exports={ 名称:'投票', 描述:'可以进行投票', 冷却时间:5, 用法:“[ask][emoji1][emoji 2]”, 别名:['createp

我想发出一个poll命令,但无法让它向特定频道发送消息 这是我的代码:

const{tprefix,pollchannel}=require('../config.json');
const Discord=require('Discord.js');
const client=new Discord.client();
module.exports={
名称:'投票',
描述:'可以进行投票',
冷却时间:5,
用法:“[ask][emoji1][emoji 2]”,
别名:['createpoll'],
异步执行(消息){
const channel=message.client.channels.fetch(pollchannel);
message.channel.send('您有60秒时间');
//等待新的承诺((resolve)=>setTimeout(resolve,60000));
send(${tprefix}message`);
message.channel.send('finished');
},
};
它应该发送带有“you have 60 seconds.”的消息,然后等待60秒,然后在轮询频道和当前频道上发送消息。频道id正确并记录在config.json中使用:

const channel=message.client.channels.cache.get(pollchannel)
channel.send('hello')


现在我得到了这个错误:TypeError:channel.client.send不是一个函数只需使用
channel.send
,而不是
channel.client.send