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,50 +1,54 @@
const Command = require('../../src/structures/Command');
const { MessageEmbed, version: DiscordVersion } = require('discord.js');
const os = require('os');
const { developers, contributors, source, color } = require('../../config');
const db = require('quick.db');
const Backend = new db.table('backend');
const Command = require("../../src/structures/Command");
const { MessageEmbed, version: DiscordVersion } = require("discord.js");
const { developers, contributors, source, color } = require("../../config");
const os = require("os");
const db = require("quick.db");
const Backend = new db.table("backend");
function format(seconds) {
function pad(s) {
return (s < 10 ? '0' : '') + s;
}
var hours = Math.floor(seconds / (60 * 60));
var minutes = Math.floor((seconds % (60 * 60)) / 60);
var seconds = Math.floor(seconds % 60);
function pad(s) {
return (s < 10 ? "0" : "") + s;
}
var hours = Math.floor(seconds / (60 * 60));
var minutes = Math.floor((seconds % (60 * 60)) / 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 {
constructor() {
super({
name: 'system',
description: 'Show System Info',
aliases: [ 'sys', 'sysinfo' ],
module: 'General',
cooldown: 0,
guildOnly: false,
developerOnly: false
});
}
constructor() {
super({
name: "system",
description: "Show System Info",
aliases: ["sys", "sysinfo"],
module: "General",
cooldown: 0,
guildOnly: false,
developerOnly: false
});
}
async command(ctx) {
let SystemEmbed = new MessageEmbed()
.setTitle(`${ctx.client.user.username} | v${ctx.vars.version}`)
.setColor(color)
.setDescription(
`Made by ${ctx.utils.format.bold(
ctx.client.users.find((user) => user.id === '318044130796109825').tag
)}`
)
.addField('Language', 'Javascript', true)
.addField('Library', `d.js - v${DiscordVersion}`, true)
.addField('Uptime', `${format(process.uptime())}`, true)
.addField('Node', `${process.version}`, true)
.addField('Servers', ctx.client.guilds.size, true)
.addField('Users', ctx.client.users.size, true)
.addField('Total sauce found', ctx.db.backend.get('SourceFynnder.found'), true);
async command(ctx) {
let SystemEmbed = new MessageEmbed()
.setTitle(`${ctx.client.user.username} | v${ctx.vars.version}`)
.setColor(color)
.setDescription(
`Made by ${ctx.utils.format.bold(
ctx.client.users.find(user => user.id === "318044130796109825").tag
)}`
)
.addField("Language", "Javascript", true)
.addField("Library", `d.js - v${DiscordVersion}`, true)
.addField("Uptime", `${format(process.uptime())}`, true)
.addField("Node", `${process.version}`, true)
.addField("Servers", ctx.client.guilds.size, true)
.addField("Users", ctx.client.users.size, 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",
"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": {
"version": "0.4.0",
"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",
"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": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/blapi/-/blapi-1.2.3.tgz",
@ -681,11 +668,17 @@
"abort-controller": "^3.0.0",
"form-data": "^2.3.3",
"node-fetch": "^2.3.0",
"pako": "^1.0.8",
"prism-media": "^1.0.0",
"setimmediate": "^1.0.5",
"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": {
@ -924,11 +917,6 @@
"resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.3.0.tgz",
"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": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
@ -1593,9 +1581,9 @@
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ=="
},
"handlebars": {
"version": "4.5.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
"version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"requires": {
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
@ -2222,7 +2210,8 @@
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
"optional": true
},
"nanomatch": {
"version": "1.2.13",
@ -2461,10 +2450,10 @@
"semver": "^5.1.0"
}
},
"pako": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz",
"integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw=="
"parse-ms": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
"integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA=="
},
"parseurl": {
"version": "1.3.3",
@ -2572,6 +2561,11 @@
"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": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
@ -3215,9 +3209,9 @@
}
},
"uglify-js": {
"version": "3.6.8",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.8.tgz",
"integrity": "sha512-XhHJ3S3ZyMwP8kY1Gkugqx3CJh2C3O0y8NPiSxtm1tyD/pktLAkFZsFGpuNfTZddKDQ/bbDBLAd2YyA1pbi8HQ==",
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz",
"integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==",
"optional": true,
"requires": {
"commander": "~2.20.3",
@ -3332,15 +3326,6 @@
"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": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
@ -3405,14 +3390,6 @@
"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": {
"version": "1.3.0",
"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",
"nodemon": "^1.19.4",
"ora": "^4.0.2",
"parse-ms": "^2.1.0",
"phin": "*",
"quick.db": "^7.0.0-b22",
"random-all": "^1.0.7",
"restler": "^3.4.0",
"shell-exec": "^1.0.2",
"trello": "^0.9.1",
"usage": "^0.7.1",
"yiff": "^1.2.7"
},
"scripts": {

View file

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

View file

@ -1,15 +1,99 @@
const { table } = require('quick.db');
const Servers = new table('servers');
const Users = new table('users');
const Backend = new table('backend');
let T = '-x-';
let Message = {};
const {
table
} = require("quick.db");
const ms = require("parse-ms");
const random = require("random-all");
const Users = new table("users");
const Backend = new table("backend");
let d;
let hasVoted = false;
let NormalAmout = 5;
let Placeholder = "318044130796109825";
async function CalculateFromMessage(ctx) {
Message.content = ctx.msg.content;
Message.length = ctx.msg.content.length;
module.exports = {
CalculateFromMessage: async function (Message) {
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}**`
}
}
}
}
};