Skip to content

Commit

Permalink
Added Telegram & normal user message for use in Nodes. t_user_message…
Browse files Browse the repository at this point in the history
… user_message
  • Loading branch information
jackdh committed Jan 27, 2019
1 parent 0931a17 commit 28078b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions server/mongo/direct/generateResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function generateResponseInternal(
session.entities.saved,
sessionEntities,
);
session.entities.saved.user_message = { value: message };
timer('Got Items');
data.ruid = uuidv1();

Expand Down
20 changes: 16 additions & 4 deletions server/thirdparties/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,16 @@ function server(webserver) {
.exec();

const { chat, from, text } = req.body.message;
let userMessage = text;
if (text.startsWith('/')) {
const split = text.split(' ');
split.shift();
userMessage = split.join(' ');
}

const telegramDetails = {};
const telegramDetails = {
t_user_message: { value: userMessage },
};
forOwn(from, (value, key) => {
telegramDetails[`t_${key}`] = { value };
});
Expand All @@ -97,9 +105,13 @@ function server(webserver) {
parse_mode: 'Markdown',
});
}

res.sendStatus(200);
});
})
.then(() => {
res.sendStatus(200);
})
.catch(error => {
debug(error);
});
});
}

Expand Down

0 comments on commit 28078b3

Please sign in to comment.