Skip to content
Snippets Groups Projects
Commit 4627a0f1 authored by Diego Dorgam's avatar Diego Dorgam
Browse files

make the bot less verbose in channels

parent 1bc7ee49
No related branches found
No related tags found
No related merge requests found
{
"name": "hubot-natural",
"version": "0.0.4",
"version": "0.0.5",
"private": true,
"author": "Diego Dorgam <diego.dorgam@rocket.chat>",
"description": "NLP YAML oriented chatbot",
......@@ -10,7 +10,7 @@
"hubot-help": "^0.2.2",
"hubot-scripts": "^2.17.2",
"hubot-shell": "^1.0.2",
"hubot-rocketchat": "^1.0.11",
"hubot-rocketchat": "^1.0.12",
"js-yaml": "^3.2.5",
"natural": "^0.5.0",
"pm2": "^2.4.2"
......
......@@ -46,6 +46,7 @@ sendWithNaturalDelay = (msgs, elapsed=0) ->
cb?()
, delay
# check these
livechatTransferHuman = (res) ->
setTimeout ->
res.robot.adapter.callMethod 'livechat:transfer',
......@@ -59,6 +60,7 @@ setUserName = (res, name) ->
name: name
,
_id: res.envelope.room
#
classifyInteraction = (interaction, classifier) ->
if Array.isArray interaction.expect
......@@ -215,14 +217,18 @@ module.exports = (_config, robot) ->
currentNode.process.call @, res, msg, subClassifications
robot.hear /(.+)/i, (res) ->
# console.log(res)
console.log(res.answer)
console.log(res)
#console.log(res.answer)
res.sendWithNaturalDelay = sendWithNaturalDelay.bind(res)
msg = res.match[0].replace res.robot.name+' ', ''
msg = msg.replace(/^\s+/, '')
msg = msg.replace(/\s+&/, '')
processMessage res, msg
# check if robot should respond
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
else if res.envelope.user.roomType in ['d','l']
processMessage res, msg
# TODO
# make a function for checking roles
......
......@@ -156,7 +156,7 @@ interactions:
trust: .8
interactions:
- get-programacao
- cancela-programacao
# - cancela-programacao
# error:
# - erro-trilha
event: respond
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment