Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최재은
/
밀당강의봇
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김예미
2019-06-02 22:47:00 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e4b9f88303b9a86b85bea7bb1768f2f2641d1d1
4e4b9f88
1 parent
0744c288
Edit Template 3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
18 deletions
controller.js
template.js
controller.js
View file @
4e4b9f8
...
...
@@ -26,11 +26,14 @@ exports.handlePostback = (sender_psid, received_postback) => {
if
(
payload
===
'Greeting'
){
response
=
template
.
greetingTemplate
();
callSendAPI
(
sender_psid
,
response
);
}
else
if
(
payload
===
'CHOICE_BY_PROF'
){
}
let
first_choice
=
payload
.
first_choice
;
if
(
first_choice
===
'CHOICE_BY_PROF'
){
handlePostback_choiceByProf
(
sender_psid
,
received_postback
);
}
else
if
(
payload
===
'CHOICE_BY_LECT'
){
}
else
if
(
first_choice
===
'CHOICE_BY_LECT'
){
handlePostback_choiceByLect
(
sender_psid
,
recieved_postback
);
}
else
if
(
payload
===
'HELP'
){
}
else
if
(
first_choice
===
'HELP'
){
handlePostback_help
(
sender_psid
,
recieved_postback
);
}
}
...
...
@@ -38,7 +41,7 @@ exports.handlePostback = (sender_psid, received_postback) => {
const
handlePostback_choiceByProf
=
(
sender_psid
,
received
)
=>
{
let
response
;
let
stat
=
received
.
stat
;
let
stat
=
received
.
payload
.
stat
;
if
(
stat
===
'stat_0'
){
response
=
template
.
getProfNameTemplate
(
received
);
...
...
@@ -76,7 +79,7 @@ const handlePostback_help = (sender_psid, received) => {
if
(
stat
===
'stat_0'
){
response
=
template
.
howToTemplate
(
received
);
}
else
if
(
stat
===
=
'stat_1'
){
}
else
if
(
stat
===
'stat_1'
){
response
=
template
.
goToGreetTemplate
(
received
);
}
callSendAPI
(
sender_psid
,
response
);
...
...
@@ -84,7 +87,7 @@ const handlePostback_help = (sender_psid, received) => {
// Sends response messages via the Send API
const
callSendAPI
=
(
sender_psid
,
response
,
cb
=
null
)
=>
{
console
.
log
(
'response:'
+
response
);
// Send the HTTP request to the Messenger Platform
request
({
"url"
:
"https://graph.facebook.com/v2.6/me/messages"
,
...
...
template.js
View file @
4e4b9f8
...
...
@@ -13,23 +13,26 @@ exports.greetingTemplate = () => {
{
"type"
:
"postback"
,
"title"
:
greetingTitle
[
0
],
"payload"
:
"CHOICE_BY_PROF"
,
"stat"
:
"stat_0"
,
"rate"
:{}
"payload"
:{
first_choice
:
"CHOICE_BY_PROF"
,
stat
:
"stat_0"
}
},
{
"type"
:
"postback"
,
"title"
:
greetingTitle
[
1
],
"payload"
:
"CHOICE_BY_LECT"
,
"stat"
:
"stat_0"
,
"rate"
:{}
"payload"
:{
first_choice
:
"CHOICE_BY_LECT"
,
stat
:
"stat_0"
}
},
{
"type"
:
"postback"
,
"title"
:
greetingTitle
[
2
],
"payload"
:
"HELP"
,
"stat"
:
"stat_0"
,
"rate"
:{}
"payload"
:{
first_choice
:
"HELP"
,
stat
:
"stat_0"
}
}
]
}
...
...
@@ -49,9 +52,11 @@ exports.getProfNameTemplate = (received) => {
{
"type"
:
"postback"
,
"title"
:
"처음으로"
,
"payload"
:
'Greeting'
,
"stat"
:
'stat_0'
,
"rate"
:{}
"payload"
:{
first_choice
:
'Greeting'
,
stat
:
'stat_0'
,
rate
:{}
}
}
]
}
...
...
@@ -61,6 +66,8 @@ exports.getProfNameTemplate = (received) => {
exports
.
choiceLectOfProfTemplate
=
(
received
)
=>
{
//메세지
return
{
text
:
"성공"
}
}
exports
.
rateTemplate
=
(
received
)
=>
{
...
...
Please
register
or
login
to post a comment