Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var riveScriptGenerator = new RiveScript();
function loadingDone(batch_num) {
console.log(`[RiveScript] Batch #${batch_num} has finished loading!`);
riveScriptGenerator.sortReplies();
}
function loadingError(batch_num, error) {
console.log(`[RiveScript] Load the batch #${batch_num} is failed`, JSON.stringify(error));
}
riveScriptGenerator.loadDirectory('../brain').then(loadingDone).catch(loadingError);
// Initialise QuickBlox
QB.init(CONFIG.appId, CONFIG.authKey, CONFIG.authSecret);
var qbListeners = {
// Contact list listener
onSubscribeListener: function onSubscribeListener(userId) {
console.log(`[QB] onSubscribeListener. Subscribe from ${userId}`);
QB.chat.roster.confirm(userId, function() {
console.log(`[QB] Confirm subscription from user ${userId}`);
});
},
// System messages listener
onSystemMessageListener: function onSystemMessageListener(msg) {
if(msg.extension.notification_type === '1'){
console.log(`[QB] The user ${msg.userId} adds you to dialog`);