tardis-bot/modules/ttsSettings/index.js

23 lines
950 B
JavaScript
Raw Permalink Normal View History

const printf=require('printf');
module.exports = function (bot, api) {
api.registerCommand('announcevoice', (args, message) => {
let channel = api.getActiveVoiceChannel();
if (args.length > 3) {
return api.respond(message, printf(api.strings.TOO_MANY_ARGUMENTS));
}
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));
} else {
api.announcementVoice = api.announcementEngine.getDefaultVoice();
api.respond(message, printf(api.strings.INVALID_VOICE, api.announcementVoice, api.announcementEngine.longName));
}
} else {
api.respond(message, printf(api.strings.INVALID_ENGINE, args[1]));
}
});
api.registerCommand('flush',()=>api.queue.flush());
}