From 90112d8c73951cf84016268eaacb0d6fe27393d8 Mon Sep 17 00:00:00 2001 From: Adrien Nunes <adrien.nunes@ensiie.fr> Date: Mon, 25 Oct 2021 19:45:41 +0200 Subject: [PATCH] <want> small fix --- commands/InformeMoi.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/commands/InformeMoi.js b/commands/InformeMoi.js index 1eb79fa..fe23e3c 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; } -- GitLab