tardis-bot/modules/ttsSettings/index.js

23 lines
938 B
JavaScript
Raw Normal View History

const printf=require('printf');
2021-04-06 23:36:35 +00:00
module.exports = function (bot, api) {
api.registerCommand('announcevoice', (args, message) => {
let channel = bot.voice.connections.first().channel;
2021-04-06 23:36:35 +00:00
if (args.length > 3) {
return api.respond(message, printf(api.strings.TOO_MANY_ARGUMENTS));
}
2021-04-06 23:36:35 +00:00
if (api.ttsEngines[args[1]]) {
api.announcementEngine = api.ttsEngines[args[1]];
if (api.announcementEngine.validateVoice(args[2])) {
api.announcementVoice = args[2];
api.respond(message, printf(api.strings.SYSTEM_VOICE_CHANGED, api.announcementVoice, api.announcementEngine.longName));
2021-04-06 23:36:35 +00:00
} else {
api.announcementVoice = api.announcementEngine.getDefaultVoice();
api.respond(message, printf(api.strings.INVALID_VOICE, api.announcementVoice, api.announcementEngine.longName));
2021-04-06 23:36:35 +00:00
}
} else {
api.respond(message, printf(api.strings.INVALID_ENGINE, args[1]));
}
});
2021-04-09 14:21:31 +00:00
api.registerCommand('flush',()=>api.queue.flush());
}