Discord.js 不和谐机器人
我正在编写一个discord bot,但在TTS命令中,我尝试运行它,但它与此代码不兼容(我安装了Discord.js 不和谐机器人,discord.js,Discord.js,我正在编写一个discord bot,但在TTS命令中,我尝试运行它,但它与此代码不兼容(我安装了npm I discord TTS),因此我尝试了一切方法使其工作,但它不工作,我想知道我是否错过了一些东西 const discordTTS = require("discord-tts"); const Command = require('../Command.js'); module.exports = class SpeakCommand extends Comma
npm I discord TTS
),因此我尝试了一切方法使其工作,但它不工作,我想知道我是否错过了一些东西
const discordTTS = require("discord-tts");
const Command = require('../Command.js');
module.exports = class SpeakCommand extends Command {
constructor(client) {
super(client, {
name: 'speak',
usage: 'speak <message>',
description: 'Speaks TTS message.',
type: client.types.FUN
});
}
async run(message, args) {
function tts(voiceChannel, text) {
const broadcast = bot.voice.createBroadcast();
var channelId = message.member.voice.channelID;
var channel = bot.channels.cache.get(channelId);
channel.join().then(connection => {
broadcast.play(discordTTS.getVoiceStream(args));
const dispatcher = connection.play(broadcast);
});
};
}
}
const discordTTS=require(“discordTTS”);
const Command=require('../Command.js');
module.exports=类SpeakCommand扩展命令{
建造商(客户){
超级(客户、{
姓名:'说',
用法:“说”,
描述:'讲TTS信息',
类型:client.types.FUN
});
}
异步运行(消息,参数){
功能tts(语音频道、文本){
const broadcast=bot.voice.createBroadcast();
var channelId=message.member.voice.channelId;
var channel=bot.channels.cache.get(channelId);
channel.join().then(连接=>{
播放(discordTTS.getVoiceStream(args));
const dispatcher=connection.play(广播);
});
};
}
}
您只编写了函数。
调用函数并填充参数。出了什么问题?