new(customer-satisfaction.gbapp): basic bad word handler added
This commit is contained in:
parent
0842ee923e
commit
94993f1c56
5 changed files with 31 additions and 37 deletions
38
package-lock.json
generated
38
package-lock.json
generated
|
@ -5015,27 +5015,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"coveralls": {
|
|
||||||
"version": "3.0.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.9.tgz",
|
|
||||||
"integrity": "sha512-nNBg3B1+4iDox5A5zqHKzUTiwl2ey4k2o0NEcVZYvl+GOSJdKBj4AJGKLv6h3SvWch7tABHePAQOSZWM9E2hMg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"js-yaml": "^3.13.1",
|
|
||||||
"lcov-parse": "^1.0.0",
|
|
||||||
"log-driver": "^1.2.7",
|
|
||||||
"minimist": "^1.2.0",
|
|
||||||
"request": "^2.88.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"minimist": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
|
||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cpass": {
|
"cpass": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/cpass/-/cpass-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/cpass/-/cpass-2.2.0.tgz",
|
||||||
|
@ -8613,12 +8592,6 @@
|
||||||
"invert-kv": "^2.0.0"
|
"invert-kv": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lcov-parse": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-6w1GtUER68VhrLTECO+TY73I9+A=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"le-table": {
|
"le-table": {
|
||||||
"version": "4.2.2",
|
"version": "4.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/le-table/-/le-table-4.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/le-table/-/le-table-4.2.2.tgz",
|
||||||
|
@ -9209,12 +9182,6 @@
|
||||||
"integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=",
|
"integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"log-driver": {
|
|
||||||
"version": "1.2.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz",
|
|
||||||
"integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"log-symbols": {
|
"log-symbols": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
|
||||||
|
@ -19003,6 +18970,11 @@
|
||||||
"lodash": "^4.5.0"
|
"lodash": "^4.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"washyourmouthoutwithsoap": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/washyourmouthoutwithsoap/-/washyourmouthoutwithsoap-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-N008S6j3VoPgjUwvW1Q2roTYg9Xuy1LfR/R4BdjddhzM8YBNgIR4FpSQ9zVmNkvpi/fS9cfAQLSjWKXE3wQ1zA=="
|
||||||
|
},
|
||||||
"weak-map": {
|
"weak-map": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz",
|
||||||
|
|
|
@ -97,7 +97,8 @@
|
||||||
"url-join": "4.0.1",
|
"url-join": "4.0.1",
|
||||||
"vbscript-to-typescript": "1.0.8",
|
"vbscript-to-typescript": "1.0.8",
|
||||||
"wait-until": "0.0.2",
|
"wait-until": "0.0.2",
|
||||||
"walk-promise": "0.2.0"
|
"walk-promise": "0.2.0",
|
||||||
|
"washyourmouthoutwithsoap": "^1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.2.7",
|
"@types/chai": "^4.2.7",
|
||||||
|
|
|
@ -42,6 +42,7 @@ const express = require('express');
|
||||||
const request = require('request-promise-native');
|
const request = require('request-promise-native');
|
||||||
const removeRoute = require('express-remove-route');
|
const removeRoute = require('express-remove-route');
|
||||||
const AuthenticationContext = require('adal-node').AuthenticationContext;
|
const AuthenticationContext = require('adal-node').AuthenticationContext;
|
||||||
|
const wash = require('washyourmouthoutwithsoap');
|
||||||
import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder';
|
import { AutoSaveStateMiddleware, BotFrameworkAdapter, ConversationState, MemoryStorage, UserState } from 'botbuilder';
|
||||||
import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs';
|
import { ConfirmPrompt, WaterfallDialog } from 'botbuilder-dialogs';
|
||||||
import {
|
import {
|
||||||
|
@ -540,7 +541,12 @@ export class GBMinService {
|
||||||
|
|
||||||
const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
|
const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
|
||||||
|
|
||||||
if (isVMCall) {
|
const simpleLocale = context.activity.locale.substring(0, 2);
|
||||||
|
const hasBadWord = wash.check(simpleLocale, context.activity.text);
|
||||||
|
|
||||||
|
if (hasBadWord) {
|
||||||
|
await step.beginDialog('/pleaseNoBadWords');
|
||||||
|
}else if (isVMCall) {
|
||||||
await GBMinService.callVM(context.activity.text, min, step);
|
await GBMinService.callVM(context.activity.text, min, step);
|
||||||
} else if (context.activity.text.charAt(0) === '/') {
|
} else if (context.activity.text.charAt(0) === '/') {
|
||||||
await step.beginDialog(context.activity.text);
|
await step.beginDialog(context.activity.text);
|
||||||
|
|
|
@ -56,6 +56,19 @@ export class FeedbackDialog extends IGBDialog {
|
||||||
public static setup(bot: BotAdapter, min: GBMinInstance) {
|
public static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||||
const service = new CSService();
|
const service = new CSService();
|
||||||
|
|
||||||
|
min.dialogs.add(
|
||||||
|
new WaterfallDialog('/pleaseNoBadWords', [
|
||||||
|
async step => {
|
||||||
|
const locale = step.context.activity.locale;
|
||||||
|
await step.context.sendActivity(Messages[locale].please_no_bad_words);
|
||||||
|
|
||||||
|
return await step.next();
|
||||||
|
}
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
min.dialogs.add(
|
min.dialogs.add(
|
||||||
new WaterfallDialog('/feedbackNumber', [
|
new WaterfallDialog('/feedbackNumber', [
|
||||||
async step => {
|
async step => {
|
||||||
|
|
|
@ -7,7 +7,8 @@ export const Messages = {
|
||||||
what_about_me: 'What about the service, please rate between 1 and 5.',
|
what_about_me: 'What about the service, please rate between 1 and 5.',
|
||||||
thanks: 'Thanks!',
|
thanks: 'Thanks!',
|
||||||
im_sorry_lets_try: 'I\'m sorry. Let\'s try again...',
|
im_sorry_lets_try: 'I\'m sorry. Let\'s try again...',
|
||||||
great_thanks: 'Great, thanks for sharing your thoughts.'
|
great_thanks: 'Great, thanks for sharing your thoughts.',
|
||||||
|
please_no_bad_words: 'Please, no bad words.'
|
||||||
},
|
},
|
||||||
'pt-BR': {
|
'pt-BR': {
|
||||||
about_suggestions: 'Sugestões melhoram muito minha qualidade...',
|
about_suggestions: 'Sugestões melhoram muito minha qualidade...',
|
||||||
|
@ -17,6 +18,7 @@ export const Messages = {
|
||||||
what_about_me: 'O que achou do meu atendimento, de 1 a 5?',
|
what_about_me: 'O que achou do meu atendimento, de 1 a 5?',
|
||||||
thanks: 'Obrigado!',
|
thanks: 'Obrigado!',
|
||||||
im_sorry_lets_try: 'Desculpe-me, vamos tentar novamente.',
|
im_sorry_lets_try: 'Desculpe-me, vamos tentar novamente.',
|
||||||
great_thanks: 'Ótimo, obrigado por contribuir com sua resposta.'
|
great_thanks: 'Ótimo, obrigado por contribuir com sua resposta.',
|
||||||
|
please_no_bad_words: 'Por favor, sem palavrões!'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue