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.8 to 2.0.0-beta

assets/logo.txt

29

.eslintrc.json
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6
"ecmaVersion": 2017
},

@@ -11,5 +11,9 @@ "env": {

"rules": {
"no-await-in-loop": "warn",
"no-compare-neg-zero": "error",
"no-extra-parens": ["warn", "all", {
"nestedBinaryExpressions": false
}],
"no-template-curly-in-string": "error",
"no-unsafe-negation": "error",
"valid-jsdoc": ["error", {

@@ -19,3 +23,3 @@ "requireReturn": false,

"prefer": {
"return": "return",
"return": "returns",
"arg": "param"

@@ -27,2 +31,3 @@ },

"Boolean": "boolean",
"Symbol": "symbol",
"object": "Object",

@@ -40,3 +45,3 @@ "function": "Function",

"complexity": "warn",
"consistent-return": "error",
"consistent-return": "off",
"curly": ["error", "multi-line", "consistent"],

@@ -56,3 +61,4 @@ "dot-location": ["error", "property"],

"no-octal-escape": "error",
"no-return-assign": "error",
"no-return-assign": "off",
"no-return-await": "error",
"no-self-compare": "error",

@@ -65,5 +71,8 @@ "no-sequences": "error",

"no-useless-concat": "error",
"no-useless-escape": "off",
"no-useless-escape": "error",
"no-useless-return": "error",
"no-void": "error",
"no-warning-comments": "warn",
"prefer-promise-reject-errors": "error",
"require-await": "warn",
"wrap-iife": "error",

@@ -85,2 +94,3 @@ "yoda": "error",

"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"capitalized-comments": ["off", "always", { "ignoreConsecutiveComments": true }],
"comma-dangle": ["error", "always-multiline"],

@@ -99,5 +109,6 @@ "comma-spacing": "error",

"max-depth": "error",
"max-len": ["error", 120, 2],
"max-nested-callbacks": ["error", { "max": 4 }],
"max-statements-per-line": ["error", { "max": 2 }],
"new-cap": "error",
"new-cap": "off",
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],

@@ -114,2 +125,3 @@ "no-array-constructor": "error",

"no-whitespace-before-property": "error",
"nonblock-statement-body-position": "error",
"object-curly-spacing": ["error", "always"],

@@ -129,5 +141,7 @@ "operator-assignment": "error",

"spaced-comment": "error",
"template-tag-spacing": "error",
"unicode-bom": "error",
"arrow-body-style": "error",
"arrow-parens": ["error", "always"],
"arrow-spacing": "error",

@@ -144,5 +158,4 @@ "no-duplicate-imports": "error",

"template-curly-spacing": "error",
"yield-star-spacing": "error",
"no-console": "off"
"yield-star-spacing": "error"
}
}
{
"name": "retrocord",
"version": "1.1.8",
"description": "The best in life",
"version": "2.0.0-beta",
"description": "",
"main": "src/index.js",
"bin": {
"retrocord": "src/index.js"
},
"scripts": {
"nexe": "node ./node_modules/nexe/bin/nexe"
"lint": "eslint -c ./.eslintrc.json src",
"build": "pkg ./package.json --out-path=./build",
"full": "npm run lint && npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/devsnek/retrocord.git"
},
"author": "snek <me@gus.host>",
"license": "MIT",
"bugs": {
"url": "https://github.com/devsnek/retrocord/issues"
},
"homepage": "https://github.com/devsnek/retrocord#readme",
"dependencies": {
"ansi-256-colors": "^1.1.0",
"blessed": "github:devsnek/blessed",
"chalk": "^2.0.1",
"discord.js": "github:hydrabolt/discord.js",
"inquirer": "^2.0.0",
"node-emoji": "^1.4.3",
"ora": "^1.0.0",
"username": "^2.2.2",
"vorpal": "^1.11.4"
"erlpack": "github:hammerandchisel/erlpack",
"node-emoji": "^1.8.1",
"uws": "^8.14.0"
},
"optionalDependencies": {
"erlpack": "github:hammerandchisel/erlpack"
},
"devDependencies": {
"bufferutil": "^1.3.0",
"nexe": "^1.1.2",
"opusscript": "0.0.2",
"utf-8-validate": "^2.0.0"
"eslint": "^4.3.0",
"pkg": "^4.1.3"
},
"author": "Gus Caplan <me@gus.host>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/GusCaplan/retrocord.git"
},
"bugs": {
"url": "https://github.com/GusCaplan/retrocord/issues"
},
"homepage": "https://github.com/GusCaplan/retrocord#readme",
"nexe": {
"input": "./src/index.js",
"output": "./build/retrocord^$",
"temp": "tmp",
"browserify": {
"requires": [],
"excludes": [],
"paths": []
},
"runtime": {
"framework": "node",
"version": "latest",
"js-flags": "--use_strict",
"ignoreFlags": true
}
"bin": "./src/index.js",
"pkg": {
"scripts": "./src/**/*.js",
"assets": "./assets/*"
}
}

@@ -10,3 +10,3 @@ [![npm](https://img.shields.io/npm/v/retrocord.svg?maxAge=3600)](https://www.npmjs.com/package/retrocord)

`npm i -g retrocord`
`npm i -g retrocord` OR [download a release](/releases)

@@ -17,6 +17,8 @@ ![](https://s.gus.host/retrocord.png)

__/search__ - master discord's new search endpoint before they do!
__search__ - search a channel!
__/shrug__ - just like the command in the official client, but cooler because it's in monospace!
__shrug__ - just like the command in the official client, but cooler because it's in monospace!
__/game__ - set the game you are playing!
__game__ - set the game you are playing!
__nick__ - set your nickname!

@@ -1,189 +0,71 @@

#!/usr/bin/env node
const logo = `______ _____ ___________ _____ _____ _________________
| ___ \\ ___|_ _| ___ \\ _ / __ \\ _ | ___ \\ _ \\
| |_/ / |__ | | | |_/ / | | | / \\/ | | | |_/ / | | |
| /| __| | | | /| | | | | | | | | /| | | |
| |\\ \\| |___ | | | | \\ \\ \\_/ / \\__/\\ \\_/ / |\\ \\| |/ /
\\_| \\_\\____/ \\_/ \\_| \\_|\\___/ \\____/\\___/\\_| \\_|___/
The best in life
`;
const fs = require('fs');
const path = require('path');
const Discord = require('discord.js');
const vorpal = require('vorpal')();
const spinner = require('ora')('Loading...').start();
const center = require('./util/center');
const hexToRgb = require('./util/hexToRgb');
const chalk = vorpal.chalk;
const colors = require('ansi-256-colors');
const emoji = require('node-emoji');
const LocalStorage = require('node-localstorage').LocalStorage;
const getTermInfo = require('./util/getTermInfo');
const Storage = require('./Storage');
const gui = require('./gui');
const commands = require('./commands');
const assets = require('./assets');
const discord = require('./discord');
const lp = (v, n, c = '0') => String(v).length >= n ? `${v}` : (String(c).repeat(n) + v).slice(-n);
const ctx = {
gui, assets,
discord: discord.client,
allowInput: false,
current: {
scope: null,
channel: null,
},
};
const timestamp = vorpal.timestamp = (d = new Date(), mdy = false) =>
`${mdy ? `${lp(d.getFullYear().toString(), 2)}-${lp((d.getMonth() + 1).toString(), 2)}-${lp(d.getDate().toString(), 2)} ` : ''}
${lp(d.getHours().toString(), 2)}:
${lp(d.getMinutes().toString(), 2)}:
${lp(d.getSeconds().toString(), 2)}
`.replace(/\n/g, '');
const logMessage = vorpal.logMessage = (message) => {
let name = message.author.username;
let color = (...x) => colors.fg.getRgb(5, 5, 5) + x.join(' ') + colors.reset;
let content = message.content;
for (const mention of message.mentions.users.values()) {
if (mention.id === client.user.id) {
content = content.replace(new RegExp(`<@!?${mention.id}>`, 'g'), chalk.red.bold(`@${client.user.username}`));
process.stdout.write('\x07');
} else {
content = content.replace(new RegExp(`<@!?${mention.id}>`, 'g'), `@${mention.username}`);
gui.on('input', (message) => {
if (message.startsWith(':')) {
const [command, ...args] = message.slice(1).split(' ');
if (command in commands) commands[command].run(ctx, args);
} else {
if (!ctx.allowInput) return;
const args = message.split(' ');
for (const word in args) {
if (args[word].startsWith('@')) {
const [username, discrim] = args[word].split('#').map((x) => x.replace('@', '').toLowerCase());
let user = ctx.discord.users.find((u) => {
let match = false;
if (u.username.replace(/ /g, '').toLowerCase() === username) match = true;
if (discrim && u.discriminator !== discrim) match = false;
return match;
});
if (user) args[word] = user.toString();
}
}
}
message = args.join(' ');
if (message.member) {
color = (...x) => {
const role = message.member.roles.filter(r => r.color !== 0).last();
if (!role) return colors.fg.getRgb(5, 5, 5) + x.join(' ') + colors.reset;
const c = hexToRgb(role.hexColor);
return colors.fg.getRgb(c.r, c.g, c.b) + x.join(' ') + colors.reset;
};
}
for (const match of content.match(/:[^:]+:/g) || []) content = content.replace(match, emoji.get(match));
if (message.type !== 'DEFAULT') {
switch (message.type) {
case 'RECIPIENT_ADD':
break;
case 'RECIPIENT_REMOVE':
break;
case 'CALL':
break;
case 'CHANNEL_NAME_CHANGE':
break;
case 'CHANNEL_ICON_CHANGE':
break;
case 'PINS_ADD':
vorpal.log(`${chalk.yellow(timestamp(message.createdAt))} ${color(`${name}#${message.author.discriminator}`)} ${chalk.bold('pinned a message!')}`);
break;
default:
break;
const customEmojis = getEmojis();
for (const match of message.match(/:[^:]+:/g) || []) {
if (customEmojis) {
const found = customEmojis.find((x) => x.name.toLowerCase() === match.replace(/:/g, '').toLowerCase());
message = message.replace(match, found ? found.toString() : null || emoji.get(match));
if (!found) message = message.replace(match, emoji.get(match));
} else {
message = message.replace(match, emoji.get(match));
}
}
} else {
vorpal.log(`${chalk.yellow(timestamp(message.createdAt))} ${color(`${name}#${message.author.discriminator}`)} ${content}`);
}
if (message.author.id !== client.user.id) message.acknowledge();
};
const client = vorpal.discord = new Discord.Client();
const termInfo = getTermInfo();
const DELIMITER = termInfo.font.toLowerCase().includes('nerd') ? '' : '>';
function getOSStoragePath() {
switch (process.platform) {
case 'darwin':
return `${process.env.HOME}/Library/Application Support/retrocord`;
case 'win32':
return `${process.env.APPDATA}\\retrocord`;
case 'linux':
return `${process.env.HOME}/.retrocord`;
default:
return '.';
if (ctx.current.channel) ctx.current.channel.send(message);
}
}
});
const OS_STORAGE_PATH = getOSStoragePath();
gui.init();
gui.put(`{center}${assets.logo}{/center}`, { center: true });
if (!fs.existsSync(OS_STORAGE_PATH)) {
console.warn(`\nNew storage cache in \`${OS_STORAGE_PATH}\``);
fs.mkdirSync(OS_STORAGE_PATH);
if (Storage.has('token')) {
discord.run(ctx);
} else {
gui.put('{bold}Please Login!{/bold}', { center: true });
}
const LOCALSTORAGE_PATH = path.join(OS_STORAGE_PATH, 'cache');
if (!fs.existsSync(LOCALSTORAGE_PATH)) fs.mkdirSync(LOCALSTORAGE_PATH);
const localStorage = new LocalStorage(LOCALSTORAGE_PATH);
vorpal.current = {};
vorpal.find('help').remove();
vorpal.find('exit').remove();
require('./commands/help')(vorpal);
require('./commands/join')(vorpal);
require('./commands/nick')(vorpal);
require('./commands/search')(vorpal);
require('./commands/shrug')(vorpal);
require('./commands/catcher')(vorpal);
require('./commands/game')(vorpal);
vorpal.command('/exit', 'exit').action(() => {
vorpal.log('bye!');
process.exit(0);
});
vorpal.command('/login <token>')
.action((args, cb) => {
localStorage.setItem('token', args.token);
vorpal.log(chalk.bold('Token saved, use /logout to log out, or /exit to exit'));
client.login(args.token).then(() => cb()).catch(() => {
localStorage.removeItem('token');
vorpal.log(chalk.bold('INVALID TOKEN!'));
client.destroy();
process.exit();
});
});
vorpal.command('/logout')
.action((args, cb) => {
localStorage.removeItem('token');
client.destroy();
process.exit();
return cb();
});
client.on('message', message => {
if (message.channel.id !== vorpal.current.channel) return;
if (client.user.blocked.has(message.author.id)) return;
logMessage(message);
});
client.once('ready', () => {
spinner.stop();
if (client.user.bot) {
vorpal.log(chalk.yellow.bold('NO BOTS'));
localStorage.removeItem('token');
client.destroy();
process.exit();
function getEmojis() {
if (ctx.discord.user && ctx.discord.user.premium) {
return ctx.discord.emojis;
} else if (ctx.current.scope && ctx.current.scope !== 'dm') {
return ctx.current.scope.emojis;
} else {
return null;
}
console.log(center(logo));
console.log(center(`Connected as ${client.user.username}#${client.user.discriminator}`));
if (client.user.premium) console.log(center(' 🎉 with Discord Nitro! 🎉'));
console.log('\n');
vorpal.delimiter(DELIMITER).show();
});
vorpal.history('retrocord');
let token = localStorage.getItem('token');
if (!token) {
spinner.stop();
vorpal.delimiter(DELIMITER).show();
vorpal.log(chalk.bold('You are not logged in, please use the login command!'));
} else {
client.login(token).catch(() => {
localStorage.removeItem('token');
vorpal.log(chalk.bold('INVALID TOKEN!'));
client.destroy();
process.exit();
});
}
process.on('unhandledRejection', () => {}); // eslint-disable-line no-empty-function

@@ -1,18 +0,15 @@

const map = (number, inMin, inMax, outMin, outMax) => (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
const SHORTHAND_RE = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
module.exports = (hex) => {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
return r + r + g + g + b + b;
});
// Expand shorthand form (e.g. '03F') to full form (e.g. "0033FF")
hex = hex.replace(SHORTHAND_RE, (m, r, g, b) => r + r + g + g + b + b);
const mapRGB = (x) => Math.round(map(x, 0, 255, 0, 5));
const mapRGB = (x) => Math.round(x * 5 / 255);
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: mapRGB(parseInt(result[1], 16)),
g: mapRGB(parseInt(result[2], 16)),
b: mapRGB(parseInt(result[3], 16))
b: mapRGB(parseInt(result[3], 16)),
} : null;
}
};

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