This commit is contained in:
ry 2019-12-27 06:06:50 +01:00
parent 92c2231e26
commit 1052a0d809
5 changed files with 176 additions and 106 deletions

View file

@ -1,27 +1,27 @@
const Command = require('../../src/structures/Command'); const Command = require("../../src/structures/Command");
const { MessageEmbed, version: DiscordVersion } = require('discord.js'); const { MessageEmbed, version: DiscordVersion } = require("discord.js");
const os = require('os'); const { developers, contributors, source, color } = require("../../config");
const { developers, contributors, source, color } = require('../../config'); const os = require("os");
const db = require('quick.db'); const db = require("quick.db");
const Backend = new db.table('backend'); const Backend = new db.table("backend");
function format(seconds) { function format(seconds) {
function pad(s) { function pad(s) {
return (s < 10 ? '0' : '') + s; return (s < 10 ? "0" : "") + s;
} }
var hours = Math.floor(seconds / (60 * 60)); var hours = Math.floor(seconds / (60 * 60));
var minutes = Math.floor((seconds % (60 * 60)) / 60); var minutes = Math.floor((seconds % (60 * 60)) / 60);
var seconds = Math.floor(seconds % 60); var seconds = Math.floor(seconds % 60);
return pad(hours) + 'h ' + pad(minutes) + 'm ' + pad(seconds) + 's'; return pad(hours) + "h " + pad(minutes) + "m " + pad(seconds) + "s";
} }
module.exports = class Info extends Command { module.exports = class Info extends Command {
constructor() { constructor() {
super({ super({
name: 'system', name: "system",
description: 'Show System Info', description: "Show System Info",
aliases: [ 'sys', 'sysinfo' ], aliases: ["sys", "sysinfo"],
module: 'General', module: "General",
cooldown: 0, cooldown: 0,
guildOnly: false, guildOnly: false,
developerOnly: false developerOnly: false
@ -34,16 +34,20 @@ module.exports = class Info extends Command {
.setColor(color) .setColor(color)
.setDescription( .setDescription(
`Made by ${ctx.utils.format.bold( `Made by ${ctx.utils.format.bold(
ctx.client.users.find((user) => user.id === '318044130796109825').tag ctx.client.users.find(user => user.id === "318044130796109825").tag
)}` )}`
) )
.addField('Language', 'Javascript', true) .addField("Language", "Javascript", true)
.addField('Library', `d.js - v${DiscordVersion}`, true) .addField("Library", `d.js - v${DiscordVersion}`, true)
.addField('Uptime', `${format(process.uptime())}`, true) .addField("Uptime", `${format(process.uptime())}`, true)
.addField('Node', `${process.version}`, true) .addField("Node", `${process.version}`, true)
.addField('Servers', ctx.client.guilds.size, true) .addField("Servers", ctx.client.guilds.size, true)
.addField('Users', ctx.client.users.size, true) .addField("Users", ctx.client.users.size, true)
.addField('Total sauce found', ctx.db.backend.get('SourceFynnder.found'), true); .addField(
"Total sauce found",
ctx.db.backend.get("SourceFynnder.found"),
true
);
ctx.send(SystemEmbed); ctx.send(SystemEmbed);
} }

73
package-lock.json generated
View file

@ -111,11 +111,6 @@
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
"integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==" "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ=="
}, },
"async-limiter": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
},
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -212,14 +207,6 @@
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==" "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw=="
}, },
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"blapi": { "blapi": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/blapi/-/blapi-1.2.3.tgz", "resolved": "https://registry.npmjs.org/blapi/-/blapi-1.2.3.tgz",
@ -681,11 +668,17 @@
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^2.3.3", "form-data": "^2.3.3",
"node-fetch": "^2.3.0", "node-fetch": "^2.3.0",
"pako": "^1.0.8",
"prism-media": "^1.0.0", "prism-media": "^1.0.0",
"setimmediate": "^1.0.5", "setimmediate": "^1.0.5",
"tweetnacl": "^1.0.1", "tweetnacl": "^1.0.1",
"ws": "^6.1.3" "ws": "^7.2.0"
},
"dependencies": {
"ws": {
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz",
"integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A=="
}
} }
}, },
"dns-prefetch-control": { "dns-prefetch-control": {
@ -924,11 +917,6 @@
"resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.3.0.tgz", "resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.3.0.tgz",
"integrity": "sha512-ZtijOTFN7TzCujt1fnNhfWPFPSHeZkesff9AXZj+UEjYBynWNUIYpC87Ve4wHzyexQsImicLu7WsC2LHq7/xrQ==" "integrity": "sha512-ZtijOTFN7TzCujt1fnNhfWPFPSHeZkesff9AXZj+UEjYBynWNUIYpC87Ve4wHzyexQsImicLu7WsC2LHq7/xrQ=="
}, },
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
},
"fill-range": { "fill-range": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
@ -1593,9 +1581,9 @@
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ=="
}, },
"handlebars": { "handlebars": {
"version": "4.5.1", "version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==", "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
@ -2222,7 +2210,8 @@
"nan": { "nan": {
"version": "2.14.0", "version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
"optional": true
}, },
"nanomatch": { "nanomatch": {
"version": "1.2.13", "version": "1.2.13",
@ -2461,10 +2450,10 @@
"semver": "^5.1.0" "semver": "^5.1.0"
} }
}, },
"pako": { "parse-ms": {
"version": "1.0.10", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
"integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA=="
}, },
"parseurl": { "parseurl": {
"version": "1.3.3", "version": "1.3.3",
@ -2572,6 +2561,11 @@
"lodash.unset": "^4.5.2" "lodash.unset": "^4.5.2"
} }
}, },
"random-all": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/random-all/-/random-all-1.0.7.tgz",
"integrity": "sha512-2+Aur0b6UJrq0rSXlt1Mo1oZWmCJjPtHOV9n3jfn3zQQaZXBv48x21OwnpmcXoTBNqdGWz1PR+Uyla62uyviyg=="
},
"range-parser": { "range-parser": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
@ -3215,9 +3209,9 @@
} }
}, },
"uglify-js": { "uglify-js": {
"version": "3.6.8", "version": "3.7.2",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.8.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz",
"integrity": "sha512-XhHJ3S3ZyMwP8kY1Gkugqx3CJh2C3O0y8NPiSxtm1tyD/pktLAkFZsFGpuNfTZddKDQ/bbDBLAd2YyA1pbi8HQ==", "integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==",
"optional": true, "optional": true,
"requires": { "requires": {
"commander": "~2.20.3", "commander": "~2.20.3",
@ -3332,15 +3326,6 @@
"prepend-http": "^1.0.1" "prepend-http": "^1.0.1"
} }
}, },
"usage": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/usage/-/usage-0.7.1.tgz",
"integrity": "sha1-JfMQalGVUKukG/bnaFvJvVMzYv8=",
"requires": {
"bindings": "1.x.x",
"nan": "^2.0.9"
}
},
"use": { "use": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
@ -3405,14 +3390,6 @@
"signal-exit": "^3.0.2" "signal-exit": "^3.0.2"
} }
}, },
"ws": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
"requires": {
"async-limiter": "~1.0.0"
}
},
"x-xss-protection": { "x-xss-protection": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.3.0.tgz", "resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.3.0.tgz",

View file

@ -22,12 +22,13 @@
"node-dig-dns": "^0.2.10", "node-dig-dns": "^0.2.10",
"nodemon": "^1.19.4", "nodemon": "^1.19.4",
"ora": "^4.0.2", "ora": "^4.0.2",
"parse-ms": "^2.1.0",
"phin": "*", "phin": "*",
"quick.db": "^7.0.0-b22", "quick.db": "^7.0.0-b22",
"random-all": "^1.0.7",
"restler": "^3.4.0", "restler": "^3.4.0",
"shell-exec": "^1.0.2", "shell-exec": "^1.0.2",
"trello": "^0.9.1", "trello": "^0.9.1",
"usage": "^0.7.1",
"yiff": "^1.2.7" "yiff": "^1.2.7"
}, },
"scripts": { "scripts": {

View file

@ -1,4 +1,8 @@
const { Permissions: { FLAGS } } = require('discord.js'); const {
Permissions: {
FLAGS
}
} = require('discord.js');
module.exports = { module.exports = {
format: require('./src/format'), format: require('./src/format'),
status: require('./src/statuses'), status: require('./src/statuses'),
@ -9,7 +13,7 @@ module.exports = {
db: require('./src/database'), db: require('./src/database'),
log: require('./src/logs'), log: require('./src/logs'),
int: require('./src/interactions'), int: require('./src/interactions'),
//eco: require('./src/economy'), eco: require('./src/economy'),
discord: require('discord.js'), discord: require('discord.js'),
yiff: require('yiff'), yiff: require('yiff'),
perms: FLAGS perms: FLAGS

View file

@ -1,15 +1,99 @@
const { table } = require('quick.db'); const {
const Servers = new table('servers'); table
const Users = new table('users'); } = require("quick.db");
const Backend = new table('backend'); const ms = require("parse-ms");
let T = '-x-'; const random = require("random-all");
let Message = {};
const Users = new table("users");
const Backend = new table("backend");
let d;
let hasVoted = false; let hasVoted = false;
let NormalAmout = 5; let Placeholder = "318044130796109825";
async function CalculateFromMessage(ctx) { module.exports = {
Message.content = ctx.msg.content; CalculateFromMessage: async function (Message) {
Message.length = ctx.msg.content.length; let hasVoted = await Users.get(`${Message.author.id}.voted`);
content = Message.content;
length = Message.content.length;
if (hasVoted) d = 1;
else d = 0.01;
e = (length * d).toFixed(1);
return await Users.add(`${Message.author.id}.money.bank`, e);
},
Dailies: async function (User = Placeholder) {
let timeout = 86400000;
let amount = Math.floor(Math.random() * (200 - 150) + 150);
console.log(); let daily = await Users.get(`${User}.money.daily`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
throw new Error(`${time.hours}h ${time.minutes}m ${time.seconds}s`);
} else {
Users.add(`${User}.money.bank`, amount);
Users.set(`${User}.money.daily`, Date.now());
return {
success: true,
amount
};
} }
},
weekly: async function (User = Placeholder) {
let timeout = 604800000;
let amount = Math.floor(Math.random() * (500 - 300) + 300);
let weekly = await Users.get(`${User}.money.weekly`);
if (weekly !== null && timeout - (Date.now() - weekly) > 0) {
let time = ms(timeout - (Date.now() - weekly));
throw new Error(
`${time.days}d ${time.hours}h ${time.minutes}m ${time.seconds}s`
);
} else {
Users.add(`${User}.money.bank`, amount);
Users.set(`${User}.money.weekly`, Date.now());
return {
success: true,
amount
};
}
},
// Math.floor(Math.random() * (500 - 300) + 300);
quick: async function (kind, User = Placeholder) {
let way = {
work: {
payout: Math.floor(Math.random() * (500 - 300) + 300),
fine: Math.floor(Math.random() * (300 - 50) + 50),
probability: random.getBoolean(85)
},
slut: {
payout: Math.floor(Math.random() * (500 - 300) + 300),
fine: Math.floor(Math.random() * (300 - 50) + 50),
probability: random.getBoolean(60)
},
crime: {
payout: Math.floor(Math.random() * (500 - 300) + 300),
fine: Math.floor(Math.random() * (300 - 50) + 50),
probability: random.getBoolean(55)
}
};
if (way.hasOwnProperty(kind)) {
console.log(way[kind].probability);
if (way[kind].probability) {
Users.add(`${User}.money.cash`, way[kind].payout);
return {
money: way[kind].payout,
text: `You got ${way[kind].payout} from doing ${kind}`
}
} else {
Users.subtract(`${User}.money.cash`, way[kind].fine);
return {
money: way[kind].fine,
text: `You were fined **${way[kind].fine}** by **${kind}**`
}
}
}
}
};