Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down