• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN TTS Locale Script

Status
Not open for further replies.

kanalumaddela

Insider
Insider
So I'm trying to get this script to work where users can use tts in multiple locales with the default locale having to be changed. The script does not load whatsoever and I've checking back and forth with the say() function and how to use it. Currently I am trying to get it to work with japanese.

Code:
registerPlugin({
    name: 'TTS Locales',
    version: '1.0',
    description: 'TTS Locales',
    author: 'kanalumaddela',
    vars: {
        locale: {
            title: 'Locale to use',
            type: 'string'
        }
    }
}, function(sinusbot, config) {
        sinusbot.on('chat', function(ev) {
             if (ev.msg.startsWith('!japanese ')) {
                  var message = ev.msg.substring(10);
                  sinusbot.say('This message is in english, ' + ev.msg.substring(10)); //debugging shit
                  sleep(5000); //debugging shit
                  sinusbot.say(message[, config.locale]);
                  sleep(5000); //debugging shit
                  sinusbot.say('This is a backup phrase to say to make sure the TTS is working'); //debugging shit
                  return;
             }
        });
});

Error in the logs
Code:
2016/08/24 23:59:16 [GENERAL/SCRIPTS] WARN   Could not load script (anonymous): Line 18:40 Unexpected token , (and 2 more errors)

Line of code causing the error
Code:
sinusbot.say(message[, config.locale]);

Usage according to the script api
Code:
say(text[, locale])

For some reason I can't get it to use the tts with a different locale. If I did a basic script that had
Code:
sinusbot.say('hello');
it would work
 
Last edited:

kanalumaddela

Insider
Insider
nvm figured it out. Looked at the showcase script and put
Code:
sinusbot.say(message, config.locale);
which worked. :p
 
Status
Not open for further replies.
Top