diff --git a/commands/InformeMoi.js b/commands/InformeMoi.js index 1eb79fafebcc65742805efbe2913d92748bd8426..fe23e3c65cc7aa3db94c1b33055c101340acfe2e 100644 --- a/commands/InformeMoi.js +++ b/commands/InformeMoi.js @@ -14,17 +14,12 @@ class InformeMoi{ fillAllRandomObject(sentence, regularExpr, randomMethode){ const matches = sentence.matchAll(regularExpr); - const size = matches.length; let objectString = ""; let newSentence = sentence; for(let match of matches){ objectString = randomMethode(); newSentence = newSentence.replace(match, objectString); } - if(size === 1 && regularExpr === this.actorRE){ - const want = objectString.startsWith("Les ") ? "veulent" : "veut"; - newSentence = newSentence.remplace(match, want ); - } return newSentence; } @@ -37,7 +32,7 @@ class InformeMoi{ sentence = this.fillAllRandomObject(sentence, this.reasonRE, complotDB.getRandomReason.bind(complotDB)); sentence = this.fillAllRandomObject(sentence, this.sourceRE, complotDB.getRandomSource.bind(complotDB)); - sentence.replaceAll(this.wantRE, 'veut'); /**Todo, change */ + sentence = sentence.replaceAll(this.wantRE, 'veut'); /**Todo, change */ return sentence; }