Advertisement
Guest User

speakSystem.js

a guest
May 29th, 2017
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //ROUGH TTS SYSTEM PHANTOMBOT
  2. var TTS = {
  3.     speak: function(inputText){//Define function getting & playing TTS
  4.     var speechText = "<voice>" + inputText;
  5.     //Post speech text.
  6.     $.say(speechText);
  7.     $.panelsocketserver.alertImage(speechText);
  8.     }
  9. };
  10. //Adding text to speech to PhantomBot
  11. (function(){
  12.     //Define cost of shouting:
  13.     var PRICE = 10;
  14.     //Define function calling tts.
  15.     function speak(textToSpeak){
  16.     TTS.speak(textToSpeak);
  17.     }
  18.     //Bind tts to a command.
  19.     $.bind('command',function(event){
  20.     var command = event.getCommand(),
  21.         inputText = event.getArgs()[0];
  22.     //Check command.
  23.     if (command.equalsIgnoreCase('shout')){
  24.         speak(inputText);
  25.     }
  26.     });
  27.     //Register command.
  28.     $.bind('initReady',function(){
  29.         if($.bot.isModuleEnabled('./systems/speakSystem.js')){
  30.         $.registerChatCommand('./systems/speakSystem.js','shout',PRICE);
  31.         }
  32.     });
  33. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement