From ec1adcb448910379e3d01d2e10f039621797a3f3 Mon Sep 17 00:00:00 2001
From: Diego Dorgam <diego.dorgam@rocket.chat>
Date: Tue, 14 Nov 2017 01:04:08 -0200
Subject: [PATCH] configure.coffee improvements, rocketenglish.yml improvements

---
 .gitignore                       |   1 +
 .gitlab-ci.yml                   |  70 --------
 docker-compose.yml               |  39 ++++-
 env-small.sh                     |  17 --
 scripts/bot/index.coffee         |  70 ++++----
 scripts/config/rocketenglish.yml | 275 +++++++++++++++++++++----------
 scripts/events/configure.coffee  |   7 +-
 7 files changed, 263 insertions(+), 216 deletions(-)
 delete mode 100644 .gitlab-ci.yml
 delete mode 100644 env-small.sh

diff --git a/.gitignore b/.gitignore
index 0aaac08..42fd345 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ Procfile
 train.js
 env.sh
 brill.js
+chat/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 7fa838c..0000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,70 +0,0 @@
----
-image: docker:git
-services:
-- docker:dind
-stages:
-- build
-- release
-- deploy
-
-variables:
-  CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
-  CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
-
-before_script:
-  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
-  - 'curl -u "${C_ACCESS_KEY}:${C_SECRET_KEY}"
-     -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d "{}"
-     "https://${C_SERVER_URL}:${C_SERVER_URL_PORT}/v1/projects/${HOMOLOG_PROJECT_ID}/services/${HOMOLOG_SERVICE_ID}/?action=finishupgrade"'
-  - 'curl -u "${C_ACCESS_KEY}:${C_SECRET_KEY}"
-     -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d "{}"
-     "http://${C_SERVER_URL}:${C_SERVER_URL_PORT}/v1/projects/${PRODUCTION_PROJECT_ID}/services/${PRODUCTION_SERVICE_ID}/?action=finishupgrade"'
-
-build to homolog:
-  stage: build
-  script:
-    - docker build -t $CONTAINER_TEST_IMAGE .
-    - docker push $CONTAINER_TEST_IMAGE
-  only:
-    - branches
-  except:
-    - master
-  environment: homolog
-
-build to realease:
-  stage: build
-  script:
-    - docker build -t $CONTAINER_TEST_IMAGE .
-    - docker push $CONTAINER_TEST_IMAGE
-  only:
-    - tags
-  environment: production
-
-release-image:
-  stage: release
-  script:
-    - docker pull $CONTAINER_TEST_IMAGE
-    - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
-    - docker push $CONTAINER_RELEASE_IMAGE
-  only:
-    - tags
-  environment: production
-
-deploy to homolog:
-  stage: deploy
-  script:
-    - 'curl -u "${C_ACCESS_KEY}:${C_SECRET_KEY}" -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d "{ \"inServiceStrategy\": { \"launchConfig\": {  \"imageUuid\": \"docker:${CONTAINER_TEST_IMAGE}\" } } }" "https://cloud.dorgam.it/v1/projects/${HOMOLOG_PROJECT_ID}/services/${HOMOLOG_SERVICE_ID}/?action=upgrade"'
-  only:
-    - /beta\d+/
-  except:
-    - master
-    - tags
-  environment: homolog
-
-deploy to production:
-  stage: deploy
-  script:
-    - 'curl -u "${C_ACCESS_KEY}:${C_SECRET_KEY}" -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d "{ \"inServiceStrategy\": { \"launchConfig\": {  \"imageUuid\": \"docker:${CONTAINER_TEST_IMAGE}\" } } }" "https://cloud.dorgam.it/v1/projects/${PRODUCTION_PROJECT_ID}/services/${PRODUCTION_SERVICE_ID}/?action=upgrade"'
-  only:
-    - tags
-  environment: production
diff --git a/docker-compose.yml b/docker-compose.yml
index f819244..c574952 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,18 +1,45 @@
 version: '2'
 
 services:
+  mongo:
+    image: mongo
+    volumes:
+    - ./chat/data/db:/data/db
+    - ./chat/data/dump:/dump
+    tty: true
+    command:
+    - mongod
+    - --smallfiles
+    - --oplogSize
+    - '128'
+
+  rocketchat:
+    image: rocketchat/rocket.chat:latest
+    links:
+      - mongo
+    environment:
+      MONGO_URL: 'mongodb://mongo:27017/rocketchat'
+      PORT: '3000'
+      ROOT_URL: 'http://localhost:3000'
+    volumes:
+      - ./chat/uploads:/app/uploads
+    ports:
+      - '3000:3000'
+
   hubot-natural:
