scure-dialogflow
Version:
Javascript engine for creating conversational adventures with Dialogflow / GoogleAssistant through SCURE
14 lines (11 loc) • 607 B
JavaScript
const { getCommandSyn } = require('scure').lib;
const { getArgument } = require('./common');
const { getCommandForIntent, getIntentForCommand } = require('./intent-command-mapper.js');
const checkForSyns = originalIntent => scure => (conv, args) => {
const argument = getArgument(args, 'arg');
const command = getCommandForIntent(originalIntent);
const commandToReplace = getCommandSyn(command, argument, conv.data, scure);
const updatedIntent = commandToReplace ? getIntentForCommand(commandToReplace) : originalIntent;
updatedIntent(scure)(conv, args);
};
exports.checkForSyns = checkForSyns;