Sanitize user input

This commit is contained in:
loicbersier 2019-11-04 22:19:30 +01:00
parent 838b5efd65
commit 91ea715fe7
2 changed files with 2 additions and 2 deletions

View file

@ -29,7 +29,7 @@ class dectalkCommand extends Command {
async exec(message, args) {
args.decMessage = rand.random(args.decMessage, message);
args.decMessage = args.decMessage.replace('\n', ' ');
let decMessage = '[:phoneme on] ' + args.decMessage;
let decMessage = '[:phoneme on] ' + args.decMessage.replace(/(["\s'$`\\])/g,'\\$1');
if (process.platform == 'win32') {
exec(`cd .\\dectalk && .\\say.exe -w dectalk.wav "${decMessage}"`)

View file

@ -29,7 +29,7 @@ class dectalkvcCommand extends Command {
async exec(message, args) {
args.decMessage = rand.random(args.decMessage, message);
args.decMessage = args.decMessage.replace('\n', ' ');
let decMessage = '[:phoneme on] ' + args.decMessage;
let decMessage = '[:phoneme on] ' + args.decMessage.replace(/(["\s'$`\\])/g,'\\$1');
if (process.platform == 'win32') {
exec(`cd .\\dectalk && .\\say.exe -w dectalkvc.wav "${decMessage}"`)