npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tweet-tweet

v1.0.4

Published

A no-nonsense api for posting tweets.

Downloads

234

Readme

tweet-tweet

Build Status

A no-nonsense api for posting tweets.

This is only for updating your Twitter status. This does not get tweets, or stream search results.

Images and videos are not supported.

example

var TweetTweet = require('tweet-tweet')

var tweet = TweetTweet({
	consumerKey: '...',
	consumerSecret: '...',
	accessToken: '...',
	accessTokenSecret: '...'
})

tweet('Never teach someone how to cartwheel beside a lake. #lessonlearned')

setTimeout(function () {
	tweet('That awkward moment when you wake up... Said no one ever.')
}, 60 * 1000)

api

var TweetTweet = require('tweet-tweet')

TweetTweet(auth)

If you don't know how to get the tokens and secrets from Twitter, see AUTHENTICATION.md for detailed instructions.

  • auth is an object with the following properties, all of which are required:
    • consumerKey
    • consumerSecret
    • accessToken
    • accessTokenSecret
  • Returns tweet().

tweet(status, [cb])

  • status is a string or an object
    • If it is a string, it is the text of your status update.
    • If it is an object, it can have the parameters specified in the Twitter API under the Parameters section.
      • status - Required. The text of your status update. E.g. 'i love my cat. #cats'
      • in_reply_to_status_id - The ID of an existing status that the update is in reply to. Note that the author must be referenced in the status. E.g. '@twitter'
      • possibly_sensitive - If the tweet contains nudity, violence, etc. set this to true. Defaults to false.
  • cb(err, response) is an optional callback function. If no callback is given, errors will be thrown.
    • err is an Error object or null.
    • response is the parsed JSON response. See a sample response in the Twitter API under the Example Result section.
// Status string vs. status object
tweet('i like Twitter')
// Equivalent
tweet({ status: 'i like Twitter' })


// Setting parameters
tweet({
	status: 'not for weak stomachs: http://emergency-room-pictures.com',
	possibly_sensitive: true
})

tweet({
	status: 'Happy birthday @twitter!',
	in_reply_to_status_id: '579328173764014080'
})

tweet('why is the sky blue?', function (err, res) {
	if (err) throw err
	else console.log(res)
})

tweet({
	status: 'People comment "lol" even when they do not laugh.'
}, function (err, res) {
	if (err) throw err
	else console.log(res)
})

install

With npm do:

npm install tweet-tweet

license

VOL