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
wjc0930
2019-06-01 23:20:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6477c7a5e001f3641bdc58b3f5479bbdb011fda7
6477c7a5
1 parent
d7814737
Controller - Template Sample Workflow
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
controller.js
template.js
controller.js
View file @
6477c7a
...
...
@@ -18,6 +18,8 @@ exports.handleMessage = (sender_psid, received_message) => {
callSendAPI
(
sender_psid
,
response
);
}
// Handle postback(=button) events
exports
.
handlePostback
=
(
sender_psid
,
received_postback
)
=>
{
let
response
;
...
...
@@ -36,7 +38,7 @@ exports.handlePostback = (sender_psid, received_postback) => {
callSendAPI
(
sender_psid
,
template
.
askTemplate
(
'Show me more'
));
});
}
else
if
(
payload
===
'GET_STARTED'
){
response
=
template
.
askTemplate
(
'Are you a Cat or Dog Person?'
);
response
=
template
.
greetingTemplate
(
);
callSendAPI
(
sender_psid
,
response
);
}
// Send the message to acknowledge the postback
...
...
template.js
View file @
6477c7a
let
images
=
require
(
"./pics"
);
let
greetingText
=
"안녕하세요! 컴공/소융 강의평가 봇이에요. 아래에 버튼 3개를 눌러주세요."
;
// 인사말
let
greetingTitle
=
[
"교수명으로 검색"
,
"강의명으로 검색"
,
"HELP"
];
exports
.
greetingTemplate
=
()
=>
{
return
{
"attachment"
:{
"type"
:
"template"
,
"payload"
:{
"template_type"
:
"button"
,
"text"
:
greetingText
,
"buttons"
:[
{
"type"
:
"postback"
,
"title"
:
greetingTitle
[
0
],
"payload"
:
"CHOICE_BY_PROF"
},
{
"type"
:
"postback"
,
"title"
:
greetingTitle
[
1
],
"payload"
:
"CHOICE_BY_LECT"
}
{
"type"
:
"postback"
,
"title"
:
greetingTitle
[
2
],
"payload"
:
"CHOICE_BY_HELP"
}
]
}
}
}
}
exports
.
askTemplate
=
(
text
)
=>
{
return
{
...
...
Please
register
or
login
to post a comment