Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bot-utilities

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bot-utilities - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

test/kitten.jpg

31

lib/twit-mixins.js

@@ -6,6 +6,9 @@ 'use strict';

module.exports = {
updateWithMedia: function (status, inReplyTo, imageBufferOrStream, callback) {
var API_URL = 'https://api.twitter.com/1.1/statuses/update_with_media.json';
updateWithMedia: function (options, imageBufferOrStream, cb) {
var API_URL = 'https://upload.twitter.com/1.1/media/upload.json';
var r = request.post(API_URL, {
var self = this;
// First we post to media/upload.json
request.post(API_URL, {
oauth: {

@@ -16,15 +19,19 @@ consumer_key: this.config.consumer_key,

token_secret: this.config.access_token_secret
},
formData: {
media: imageBufferOrStream
},
json: true
}, function (err, response, body) {
if (err) {
return cb(err);
}
}, callback);
var form = r.form();
options.media_ids = body.media_id_string;
form.append('status', status);
if (inReplyTo) {
form.append('in_reply_to_status_id', inReplyTo);
}
return form.append('media[]', imageBufferOrStream);
// Then we post to statuses/update.json with the media_id from
// media/upload.json
self.post('statuses/update', options, cb);
});
}
};
{
"name": "bot-utilities",
"version": "1.0.3",
"version": "2.0.0",
"description": "Utilities for Twitter bots.",

@@ -16,4 +16,6 @@ "main": "bot-utilities.js",

"devDependencies": {
"chai": "^1.9.2",
"dotenv": "^0.4.0",
"mocha": "^1.21.5",
"chai": "^1.9.2"
"twit": "^1.1.18"
},

@@ -20,0 +22,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc