离开命令 Discord JS

Leave Command Discord JS

让命令在我用 JS 编写的 Discord 机器人上不起作用。

这是我正在使用的代码片段。

if(command == 'leave') { client.leaveVoiceChannel;

然而,应该让机器人离开语音频道的命令似乎不起作用。这是我使用代码的方式。

const Eris = require('eris');
const client = new Eris(require('./config.json').token, { maxShards: 1 });
fs = require('fs')
var stations = fs.readFileSync("./stations.txt", {"encoding": "utf-8"}).toString()
client.connect();
client.on('ready', () => {
 console.log('Ready to go!')
})
client.on('messageCreate', message => {
 if(message.author.bot) return;
 if(message.content.startsWith('!')) {
  let command = message.content.substring(1).split(" ")[0];
  let args = message.content.substring(2 + command.length);
        
        if(command == 'leave') {
        client.leaveVoiceChannel; 
        } else if(command == 'streams') {
   message.channel.createMessage(stations);
  } else if(command == 'radio') {
   if(args == '') return message.channel.createMessage(`:exclamation: Please specify the radio stream example: **!radio <stream> or use command **!streams** to see list.`);
   if(require('./stations.json')[args]) {
    if(!message.member.voiceState.channelID) return message.channel.createMessage(`:exclamation: You need to be in a voice channel to play that stream.`);
    client.joinVoiceChannel(message.member.voiceState.channelID).then(vc => {
     if(vc.playing) vc.stopPlaying();
     message.channel.createMessage(`:radio: You are listening to Streaming station **${args}**. To change the stream use **!radio <stream>**`);
     vc.play(require('./stations.json')[args]);
    })
   } else {
    return message.channel.createMessage(`:frowning2: I cannot find a radio stream with that name. Make sure it has capitals and the correct spelling. Type **!streams** to see stream list.`);                    
   }                
  }
 }
})

我不确定我哪里错了。

 if(command == 'stopstream') {
        client.leaveVoiceChannel(message.member.voiceState.channelID);
        message.channel.createMessage(`Thanks for tuning in!`); }