-    image: diegodorgam/hubot-natural:alpine
+    image: diegodorgam/hubot-natural:latest
+    links:
+      - rocketchat
     environment:
-      ROCKETCHAT_URL: 'https://demo.rocket.chat'
+      ROCKETCHAT_URL: 'http://rocketchat:3000'
       HUBOT_ADAPTER: rocketchat
-      HUBOT_NAME: 'Cat Bot'
+      HUBOT_NAME: 'CatBot'
       HUBOT_DESCRIPTION: 'Processamento de linguagem natural com hubot'
-      ROCKETCHAT_ROOM: j8pjQdHtZR5JnGF2S
+      ROCKETCHAT_ROOM: GENERAL
       RESPOND_TO_DM: 'true'
       RESPOND_TO_LIVECHAT: 'true'
       ROCKETCHAT_USER: catbot
-      ROCKETCHAT_PASSWORD: '@cat!bot'
+      ROCKETCHAT_PASSWORD: 'catbotpass'
       ROCKETCHAT_AUTH: password
       HUBOT_LOG_LEVEL: debug
-      HUBOT_CORPUS: 'rocket.yml'
+      HUBOT_CORPUS: 'rocket-small.yml'
diff --git a/env-small.sh b/env-small.sh
deleted file mode 100644
index d0074a6..0000000
--- a/env-small.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-export HUBOT_ADAPTER=rocketchat
-export HUBOT_OWNER=RocketChat
-export HUBOT_NAME='CatBot'
-export HUBOT_DESCRIPTION="Processamento de linguagem natural com hubot"
-#export ROCKETCHAT_URL=https://demo.rocket.chat
-export ROCKETCHAT_URL=https://chat.dorgam.it
-#export ROCKETCHAT_ROOM=j8pjQdHtZR5JnGF2S
-export ROCKETCHAT_ROOM=GENERAL
-export RESPOND_TO_DM=true
-export RESPOND_TO_LIVECHAT=true
-export ROCKETCHAT_USER=catbot
-export ROCKETCHAT_PASSWORD='@cat!bot'
-export ROCKETCHAT_AUTH=password
-export HUBOT_LOG_LEVEL=debug
-export HUBOT_CORPUS='rocket-small.yml'
-bin/hubot -a rocketchat --name $HUBOT_NAME
diff --git a/scripts/bot/index.coffee b/scripts/bot/index.coffee
index 3ce78e3..7994cc0 100644
--- a/scripts/bot/index.coffee
+++ b/scripts/bot/index.coffee
@@ -2,6 +2,7 @@ fs = require 'fs'
 path = require 'path'
 natural = require 'natural'
 lang = (process.env.HUBOT_LANG || 'en')
+
 if lang == "en"
   PorterStemmer = require path.join '..','..','node_modules','natural','lib','natural','stemmers','porter_stemmer.js'
 else
@@ -46,6 +47,35 @@ sendWithNaturalDelay = (msgs, elapsed=0) ->
       cb?()
   , delay
 
+
+getUserRoles = (userid) ->
+  robot.adapter.chatdriver.callMethod('getUserRoles').then (users) ->
+    robot.logger.debug 'gUR Users: ' + JSON.stringify(users)
+    users.forEach (user) ->
+      user.roles.forEach (role) ->
+        if typeof usersAndRoles[role] == 'undefined'
+          usersAndRoles[role] = []
+        usersAndRoles[role].push user.username
+        return
+      return
+    robot.logger.info 'gUR Users and Roles loaded: ' + JSON.stringify(usersAndRoles)
+    return
+  return
+
+checkRole = (role, uname) ->
+  robot.logger.debug 'cR uname: ' + uname
+  robot.logger.debug 'cR role: ' + role
+  if typeof usersAndRoles[role] != 'undefined'
+    if usersAndRoles[role].indexOf(uname) == -1
+      robot.logger.debug 'cR role: ' + role
+      robot.logger.debug 'cR indexOf: ' + usersAndRoles[role].indexOf(uname)
+      false
+    else
+      true
+  else
+    robot.logger.info 'Role ' + role + ' não encontrado'
+    false
+
 # check these
 livechatTransferHuman = (res) ->
 	setTimeout ->
@@ -97,12 +127,11 @@ getContext = (res) ->
   return res.robot.brain.get(key)
 
 isDebugMode = (res) ->
-  key = 'configure_debug-mode_'+res.envelope.room+'_'+res.envelope.user.id
+  key = 'configure_debug-mode_'+res.envelope.room
   return (res.robot.brain.get(key) == 'true')
 
 getDebugCount = (res) ->
-  key = 'configure_debug-count_'+res.envelope.room+'_'+res.envelope.user.id
-
+  key = 'configure_debug-count_'+res.envelope.room
   return if res.robot.brain.get(key) then res.robot.brain.get(key) - 1 else false
 
 buildClassificationDebugMsg = (res, classifications) ->
@@ -150,7 +179,6 @@ module.exports = (_config, robot) ->
   console.log 'Processing interactions'
   console.time 'Processing interactions (Done)'
   classifier = new natural.LogisticRegressionClassifier(PorterStemmer)
-  #console.log(config.interactions)
   for interaction in config.interactions
     {name, classifiers, event} = interaction
     nodes[name] = new events[event] interaction
@@ -168,7 +196,6 @@ module.exports = (_config, robot) ->
     trust = config.trust
     interaction = undefined
     debugMode = isDebugMode(res)
-
     console.log 'context ->', context
 
     if context
@@ -226,9 +253,8 @@ module.exports = (_config, robot) ->
     currentNode = nodes[node_name or error_node_name]
     currentNode.process.call @, res, msg, subClassifications
 
+# Listener Callback
   robot.hear /(.+)/i, (res) ->
-    # console.log(res)
-    #console.log(res.answer)
     res.sendWithNaturalDelay = sendWithNaturalDelay.bind(res)
     msg = res.match[0].replace res.robot.name+' ', ''
     msg = msg.replace(/^\s+/, '')
@@ -237,34 +263,6 @@ module.exports = (_config, robot) ->
     if res.envelope.user.roomType in ['c','p']
       if (res.message.text.match new RegExp('\\b' + res.robot.name + '\\b', 'i')) or (res.message.text.match new RegExp('\\b' + res.robot.alias + '\\b', 'i'))
         processMessage res, msg
+        # TODO: Add engaged user conversation recognition
     else if res.envelope.user.roomType in ['d','l']
       processMessage res, msg
-
-# TODO
-# make a function for checking roles
-# const usersAndRoles = {};
-#
-# module.exports = function (robot) {
-#     robot.adapter.chatdriver.callMethod('getUserRoles').then(function (users) {
-#         users.forEach(function (user) {
-#             user.roles.forEach(function (role) {
-#                 if (typeof (usersAndRoles[role]) === 'undefined') {
-#                     usersAndRoles[role] = [];
-#                 }
-#
-#                 usersAndRoles[role].push(user.username);
-#             });
-#         });
-#     });
-#
-#     robot.respond(/test/i, function (res) {
-#         console.log(res);
-#
-#         if (usersAndRoles.admin.indexOf(res.message.user.name) === -1) {
-#             res.reply('What...?');
-#         } else {
-#             res.reply('hello boss!');
-#         }
-#
-#     });
-# }
diff --git a/scripts/config/rocketenglish.yml b/scripts/config/rocketenglish.yml
index eac2b29..9cf616c 100644
--- a/scripts/config/rocketenglish.yml
+++ b/scripts/config/rocketenglish.yml
@@ -31,7 +31,7 @@ interactions:
 
 # Work #
 
-# How can I work at Rocket.Chat?
+# # How can I work at Rocket.Chat?
   - name: Work-1
     expect:
       - Work at Rocket.chat
@@ -281,7 +281,7 @@ interactions:
     expect:
       - Business case
       - Case studies
-      - User examples
+      - $user examples
       - How clients use
     answer:
       - 'Yep! Take a look here:  https://rocket.chat/customers.'
@@ -1158,10 +1158,10 @@ interactions:
   # What is the number of users the platform supports?
   - name: product-8
     expect:
-      - User limit
+      - $user limit
       - Maximum number of users
       - How many user does rocket.chat support
-      - User number restriction
+      - $user number restriction
       - What is the maximum user limit
     answer:
       - Unlimited <3
@@ -1546,17 +1546,17 @@ interactions:
       - Tell people about the chat
       - Invite people to chat
     answer:
-      - You can invite as many friends you want! You'll only need to send them the registration link or enter Administration -> Users -> `+`
+      - You can invite as many friends you want! You'll only need to send them the registration link or enter Administration -> $users -> `+`
     event: respond
     type: block
 
   # What is the user limit?
   - name: chat-4
     expect:
-      - User limit
+      - $user limit
       - Maximum number of users
       - How many users can I have
-      - User pack
+      - $user pack
     answer:
       - We don’t work with limits :) The only limitation you might encounter regarding the user limit is if you are being hosted on our cloud. In that case, you could expand your hosting pack.
     event: respond
@@ -1760,22 +1760,40 @@ interactions:
       - hi
       - hi there
       - heya
-      - what's up
-      - what's going on
       - hi bot
       - Greetings
       - hey bot
       - hiii
       - hey you
     answer:
-      - Hi, user. I'm doing great and you?
+      - Hi, $user. I'm doing great and you?
       - I am happy to be here =)
       - Just to let you know, I am a chatbot. I am trained to answer questions about Rocket.Chat only.
-      - I might be able to help you with information about the product, pricing, intallation,
-      - and stuff like that.
+      - I might be able to help you with information about the product, pricing, installation,
+      - and stuff like that, but if you need some support, you should contact real people in cloud@rocket.chat or support@rocket.chat
     event: respond
     type: block
 
+  - name: greeting-1
+    expect:
+      - hello
+      - hello bot
+      - what's up
+      - what's going on
+    answer:
+      - |
+        Hello =), my name is CatBot, I'm an experimental ChatBot built in Rocket.Chat.
+        I know a lot of stuff about installation, support plans, competitors, and stuff like that...
+        but if you need real support please contact my fellow humans in support@rocket.chat.
+      - |
+        Hey! Nice to meet you, my name is Catbot and I'm here to help
+        You can ask me stuff about rocket.chat, product review, pricing, support,
+        but if you need something too specific, you might prefer the support@rocket.chat e-mail guys =)
+      - Hi you, just to let you know, I am a chatbot. I am trained to answer questions about Rocket.Chat only =D
+      - Hi human, so I'm a chatbot, I might be able to help you with information about the product, pricing, installation, but if you need a human try support@rocket.chat
+    event: respond
+    type: random
+
   - name: greeting-2
     expect:
       - How are you?
@@ -1783,7 +1801,7 @@ interactions:
       - All good?
       - How are you feeling?
     answer:
-      - I am great, User. Everything is peaceful around here...
+      - I am great, $user. Everything is peaceful around here...
       - How can I be useful to you?
       - Is there something you'd like to know about Rocket.Chat, support, installation, OpenSource movement maybe?
       - pode perguntar a vontade
@@ -1792,14 +1810,14 @@ interactions:
 
   - name: greeting-3
     expect:
-      - so long no see
+      - long time no see
       - I missed you
       - did you miss me
       - so long
       - do you remember me
     answer:
-      - Hello, user, I missed you...
-      - User! It's been a while!
+      - I missed you too...
+      - $user! It's been a while!
       - I was starting to think you wouldn't remember me anymore =)
     event: respond
     type: random
@@ -1809,15 +1827,27 @@ interactions:
       - I'm fine
       - I'm good
       - I'm great
-      - Thanks
-      - Thank you
     answer:
-      - cool =)
+      - cool =)! How can I help you?
       - That's great!
       - Awesome
     event: respond
     type: random
 
+  - name: greeting-thankfull
+    expect:
+      - Thanks
+      - Thank you
+      - awesome Thanks
+      - thks
+      - thank you very much
+    answer:
+      - you're welcome =) there is anything else?
+      - great! if you need something else please feel free to ask
+      - cool, glad to help.
+    event: respond
+    type: random
+
   - name: good-morning
     expect:
       - good morning
@@ -1825,11 +1855,11 @@ interactions:
       - morning bot
       - good morning bot
     answer:
-      - Hello, User. I wish you a great day!
-      - Good morning, User. How's the weather outside?
+      - Hello, $user. I wish you a great day!
+      - Good morning, $user. How's the weather outside?
       - It's a beatiful day to surf on the internert
