New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mehdown

Package Overview
Dependencies
Maintainers
6
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mehdown - npm Package Compare versions

Comparing version 2.45.1 to 2.45.2

98

lib/index.js

@@ -354,3 +354,8 @@ const url = require('url');

request.get(`http://api.giphy.com/v1/gifs/search?q=${encodeURIComponent(args)}&api_key=${process.env.GIPHY_APIKEY || 'dc6zaTOxFJmzC'}`, { json: true }, function(err, res, body) {
if (!process.env.GIPHY_API_KEY) {
console.warn('GIPHY_API_KEY environment variable is not set');
return callback();
}
request.get(`http://api.giphy.com/v1/gifs/search?q=${encodeURIComponent(args)}&api_key=${process.env.GIPHY_API_KEY}`, { json: true }, function(err, res, body) {
if (err) {

@@ -555,93 +560,2 @@ return callback();

},
wootstalker: function(args, callback) {
if (!args || args === '--help' || args === '-h') {
var help = 'Usage: /wootstalker site|url\n\n';
help += 'Show details of a deal from woot.com\n\n';
help += 'Examples:\n';
help += ' `/wootstalker home` shows the details for the current home.woot.com deal.\n';
help += ' `/wootstalker shirt` shows the details for the current shirt.woot.com deal.\n';
help += ' `/wootstalker https://sellout.woot.com/offers/cratpv3nt-4-a11` shows the details for the deal of the specified URL.\n';
return callback(null, `/wootstalker ${args || ''}\n${help}`);
}
// Remove secondary arguments and any pasted variables
const search = args.split(' ')[0].split('?')[0];
if (['computers', 'electronics', 'gourmet', 'home', 'sellout', 'shirt', 'sport', 'tools', 'wine', 'woot'].includes(search.toLowerCase())) {
var isSite = true;
}
const regExp = /(https:\/\/(computers|electronics|gourmet|home|sellout|shirt|sport|tools|wine|woot|www))\.woot.com\/(offers|plus)\/([-\w]+)/;
var matches = search.match(regExp);
if (matches && matches[1] && matches[2] && matches[3] && matches[4]) {
var isUrl = true;
}
// Store original arguments
const orig = args;
var _markdown = `/wootstalker ${orig}\n`;
// Inject affiliate code into valid URLs
if (isUrl) {
var affurl = `http://products.wootstalker.com?url=${orig}`;
_markdown = `/wootstalker [${orig}](${affurl} "")\n`;
}
if (isSite || isUrl) {
// Get details from API
async.retry(function(callback) {
request.get(`https://api.wootstalker.com/read?search=${search}`, { json: true }, function(err, res, events) {
if (err) {
return callback(err);
}
if (res.statusCode !== 200) {
return callback(new Error(res.statusCode));
}
callback(null, events);
});
}, function(err, events) {
if (err) {
return callback(null, `${_markdown}\nError: Unable to contact WootStalker :cry:`);
}
if (!events || !Array.isArray(events) || !events.length) {
return callback(null, `${_markdown}\nI was unable to find details for the supplied deal :cry:`);
}
var success = false;
events.forEach(e => {
if (e.Offers) {
e.Offers.forEach(o => {
success = true;
var price = `$${o.SalePrice.toString().replace('- ', '- $')}`;
var url = `https://products.wootstalker.com?url=${o.Url.split('?')[0]}`;
_markdown += `\n[![${o.Title}](${o.Image})](${url})`;
_markdown += `\n**[${o.Title}](${url} "${o.Title}")**\nPrice: ${price}\nCondition: ${o.Condition}\n`;
if (o.SoldOut) {
_markdown += '**This deal is currently sold out**\n';
}
});
}
});
if (!success) {
_markdown += '\nI was unable to find details for the specified deal :cry:';
return callback(null, _markdown);
}
callback(null, _markdown);
});
} else {
_markdown += '\nWootStalker lookup failed - invalid site or URL entered :cry:';
callback(null, _markdown);
}
},
youtube: function(args, callback) {

@@ -648,0 +562,0 @@ // This command requires arguments.

2

package.json

@@ -39,3 +39,3 @@ {

},
"version": "2.45.1"
"version": "2.45.2"
}

@@ -64,3 +64,2 @@ # mehdown

- `/whatdog image-url` - What dog is this?
- `/wootstalker url` - Display woot.com deal details
- `/youtube text` - Post a random YouTube video

@@ -67,0 +66,0 @@

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