2021-04-06 23:36:35 +00:00
module . exports = function ( bot , api ) {
2021-04-06 23:33:47 +00:00
api . registerCommand ( 'announcevoice' , ( args , message ) => {
let channel = bot . voice . connections . first ( ) . channel ;
2021-04-06 23:36:35 +00:00
if ( args . length > 3 ) {
2021-04-06 23:33:47 +00:00
return api . respond ( message , "You tried to change my voice with 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 , "My new voice is " + api . announcementVoice + " from " + api . announcementEngine . longName ) ;
} else {
api . announcementVoice = api . announcementEngine . getDefaultVoice ( ) ;
api . respond ( message , "Your voice name was invalid, so I switched to the default voice (" + api . announcementVoice + ") for " + api . announcementEngine . longName + " instead." ) ;
}
2021-04-06 23:33:47 +00:00
}
} ) ;
}