Commit d86e7df1 authored by Eric Meier's avatar Eric Meier
parents 5d527dc3 e7382a98
......@@ -13,7 +13,6 @@ module.exports = [
(session, results) => {
if (results.response.entity === "Bye Bye") {
session.userData = {};
session.reset();
session.replaceDialog("welcome");
} else {
session.endDialog();
......@@ -29,7 +28,7 @@ const confirmCard = (session, topic, img) => {
])
)
.buttons([
builder.CardAction.imBack(session, "Bye Bye", "Of course"),
builder.CardAction.postBack(session, "Bye Bye", "Of course"),
builder.CardAction.imBack(session, "I changed my mind", "Never")
]);
};
......@@ -11,13 +11,18 @@ module.exports = [
session.send(msg);
setTimeout(() => next(), 800);
} else {
if (store.getRecentTopics(6, session.userData) === [])
if (
store.getRecentTopics(6, session.userData) &&
typeof store.getRecentTopics(6, session.userData) == Array &&
store.getRecentTopics(6, session.userData).length >= 0
)
session.replaceDialog("recent");
else {
const msg = new builder.Message(session).addAttachment(
welcomeCard(session)
);
session.send(msg);
session.send("What do you wanna learn about tody?");
session.endDialog();
}
}
......@@ -34,6 +39,7 @@ module.exports = [
);
session.userData.name = results.response;
session.send("What do you wanna learn about tody?");
session.endDialog();
}
];
......
......@@ -25,34 +25,11 @@ const getSyns = base => {
let out = "";
let syns = {};
syns["need"] = getSyns("need");
syns["explore"] = getSyns("explore");
syns["about"] = getSyns("about");
syns["got"] = getSyns("got");
syns["average"] = getSyns("average");
syns["knowledge"] = getSyns("understanding");
syns["please"] = getSyns("please");
syns["continue"] = getSyns("continue");
for (let index = 0; index < 25; index++) {
out +=
"I " +
syns["need"][index] +
" " +
syns["explore"][index] +
" " +
randomTopic() +
" " +
randomTopic() +
" " +
randomTopic() +
" " +
randomTopic() +
" " +
randomTopic() +
" and " +
syns["got"][index] +
" " +
syns["knowledge"][index] +
"\n";
out += syns["please"][index] + " " + syns["continue"][index] + "\n";
}
fs.writeFile("/home/tammo/out.txt", out, function(err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment