【发布时间】:2021-08-05 06:47:50
【问题描述】:
我正在编写一个不和谐的机器人,但在 TTS 命令中我尝试运行它,但它不适用于此代码(我已经安装了 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);
});
};
}
}
【问题讨论】:
-
怎么了?
标签: discord.js