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

retrocord

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retrocord - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

2

package.json
{
"name": "retrocord",
"version": "1.1.7",
"version": "1.1.8",
"description": "The best in life",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -1,4 +0,1 @@

const Discord = require('discord.js');
const superagent = require('superagent');
module.exports = (vorpal) => {

@@ -11,30 +8,17 @@ const { chalk, discord, timestamp } = vorpal;

if (vorpal.current.channel) {
const start = Date.now();
const url = `https://discordapp.com/api/guilds/${vorpal.current.guild}/messages/search?content=${args.query.join(' ')}${args.options.guild ? '' : `&channel_id=${vorpal.current.channel}`}`;
superagent.get(url).set('Authorization', discord.token).end((err, res) => {
if (res.body.total_results === 0 || err || res.body.code) {
vorpal.log(chalk.bold('Error:', res.body.code ? 'Still indexing...' : null || 'No results found!'));
return cb();
} else {
let results = res.body.messages.map(x => {
const m = x.find(z => z.hit);
return new Discord.Message(discord.channels.get(m.channel_id), m, discord);
});
const occurances = {};
for (const m of results) {
if (!occurances[m.author.id]) occurances[m.author.id] = 0;
occurances[m.author.id]++;
}
let highestUser = discord.users.get(Object.keys(occurances)[Object.values(occurances).indexOf(Object.values(occurances).sort().reverse()[0])]);
highestUser = `${highestUser.username}#${highestUser.discriminator}`;
results = results.map(r => chalk.bold(`${chalk.yellow(timestamp(new Date(r.createdAt), true))} ${r.author.username}#${r.author.discriminator} `) + r.cleanContent)
.slice(0, args.options.show || 10).reverse();
const end = Date.now();
vorpal.log(chalk.bold(`Found ${res.body.total_results} results in ${end - start}ms (showing ${results.length})`));
vorpal.log(`Highest User: ${highestUser}`);
vorpal.log(chalk.bold('-- BEGIN SEARCH --'));
vorpal.log(results.join('\n'));
vorpal.log(chalk.bold('--- END SEARCH ---'));
return cb();
}
discord.channels.get(vorpal.current.channel).search({
content: args.query.join(' '),
})
.then(r => r.messages)
.then(r => r.map(msgs => msgs.find(m => m.hit)))
.then(messages => {
vorpal.log(chalk.bold('-- BEGIN SEARCH --'));
const results = messages
.map(r => chalk.bold(`${chalk.yellow(timestamp(new Date(r.createdAt), true))} ${r.author.tag} `) + r.cleanContent)
.slice(0, args.options.show || 10)
.reverse()
.join('\n');
console.log(results);
vorpal.log(chalk.bold('--- END SEARCH ---'));
return cb();
});

@@ -41,0 +25,0 @@ } else {

@@ -188,1 +188,3 @@ #!/usr/bin/env node

}
process.on('unhandledRejection', () => {}); // eslint-disable-line no-empty-function
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