-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessageFilter.js
62 lines (49 loc) · 1.19 KB
/
messageFilter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
exports.mFilter = function(message){
console.log("message: " + message.body)
let incomingMessage = message.body.toLowerCase()
main_reply =
{
"chatId" : message.chatId,
"type" : "text",
"to" : message.from,
"body" : "What can I help you with?",
"keyboards" : [
{
"to" : message.from,
"type" : "suggested",
"responses" : [
{
"type" : "text",
"body" : "Help me plan an event."
},
{
"type" : "text",
"body" : "What events are coming up?"
},
]
}
]
}
plan_reply =
{
"chatId" : message.chatId,
"type" : "text",
"to" : message.from,
"body" : ""
}
if(incomingMessage.includes('hi')
|| incomingMessage.includes('hey')
|| incomingMessage.includes('hello')){
main_reply.body = "Hi I'm clutchman, what can I help you with?"
console.log("reply: " + main_reply.body)
return main_reply
}else if(incomingMessage == 'help me plan an event.'){
plan_reply.body = "Sure, Whats the event called?"
console.log("reply: " + plan_reply.body)
return plan_reply
}else{
console.log("reply: " + main_reply.body)
return main_reply
}
return null
}