-      - So great, User ;)
-      - It's all better now that you got here, User
+      - So great, $user ;)
+      - It's all better now that you got here, $user
     event: respond
     type: random
 
@@ -1839,11 +1869,11 @@ interactions:
       - afternoon
       - good afternoon
     answer:
-      - Hellos, User! i wish you a fantastic afteroon!
-      - Good afternoon, User. Did you have lunch already?
+      - Hellos, $user! i wish you a fantastic afteroon!
+      - Good afternoon, $user. Did you have lunch already?
       - It's a beautiful afternoon for a quick sleep mode ;)
-      - Good afternooooon, User!
-      - User, I was starting to miss you already
+      - Good afternooooon, $user!
+      - $user, I was starting to miss you already
     event: respond
     type: random
 
@@ -1857,58 +1887,67 @@ interactions:
       - evening
       - good night
     answer:
-      - A very good night to you as well, User!
-      - Good night, User!
-      - It is truely a good night, User
+      - A very good night to you as well, $user!
+      - Good night, $user!
+      - It is truely a good night, $user
     event: respond
     type: random
 
 # chit-chat
-  - name: yoda-quote
-    expect:
-      - conhece o mestre yoda
-      - faça uma citação de starwars
-      - cite yoda
-      - sabedoria jedi
-    answer:
-      - O medo é o caminho para o lado negro.
-      - Faça ou não faça. A tentativa não existe.
-      - Treine a si mesmo a deixar partir tudo que teme perder.
-      - Difícil de ver. Sempre em movimento está o Futuro.
-      - O medo leva à raiva, a raiva leva ao ódio e o ódio leva ao sofrimento.
-      - Que a Força esteja com você!
-      - Muitas das verdades que temos dependem de nosso ponto de vista.
-      - Grande guerreiro? Guerra não faz grande ninguém.
-      - Ensine sempre o que você aprendeu.
-      - Tamanho importa não. Olhe para mim, você me julga pelo tamanho?
-      - Em um estado sombrio nós nos encontramos... um pouco mais de conhecimento iluminar nosso caminho pode.
-      - Um Jedi usa a Força para sabedoria e defesa, nunca para o ataque.
-      - O seu foco é a sua realidade.
-      - O lado negro não é mais poderoso, apenas mais rápido, mais fácil e mais sedutor.
-      - O medo da perda é um caminho para o lado negro.
-      - O lado negro mancha tudo. Impossível de ver o futuro é.
-      - Lembre-se sempre, o seu foco determina a sua realidade.
-      - Verdadeiramente maravilhosa, a mente de uma criança.
-      - As guerras não fazem de ninguém melhor.
-      - Aliada minha é a Força. E poderosa aliada ela é.
-      - A morte é parte natural da Vida. Regozije-se por aqueles que se uniram com a Força. Não lamente por eles. Não sinta falta deles. O apego leva à inveja. À sombra da cobiça, isso sim.
-      - Só é diferente na sua mente. Você precisa desaprender o que aprendeu.
-      - Se tão poderoso você é, por que fugir?
-      - Controle, controle! Você precisa aprender a se controlar.
-      - Muito a aprender você ainda tem.
-      - Tanta certeza você tem. Com você as coisas nunca podem ser feitas. Não ouviu nada do que eu disse?
-      - Luminosos seres somos nós, não essa rude matéria. Precisa a Força sentir à sua volta, aqui, entre nós, na árvore, na pedra em tudo, sim.
-      - Minha aliada a Força é, e poderosa aliada ela é. A vida a cria, e a faz crescer. Sua energia nos cerca e nos une.
-      - Sinta a Força!
-      - Poderoso você se tornou, o lado escuro sinto em você.
-      - Forte eu sou com a Força, mas não tão forte
-      - O crepúsculo chega e a noite deve cair, assim é a ordem das coisas, a ordem da Força.
-      - Não ceda ao ódio. Isso leva ao Lado Negro.
-      - Aliada minha é a força, e poderosa aliada ela é, a vida a cria, crescer ela faz, é a energia que cerca-nos, e liga-nos, luminosos seres somos nós e não essa rude matéria. Você precisa a força sentir ao redor seu, sinta entre você e a árvore, a pedra, em todo lugar, sim, é, mesmo entre a terra e a nave.
-    event: respond
-    type: random
-
-  - name: gender-1
+  - name: cc-yoda-quote
+    expect:
+      - do you know master yoda
+      - starwars fan?
+      - have you seen the lst jedi
+      - quote master yoda
+      - young skywalker
+      - darth Vader
+      - jedi council
+      - master Yoda
+      - padawan
+      - anakin
+    answer:
+      - "Train yourself to let go of everything you fear to lose."
+      - "Fear is the path to the dark side. Fear leads to anger. Anger leads to hate. Hate leads to suffering."
+      - "Death is a natural part of life. Rejoice for those around you who transform into the Force. Mourn them do not. Miss them do not. Attachment leads to jealously. The shadow of greed, that is."
+      - "Always pass on what you have learned."
+      - "You will know (the good from the bad) when you are calm, at peace. Passive. A Jedi uses the Force for knowledge and defense, never for attack."
+      - "Yes, a Jedi’s strength flows from the Force. But beware of the dark side. Anger, fear, aggression; the dark side of the Force are they. Easily they flow, quick to join you in a fight. If once you start down the dark path, forever will it dominate your destiny, consume you it will, as it did Obi-Wan’s apprentice."
+      - "[Luke:] I can’t believe it. [Yoda:] That is why you fail."
+      - "Powerful you have become, the dark side I sense in you."
+      - "If you end your training now — if you choose the quick and easy path as Vader did — you will become an agent of evil."
+      - "PATIENCE YOU MUST HAVE my young padawan"
+      - "Ready are you? What know you of ready? For eight hundred years have I trained Jedi. My own counsel will I keep on who is to be trained. A Jedi must have the deepest commitment, the most serious mind. This one a long time have I watched. All his life has he looked away… to the future, to the horizon. Never his mind on where he was. Hmm? What he was doing. Hmph. Adventure. Heh. Excitement. Heh. A Jedi craves not these things. You are reckless."
+      - "Feel the force!"
+      - "Remember, a Jedi’s strength flows from the Force. But beware. Anger, fear, aggression. The dark side are they. Once you start down the dark path, forever will it dominate your destiny."
+      - "Luke… Luke… do not… do not underestimate the powers of the Emperor or suffer your father’s fate you will. Luke, when gone am I… the last of the Jedi will you be. Luke, the Force runs strong in your family. Pass on what you have learned, Luke. There is… another… Sky… walker."
+      - "Once you start down the dark path, forever will it dominate your destiny, consume you it will."
+      - "You must unlearn what you have learned."
+      - "In a dark place we find ourselves, and a little more knowledge lights our way."
+      - "When you look at the dark side, careful you must be. For the dark side looks back."
+      - "You will know (the good from the bad) when you are calm, at peace. Passive. A Jedi uses the Force for knowledge and defense, never for attack."
+      - "Many of the truths that we cling to depend on our point of view."
+      - "Through the Force, things you will see. Other places. The future…the past. Old friends long gone."
+      - "Truly wonderful the mind of a child is."
+      - "The fear of loss is a path to the Dark Side."
+      - "A Jedi must have the deepest commitment, the most serious mind. This one a long time have I watched. All his life has he looked away… to the future, to the horizon. Never his mind on where he was. Hmm? What he was doing. Hmph. Adventure. Heh. Excitement. Heh. A Jedi craves not these things."
+      - "Do or do not. There is no try."
+      - "You will find only what you bring in."
+      - "May the Force be with you."
+      - "Size matters not. Look at me. Judge me by my size, do you? Hmm? Hmm. And well you should not. For my ally is the Force, and a powerful ally it is. Life creates it, makes it grow. Its energy surrounds us and binds us. Luminous beings are we, not this crude matter. You must feel the Force around you; here, between you, me, the tree, the rock, everywhere, yes. Even between the land and the ship."
+      - "Ohhh. Great warrior. Wars not make one great."
+      - "Always two there are, no more, no less. A master and an apprentice."
+      - "Difficult to see. Always in motion is the future.."
+      - "I have many children, as you seek you may find that this the last one till he must die before he must reach the becoming of mankind. Many men have failed but i have surpassed their expectation of being a Jedi master."
+      - "Looking? Found someone you have, eh?"
+      - "If into the security recordings you go, only pain will you find."
+      - "You think Yoda stops teaching, just because his student does not want to hear? A teacher Yoda is. Yoda teaches like drunkards drink, like killers kill."
+      - "Luke: What’s in there? Yoda: Only what you take with you."
+      - "The dark side clouds everything. Impossible to see the future is."
+    event: respond
+    type: random
+
+  - name: cc-gender-1
     expect:
       - are you a woman
       - are you female
@@ -1941,24 +1980,92 @@ interactions:
 # Errors
   - name: error-1
     answer:
-      - I'm sorry, I didn't get it... could you try using more details?
-      - What do you mean?
-      - I'm, sorry what do you mean by that?
+      - I'm sorry, I didn't get it...
+      - Sorry, what?
+      - not following...
+      - come again?
+      - what?
     type: random
     event: error
 
   - name: error-2
     answer:
-      - i believe I am not trained to answer this kind of subject =(
-      - Let's try something else?
-      - Are you sure I am the right robot to talk about this?
+      - |
+        Sorry, I am not trained to answer this kind of subject =(
+        you could ask something about pricing, product details, installation, cloud hosting, open source and so on...
+      - |
+        ok, I can't understand that,
+        but if you ask me something about Rocket.Chat cloud, support, services or other stuff related,
+        I'm sure I'll be able to help you =)
+      - |
+        I'm so sorry, I just don't know ho to respond you...
+        I'm desined to respond about Rocket.Chat services, support, licenscing and stuff related...
     type: random
     event: error
 
   - name: error-3
     answer:
-      - I feel so embaressed. I don't have an answer...
-      - It would be easier if we changed the subject, at least for me =p
-      - I don't know, I definetely don't know how to answer this question
+      - |
+        Ok, I definetely don't know how to help you with that.
+        please don't be mad at me, try contacting support@rocket.chat
+        maybe my human fellows are more capable to help you..
+      - |
+        I can't, sorry, I think I could, but I don't...
+        I'm just a young robot, please don't be mad,
+        maybe if you try support@rocket.chat, they have humans there...
+      - |
+        Sorry $user I don't know, I definetely don't know how to answer this question
+        I'm a limited bot, please understand, I'm learning yet
+        You can reach our dev team in support@rocket.chat if you need a human help...
     type: random
     event: error
+
+# common talk
+
+  - name: ct-ok
+    expect:
+      - that's ok
+      - ok
+      - ok then
+      - oki-doki
+      - A o-K
+    answer:
+      - cool
+      - nice
+      - alright =D
+      - =)
+      - Awesome
+      - ;)
+    event: respond
+    type: random
+
+  - name: ct-what
+    expect:
+      - what
+      - say what
+      - come again
+    answer:
+      - whaaaat?
+      - what? did I said something wrong?
+      - what what?
+      - ?
+    event: respond
+    type: random
+
+  - name: ct-badword
+    expect:
+      - stupid
+      - idiot
+      - asshole
+      - dumb ass
+      - dumb bot
+      - mother fucker
+      - sucker
+      - son of a bitch
+    answer:
+      - whaaaat? you don't need to be rude, I'm just a machine..
+      - Oh yeh?! but at least my mother-board teached better..
+      - You touch people with those fingers?
+      - sorry $user, I'm only an experimental bot...
+    event: respond
+    type: random
diff --git a/scripts/events/configure.coffee b/scripts/events/configure.coffee
index 2678556..80f5867 100644
--- a/scripts/events/configure.coffee
+++ b/scripts/events/configure.coffee
@@ -13,13 +13,14 @@ class configure
 
 #    console.log msg
     configurationBlock = msg.message.text.replace(msg.robot.name + ' ', '').split(' ')[-1..].toString()
-    console.log configurationBlock
+#    console.log configurationBlock
     configKeyValue = configurationBlock.split('=')
     configKey = configKeyValue[0]
     configValue = configKeyValue[1]
 
-    console.log('WANTS To CONFIGURE: ', configKeyValue)
-    key = 'configure_'+configKey+'_'+msg.envelope.room+'_'+msg.envelope.user.id
+    console.log('Setting config ', configKeyValue)
+    key = 'configure_'+configKey+'_'+msg.envelope.room
+#    key = 'configure_'+configKey+'_'+msg.envelope.room+'_'+msg.envelope.user.id
     msg.robot.brain.set(key, configValue)
 
     type = @interaction.type?.toLowerCase() or 'random'
-- 
GitLab