From 59a8ead47cfb87b5ac62fec3c989775957c17f55 Mon Sep 17 00:00:00 2001 From: Emmanuel Tierra Date: Mon, 9 Oct 2017 13:32:21 +0800 Subject: [PATCH] Inital commit --- index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.js b/index.js index 6653fb1..cac89d9 100644 --- a/index.js +++ b/index.js @@ -56,11 +56,24 @@ const comments = client.CommentStream(streamOpts); comments.on('comment', (comment) => { /* * Catches the phrase 'phlease tweet this!' + * + * (Coming soon?) + * Optional query /^n/ where: + * n => number of ancestors to include in the tweet (defaults to 1, which is the parent) + * example: 'phlease tweet this! ^2' */ var regex = /phlease tweet this!\s*(\^{1}\d)?/gi, match = regex.exec( comment.body ); if( match ){ + + // coming soon + if( match.indexOf( '^' ) !== -1 ){ + var ancestors = match.split('^'); + ancestors = ancestors[1]; + } + // coming soon + // get parent comment r.getComment(comment.parent_id) .fetch()