basicset-chronicler

3.1.0 • Public • Published

chronicler

A module that creates a persistent topic-centric record of an app's interactions with Twitter users.

Etc.!

Installation

npm install basicset-chronicler

Usage

Create an instance:

var Chronicler = require('basicset-chronicler');
var chronicler = Chronicler({
  db: 'appname.db'
});

Warning/TODO: createChronicler should actually be async, but is not. It's not safe to use it until the next tick.

Record that a tweet was replied to.

chronicler.recordThatTweetWasRepliedTo(tweetId, logError);

  function logError(error) {
    if (error) {
      console.log(error);
    }
  }

Find out if a tweet was replied to.

chronicler.tweetWasRepliedTo(tweetId, function done(error, replied) {
  if (replied) {
    console.log('Tweet', tweetId, 'was replied to.');
  }
});

Find out if a topic has been discussed with a Twitter user.

chronicler.topicWasUsedInTribute('jerks', 'someuserid', reportUsed);

function reportUsed(error, wasUsed) {
  if (wasUsed) {
    console.log('jerks were discussed with user someuserid.');
  }
}

Find out how many times a topic has been discussed with a Twitter user.

chronicler.timesTopicWasUsedInTribute('jerks', 'someuserid', reportUsed);

function reportUsed(error, count) {
  console.log('jerks were discussed with user someuserid', count, 'times.');
}

Tests

Run tests with make test.

License

MIT.

Readme

Keywords

Package Sidebar

Install

npm i basicset-chronicler

Weekly Downloads

1

Version

3.1.0

License

MIT

Last publish

Collaborators

  • jimkang