lots of changes

This commit is contained in:
ry 2019-11-10 09:42:09 +01:00
parent 304d0ccb96
commit f7fd3b99a4
60 changed files with 3029 additions and 878 deletions

View file

@ -29,13 +29,14 @@
"module: '$5',",
"cooldown: $6,",
"guildOnly: $7,",
"developerOnly: $8",
"developerOnly: $8,",
"nsfw: $9",
"});",
"}",
"\n",
"async command(ctx) {",
"$9",
"}",
"$10",
"}",
"}"]
}
}

View file

@ -1,3 +1,5 @@
{
"editor.lineNumbers": "off"
"editor.lineNumbers": "on",
"editor.defaultFormatter": "remimarsal.prettier-now",
"editor.formatOnSave": true
}

View file

@ -0,0 +1,121 @@
@import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap");
.center {
position: absolute;
top: 40%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
body {
font-family: 'Montserrat', sans-serif;
background: #131313;
color: white;
}
ul {
list-style: none;
}
a {
text-decoration: none;
}
.title {
font-size: 6vh;
}
.subtitle {
font-size: 5vh;
padding: 1vh;
}
.Stats {
font-size: 3vh;
white-space: nowrap;
}
.rainbow {
text-align: center;
text-decoration: underline;
font-size: 32px;
font-family: monospace;
letter-spacing: 5px;
}
.rainbow_text_animated {
background: -webkit-gradient(linear, left top, right top, from(#6666ff), color-stop(#0099ff), color-stop(#00ff00), color-stop(#ff3399), to(#6666ff));
background: linear-gradient(to right, #6666ff, #0099ff, #00ff00, #ff3399, #6666ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-animation: rainbow_animation 6s ease-in-out infinite;
animation: rainbow_animation 6s ease-in-out infinite;
background-size: 400% 100%;
}
@-webkit-keyframes rainbow_animation {
0%,
100% {
background-position: 0 0;
}
50% {
background-position: 100% 0;
}
}
@keyframes rainbow_animation {
0%,
100% {
background-position: 0 0;
}
50% {
background-position: 100% 0;
}
}
.source,
.invite,
.support {
font-family: 'Montserrat', sans-serif;
background-color: #ffffff;
/* Green */
border: none;
/* border-radius: 1vh; */
padding: 1vh;
margin: 1vh;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 2vh;
font-weight: bold;
text-transform: uppercase;
}
.source a,
.invite a,
.support a {
color: black;
}
.icon {
display: inline-block;
vertical-align: left;
width: auto;
height: 10vh;
border-radius: 50%;
}
::-webkit-scrollbar {
display: none;
}
divide {
display: block;
height: 1px;
border: 0;
border-top: 0px solid rgba(204, 204, 204, 0);
margin: 1em 0;
padding: 1em;
}
/*# sourceMappingURL=main.css.map */

View file

@ -0,0 +1,9 @@
{
"version": 3,
"mappings": "AAkCA,OAAO,CAAC,sEAAI;AACZ,AAAA,OAAO,CAAC;EAlCP,QAAQ,EAAE,QAAQ;EAGjB,GAAG,EAAE,GAAG;EACR,IAAI,EAAE,GAAG;EACT,SAAS,EAAE,qBAAqB;CA+BjC;;AACD,AAAA,IAAI,CAAC;EACJ,WAAW,EAAE,wBAAwB;EACrC,UAAU,EAAE,OAAO;EACnB,KAAK,EAAE,KAAK;CACZ;;AACD,AAAA,EAAE,CAAC;EACF,UAAU,EAAE,IAAI;CAChB;;AACD,AAAA,CAAC,CAAC;EACD,eAAe,EAAE,IAAI;CACrB;;AAED,AAAA,MAAM,CAAC;EACN,SAAS,EAAE,GAAG;CACd;;AAED,AAAA,SAAS,CAAC;EACT,SAAS,EAAE,GAAG;EACd,OAAO,EAAE,GAAG;CACZ;;AAED,AAAA,MAAM,CAAC;EACN,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,MAAM;CACnB;;AAED,AAAA,QAAQ,CAAC;EACR,UAAU,EAAE,MAAM;EAClB,eAAe,EAAE,SAAS;EAC1B,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,SAAS;EACtB,cAAc,EAAE,GAAG;CACnB;;AACD,AAAA,sBAAsB,CAAC;EACtB,UAAU,EAAE,sEAAsE;EAClF,uBAAuB,EAAE,IAAI;EAC7B,eAAe,EAAE,IAAI;EACrB,KAAK,EAAE,WAAW;EAClB,SAAS,EAAE,yCAAyC;EACpD,eAAe,EAAE,SAAS;CAC1B;;AAED,UAAU,CAAV,iBAAU;EACT,EAAE;EACF,IAAI;IACH,mBAAmB,EAAE,GAAG;;EAGzB,GAAG;IACF,mBAAmB,EAAE,MAAM;;;;AAI7B,AAAA,OAAO;AACP,OAAO;AACP,QAAQ,CAAC;EA5ER,WAAW,EAAE,wBAAwB;EACrC,gBAAgB,EAAE,OAAO;EAAE,WAAW;EACtC,MAAM,EAAE,IAAI;EACZ,yBAAyB;EACzB,OAAO,EAAE,GAAG;EACZ,MAAM,EAAE,GAAG;EACX,UAAU,EAAE,MAAM;EAClB,eAAe,EAAE,IAAI;EACrB,OAAO,EAAE,YAAY;EACrB,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,IAAI;EACjB,cAAc,EAAE,SAAS;CAmEzB;;AAJD,AA9DC,OA8DM,CA9DN,CAAC;AA+DF,OAAO,CA/DN,CAAC;AAgEF,QAAQ,CAhEP,CAAC,CAAC;EACD,KAAK,EAAE,KAAY;CACnB;;AAiEF,AAAA,KAAK,CAAC;EACL,OAAO,EAAE,YAAY;EACrB,cAAc,EAAE,IAAI;EACpB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,aAAa,EAAE,GAAG;CAClB;;AAED,AAAA,mBAAmB,CAAC;EACnB,OAAO,EAAE,IAAI;CACb;;AAED,AAAA,MAAM,CAAC;EACN,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,GAAG;EACX,MAAM,EAAE,CAAC;EACT,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,sBAAsB;EAC5C,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,GAAG;CACZ",
"sources": [
"main.scss"
],
"names": [],
"file": "main.css"
}

View file

@ -0,0 +1,116 @@
@mixin centerer($horizontal: true, $vertical: true) {
position: absolute;
@if ($horizontal and $vertical) {
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
} @else if ($horizontal) {
left: 50%;
transform: translate(-50%, 0);
} @else if ($vertical) {
top: 50%;
transform: translate(0, -50%);
}
}
@mixin Buttons {
font-family: 'Montserrat', sans-serif;
background-color: #ffffff; /* Green */
border: none;
/* border-radius: 1vh; */
padding: 1vh;
margin: 1vh;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 2vh;
font-weight: bold;
text-transform: uppercase;
a {
color: rgb(0, 0, 0);
}
}
@import url('https://fonts.googleapis.com/css?family=Montserrat&display=swap');
.center {
@include centerer;
}
body {
font-family: 'Montserrat', sans-serif;
background: #131313;
color: white;
}
ul {
list-style: none;
}
a {
text-decoration: none;
}
.title {
font-size: 6vh;
}
.subtitle {
font-size: 5vh;
padding: 1vh;
}
.Stats {
font-size: 3vh;
white-space: nowrap;
}
.rainbow {
text-align: center;
text-decoration: underline;
font-size: 32px;
font-family: monospace;
letter-spacing: 5px;
}
.rainbow_text_animated {
background: linear-gradient(to right, #6666ff, #0099ff, #00ff00, #ff3399, #6666ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: rainbow_animation 6s ease-in-out infinite;
background-size: 400% 100%;
}
@keyframes rainbow_animation {
0%,
100% {
background-position: 0 0;
}
50% {
background-position: 100% 0;
}
}
.source,
.invite,
.support {
@include Buttons();
}
.icon {
display: inline-block;
vertical-align: left;
width: auto;
height: 10vh;
border-radius: 50%;
}
::-webkit-scrollbar {
display: none;
}
divide {
display: block;
height: 1px;
border: 0;
border-top: 0px solid rgba(204, 204, 204, 0);
margin: 1em 0;
padding: 1em;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 KiB

97
Dashboard/server.js Executable file
View file

@ -0,0 +1,97 @@
const express = require('express');
const { hostname, port, authorization, source, invite, type } = require('../config');
const db = require('quick.db');
const Backend = new db.table('backend');
const chalk = require('chalk');
const helmet = require('helmet');
const compression = require('compression');
const cors = require('cors');
const morgan = require('morgan');
var hbs = require('express-handlebars');
const app = express();
app.set('view engine', 'hbs');
app.engine(
'hbs',
hbs({
extname: 'hbs',
defaultView: 'default'
})
);
app.set('json spaces', 4);
app.use('/assets', express.static(__dirname + '/assets'));
app.set('view options', {
layout: false
});
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(helmet());
app.use(compression());
app.use(cors());
// Logging
app.use(
morgan((tokens, req, res) => {
return [
chalk.hex('#34ace0').bold(tokens.method(req, res)),
chalk.hex('#ffb142').bold(tokens.status(req, res)),
chalk.hex('#ff5252').bold(req.hostname + tokens.url(req, res)),
chalk.hex('#2ed573').bold(tokens['response-time'](req, res) + 'ms'),
chalk.hex('#f78fb3').bold('@ ' + tokens.date(req, res))
].join(' ');
})
);
let support = 'https://discord.gg/' + Backend.get('Info.invite');
module.exports = (client) => {
app.get('/', async (req, res) => {
res.status(200).render('index', {
layout: 'main',
title: 'Thaldrin',
subtitle: 'A Random Image and Utility Bot',
bot: {
users: client.users.size,
guilds: client.guilds.size,
channels: client.channels.size,
commands: client.commands.size,
invite: `https://${req.hostname}${type.beta ? ':8080' : ''}/invite`,
source: `https://${req.hostname}${type.beta ? ':8080' : ''}/source`,
support: `https://${req.hostname}${type.beta ? ':8080' : ''}/discord`
}
});
});
app.get('/discord', async (req, res) => {
res.redirect(support);
});
app.get('/source', async (req, res) => {
res.redirect(source);
});
app.get('/invite', async (req, res) => {
res.redirect(invite);
});
/* app.get('/this', async (req, res) => {
res.json(client);
}); */
/* app.post('/vote', async (req, res) => {
const body = req.body;
const auth = req.header('Authorization');
if (auth != authorization) return res.status(403), console.warn(`Vote rejected with authorization '${auth}'`);
// if (body.bot != client.user.id) return res.status(403), console.warn(`Vote rejected with ID '${body.bot}'`);
if (body.type == 'test') {
console.log(`Test succeeded, is weekend:`, body.isWeekend);
} else {
console.log(`Vote`)
client.vote(body.user);
}
}); */
app.listen(port, hostname, () => {
setTimeout(() => {
console.log(`Listening on ${hostname}:${port}`);
}, 1000 * 3);
});
};

View file

@ -1,92 +1,83 @@
const { Collection } = require("discord.js");
const { ShortLinks, SourceFynnder } = require("../utils");
let ShortLinksEnabled = true;
let SourceFynnderEnabled = true;
const { table } = require("quick.db");
const Servers = new table("servers");
const Users = new table("users");
const Backend = new table("backend");
const { Collection } = require('discord.js');
const { table } = require('quick.db');
const Servers = new table('servers');
const Users = new table('users');
const Backend = new table('backend');
module.exports = {
name: "message",
run: async (client, msg) => {
const prefix = client.config.prefixes.find(p =>
msg.content.toLowerCase().startsWith(p)
);
name: 'message',
run: async (client, msg) => {
//if (msg.author.id !== '318044130796109825') return;
if (msg.author.bot) return;
const DefaultPrefix = client.config.prefixes;
const CustomPrefix = Servers.get(msg.guild.id);
if (!CustomPrefix) {
PrefixArray = [ DefaultPrefix /* , CustomPrefix */ ].flat(Infinity);
} else {
PrefixArray = [ DefaultPrefix, CustomPrefix.prefix ].flat(Infinity);
}
let PREFIX;
let EXISTS;
for (p in PrefixArray) {
if (msg.content.startsWith(PrefixArray[p])) {
EXISTS = true;
PREFIX = p;
}
}
if (!EXISTS) return;
const args = msg.content.slice(PrefixArray[PREFIX].length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.find((c) => c.name == command || (c.aliases && c.aliases.includes(command)));
if (msg.author.bot) return;
if (msg.author.id !== "318044130796109825") return;
let Server = Servers.get(msg.guild.id);
let enabled;
if (Server === null) {
enabled = require("../utils").db.defaults.server;
} else {
enabled = Server;
}
const ctx = {
send: msg.channel.send.bind(msg.channel),
client,
msg,
args,
command: cmd,
me: msg.guild.me,
guild: msg.guild,
channel: msg.channel,
author: msg.author,
member: msg.member,
db: { users: Users, servers: Servers, backend: Backend },
utils: require('../utils'),
config: require('../config'),
isDeveloper: client.config.developers.find((dev) => msg.author.id == dev.id)
};
if (!cmd) return;
ShortLinks(enabled.Shortlinks, msg);
if (!prefix) return;
const args = msg.content.slice(prefix.length).split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.find(
c => c.name == command || (c.aliases && c.aliases.includes(command))
);
if (!client.cooldowns.has(cmd.name)) {
client.cooldowns.set(cmd.name, new Collection());
}
const ctx = {
send: msg.channel.send.bind(msg.channel),
client,
msg,
args,
command: cmd,
me: msg.guild.me,
guild: msg.guild,
channel: msg.channel,
author: msg.author,
member: msg.member,
db: { users: Users, servers: Servers, backend: Backend },
utils: require("../utils"),
isDeveloper: client.config.developers.find(id => msg.author.id == id)
};
if (!cmd) return;
if (cmd.guildOnly && !msg.guild) return;
if (cmd.nsfw && !ctx.channel.nsfw)
return ctx.send('This channel is not marked as NSFW, please mark it as such and rerun this command.');
if (cmd.developerOnly && !client.config.developers.find((dev) => msg.author.id == dev.id)) return;
if (cmd.AuthorPermissions !== 'NONE' && !ctx.member.permissions.has(cmd.AuthorPermissions))
return ctx.send(`You need \`${cmd.AuthorPermissions}\` Permission(s) to run this Command`);
const now = Date.now();
const timestamps = client.cooldowns.get(cmd.name);
const cooldownAmount = (cmd.cooldown || 1) * 1000;
if (!client.cooldowns.has(cmd.name)) {
client.cooldowns.set(cmd.name, new Collection());
}
if (timestamps.has(msg.author.id)) {
const expirationTime = timestamps.get(msg.author.id) + cooldownAmount;
if (cmd.guildOnly && !msg.guild) return;
if (
cmd.developerOnly &&
!client.config.developers.find(devs => msg.author.id == devs.id)
)
return;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return ctx.send(
`\`${cmd.name}\` has a cooldown of \`${cmd.cooldown} second${cmd.cooldown > 1
? 's'
: ''}\`, wait \`${`${Math.round(timeLeft)} second${Math.round(timeLeft) > 1
? 's'
: ''}`.replace('0 second', 'just a second longer')}\` before trying to use it again.`
);
}
} else {
timestamps.set(msg.author.id, now);
setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount);
const now = Date.now();
const timestamps = client.cooldowns.get(cmd.name);
const cooldownAmount = (cmd.cooldown || 1) * 1000;
if (timestamps.has(msg.author.id)) {
const expirationTime = timestamps.get(msg.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return ctx.send(
`\`${cmd.name}\` has a cooldown of \`${cmd.cooldown} second${
cmd.cooldown > 1 ? "s" : ""
}\`, wait \`${`${Math.round(timeLeft)} second${
Math.round(timeLeft) > 1 ? "s" : ""
}`.replace(
"0 second",
"just a second longer"
)}\` before trying to use it again.`
);
}
} else {
timestamps.set(msg.author.id, now);
setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount);
cmd
.command(ctx)
.then(() => {})
.catch(console.error);
}
}
cmd.command(ctx).then(() => {}).catch(console.error);
}
}
};

View file

@ -1,36 +1,39 @@
const p = require('phin').defaults({
method: 'POST',
parse: 'json'
method: 'POST',
parse: 'json'
});
const hastebin = require('hastebin-gen');
module.exports = {
name: 'messageReactionAdd',
run: async (client, reaction, user) => {
if (user.bot) return;
if (!client.config.developers.find(id => id == user.id)) return;
name: 'messageReactionAdd',
run: async (client, reaction, user) => {
if (user.bot) return;
if (user.id !== '318044130796109825') return;
if (reaction.emoji.name == '📥') {
let haste;
try {
if (!client.lastEval) {
await reaction.message.edit(`\`Unable to upload uncached eval results\``);
await reaction.message.reactions.removeAll();
} else {
hastebin(`${client.lastEval || `Last eval resuts weren't cached`}`, { extension: 'js' })
.then(async (h) => {
await reaction.message.edit(`<${h}>`);
await reaction.message.reactions.removeAll();
})
.catch((error) => {
// Handle error
console.error(error);
});
}
} catch (err) {
console.error(err);
}
}
if (reaction.emoji.name == '📥') {
try {
if (!client.cache.lastEval) {
await reaction.message.edit(`\`Unable to upload uncached eval results\``);
await reaction.message.reactions.removeAll();
} else {
const { body } = await p({
url: `https://hasteb.in/documents`,
data: `${client.cache.lastEval || `Last eval resuts weren't cached`}`
});
await reaction.message.edit(`<https://hasteb.in/${body.key}>`);
await reaction.message.reactions.removeAll();
}
} catch(err) {}
}
if (reaction.emoji.name == '🗑') {
try {
await reaction.message.delete();
} catch(err) {}
}
}
}
if (reaction.emoji.name == '🗑') {
try {
await reaction.message.delete();
} catch (err) {}
}
}
};

View file

@ -1,9 +1,9 @@
const { log } = require("../utils/index");
const { log } = require('../utils/index');
module.exports = {
name: "ready",
run: async client => {
log.hasStarted();
client.user.setActivity(`@${client.user.username} help to get started`);
}
name: 'ready',
run: async (client) => {
log.hasStarted();
client.user.setActivity(`nyeh`, { type: 2 });
}
};

View file

@ -1,90 +1,80 @@
const Command = require("../../src/structures/Command");
const { table } = require("quick.db");
const Servers = new table("servers");
const Users = new table("users");
const Command = require('../../src/structures/Command');
const { table } = require('quick.db');
const Servers = new table('servers');
const Users = new table('users');
const Bot = new table('bot');
const clean = text => {
if (typeof text == "string")
return text
.replace(/`/g, "`" + String.fromCharCode(8203))
.replace(/@/g, "@" + String.fromCharCode(8203));
else return text;
const clean = (text) => {
if (typeof text == 'string')
return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203));
else return text;
};
module.exports = class Eval extends Command {
constructor() {
super({
name: "eval",
description: "Run JavaScript code directly from the process.",
aliases: ["ev", "e"],
module: "Developers",
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
constructor() {
super({
name: 'eval',
description: 'Run JavaScript code directly from the process.',
aliases: [ 'ev', 'e' ],
module: 'Developers',
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
async command(ctx) {
if (!ctx.args.length) return;
async command(ctx) {
if (!ctx.args.length) return;
const client = ctx.client;
const client = ctx.client;
let code = ctx.args.join(" ");
let silent = false;
let code = ctx.args.join(' ');
let silent = false;
if (code.endsWith("-s")) (code = code.split("-s")[0]), (silent = true);
if (code.endsWith("--silent"))
(code = code.split("--silent")[0]), (silent = true);
if (code.endsWith('-s')) (code = code.split('-s')[0]), (silent = true);
if (code.endsWith('--silent')) (code = code.split('--silent')[0]), (silent = true);
try {
let evaled = await eval(code);
try {
let evaled = await eval(code);
if (typeof evaled != "string") evaled = require("util").inspect(evaled);
if (typeof evaled != 'string')
evaled = require('util').inspect(evaled, false, await ctx.db.backend.get('eval'));
evaled.replace(
new RegExp(client.token.replace(/\./g, "\\.", "g")),
"uwu"
);
evaled.replace(new RegExp(client.token.replace(/\./g, '\\.', 'g')), 'uwu');
if (!silent) {
ctx
.send(`\`\`\`js\n${clean(evaled)}\n\`\`\``)
.then(async m => {
await m.react("📥");
await m.react("🗑");
})
.catch(err => {
ctx
.send(
`\`Content is over 2,000 characters: react to upload to Hastebin\``
)
.then(async m => {
client.lastEval = clean(evaled);
if (!silent) {
ctx
.send(`\`\`\`js\n${clean(evaled)}\n\`\`\``)
.then(async (m) => {
await m.react('📥');
await m.react('🗑');
})
.catch((err) => {
ctx
.send(`\`Content is over 2,000 characters: react to upload to Hastebin\``)
.then(async (m) => {
client.lastEval = clean(evaled);
await m.react("📥");
await m.react("🗑");
});
});
}
} catch (error) {
ctx
.send(`\`\`\`js\n${clean(error)}\n\`\`\``)
.then(async m => {
await m.react("📥");
await m.react("🗑");
})
.catch(err => {
ctx
.send(
`\`Content is over 2,000 characters: react to upload to Hastebin\``
)
.then(async m => {
client.lastEval = clean(error);
await m.react('📥');
await m.react('🗑');
});
});
}
} catch (error) {
ctx
.send(`\`\`\`js\n${clean(error)}\n\`\`\``)
.then(async (m) => {
await m.react('📥');
await m.react('🗑');
})
.catch((err) => {
ctx.send(`\`Content is over 2,000 characters: react to upload to Hastebin\``).then(async (m) => {
client.lastEval = clean(error);
await m.react("📥");
await m.react("🗑");
});
});
}
}
await m.react('📥');
await m.react('🗑');
});
});
}
}
};

View file

@ -1,39 +1,38 @@
const Command = require('../../src/structures/Command');
module.exports = class Reload extends Command {
constructor() {
super({
name: 'reload',
description: 'Reload a command without restarting the process.',
aliases: ['re'],
module: 'Developers',
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
constructor() {
super({
name: 'reload',
description: 'Reload a command without restarting the process.',
aliases: [ 're' ],
module: 'Developers',
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
async command(ctx) {
if (!ctx.args.length) return;
const date = Date.now();
async command(ctx) {
if (!ctx.args.length) return;
const date = Date.now();
const data = ctx.args[0];
const [module,command] = data.split('/');
const data = ctx.args[0];
const [ module, command ] = data.split('/');
if (!module || !command) return;
if (!module || !command) return;
try {
delete require.cache[require.resolve(`../${module}/${command}`)];
delete ctx.client.commands.get(command);
try {
delete require.cache[require.resolve(`../${module}/${command}`)];
delete ctx.client.commands.get(command);
const cmd = require(`../${module}/${command}`);
const Command = new cmd();
ctx.client.commands.set(Command.name, Command);
const cmd = require(`../${module}/${command}`);
const Command = new cmd();
ctx.client.commands.set(Command.name, Command);
console.log(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`)
return ctx.send(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`);
} catch(err) {
return ctx.send(`Failed to reload the command.\n\`${err}\``);
}
}
}
return ctx.send(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`);
} catch (err) {
return ctx.send(`Failed to reload the command.\n\`${err}\``);
}
}
};

View file

@ -1,21 +0,0 @@
const Command = require("../../src/structures/Command");
module.exports = class Setup extends Command {
constructor() {
super({
name: "setup",
description: "x",
aliases: ["s"],
module: "Developers",
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
async command(ctx) {
let x = await ctx.utils.db.prefix
.remove(ctx)
.catch(err => console.error(err));
//' console.log(x);
}
};

View file

@ -1,18 +1,19 @@
const Command = require("../../src/structures/Command");
const Command = require('../../src/structures/Command');
module.exports = class Stop extends Command {
constructor() {
super({
name: "stop",
description: "Stops the bot",
aliases: [],
module: "Developers",
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
constructor() {
super({
name: 'stop',
description: 'Stops the bot',
aliases: [],
module: 'Developers',
cooldown: 0,
guildOnly: false,
developerOnly: true
});
}
async command(ctx) {
process.exit();
}
async command(ctx) {
await ctx.send('Restarting.');
process.exit();
}
};

View file

@ -1,104 +1,126 @@
const Command = require("../../src/structures/Command");
const { MessageEmbed } = require("discord.js");
const Command = require('../../src/structures/Command');
const { MessageEmbed } = require('discord.js');
module.exports = class Help extends Command {
constructor() {
super({
name: "help",
description:
"View a list of available commands, or view information on a specific command.",
aliases: ["h"],
module: "General",
cooldown: 0,
guildOnly: false,
developerOnly: false
});
}
constructor() {
super({
name: 'help',
description: 'View a list of available commands or information on a specific command.',
aliases: [ 'h' ],
module: 'General',
cooldown: 0,
guildOnly: false,
developerOnly: false
});
}
async command(ctx) {
if (!ctx.args.length) {
const commands = [
[
"General",
ctx.client.commands
.filter(command => command.module == "General")
.map(command => `**${command.name}** - ${command.description}`)
.join("\n")
]
];
async command(ctx) {
if (!ctx.args.length) {
const commands = [
[
'General',
ctx.client.commands
.filter((command) => command.module == 'General')
.map((command) => `${command.name}`)
.join(' | ')
],
/* [
'Images',
ctx.client.commands
.filter((command) => command.module == 'Images')
.map((command) => `${command.name}`)
.join(' | ')
], */
[
'Images',
ctx.client.commands
.filter((command) => command.module == 'Images')
.map((command) => `${command.name}`)
.join(' | ')
],
[
'Roleplay',
ctx.client.commands
.filter((command) => command.module == 'Roleplay')
.map((command) => `${command.name}`)
.join(' | ')
],
[
'Settings',
ctx.client.commands
.filter((command) => command.module == 'Settings')
.map((command) => `${command.name}`)
.join(' | ')
]
];
if (ctx.isDeveloper)
commands.push([
"Developers",
ctx.client.commands
.filter(command => command.module == "Developers")
.map(command => command.name)
.join(", ")
]);
if (ctx.isDeveloper)
commands.push([
'Developers',
ctx.client.commands
.filter((command) => command.module == 'Developers')
.map((command) => `${command.name}`)
.join(' | ')
]);
return ctx.send({
embed: {
fields: commands.map(group => {
return new Object({
name: group[0],
value: group[1]
});
}),
color: 0xff873f
}
});
} else {
const command = ctx.client.commands.find(
c =>
c.name == ctx.args[0].toLowerCase() ||
(c.aliases && c.aliases.includes(ctx.args[0].toLowerCase()))
);
return ctx.send({
embed: {
description: `Use \`'help command\` to get help on a specific command`,
fields: commands.map((group) => {
return new Object({
name: group[0],
value: group[1]
});
}),
color: 0xff873f
}
});
} else {
const command = ctx.client.commands.find(
(c) =>
c.name == ctx.args[0].toLowerCase() || (c.aliases && c.aliases.includes(ctx.args[0].toLowerCase()))
);
let fields = [
{
name: "Module",
value: command.module,
inline: true
},
{
name: "Aliases",
value:
command.aliases.length == 0
? "No aliases"
: command.aliases.join(", "),
inline: true
},
{
name: "Cooldown",
value: command.cooldown == 0 ? "No cooldown" : `${command.cooldown}s`,
inline: true
},
{
name: "Server only?",
value: command.guildOnly ? "Yes" : "No",
inline: true
},
{
name: "Developers only?",
value: command.developerOnly ? "Yes" : "No",
inline: true
}
];
let fields = [
{
name: 'Module',
value: command.module,
inline: true
},
{
name: 'Aliases',
value: command.aliases.length == 0 ? 'No aliases' : command.aliases.join(', '),
inline: true
},
{
name: 'Cooldown',
value: command.cooldown == 0 ? 'No cooldown' : `${command.cooldown}s`,
inline: true
},
{
name: 'Server only?',
value: command.guildOnly ? 'Yes' : 'No',
inline: true
},
{
name: 'Developers only?',
value: command.developerOnly ? 'Yes' : 'No',
inline: true
}
];
if (!command)
return ctx.send(
`That command couldn't be found. See the \`help\` command for valid commands.`
);
if (!command)
return ctx.send(`That command couldn't be found. See the \`help\` command for valid commands.`);
let embed = new MessageEmbed()
.setTitle(command.name)
.setDescription(command.description)
.setColor(0xff873f);
fields.forEach(i => {
embed.addField(i.name, i.value, i.inline);
});
let embed = new MessageEmbed()
.setTitle(command.name)
.setDescription(command.description)
.setColor(0xff873f);
fields.forEach((i) => {
embed.addField(i.name, i.value, i.inline);
});
return ctx.send(embed);
}
}
return ctx.send(embed);
}
}
};

View file

@ -1,42 +1,53 @@
const Command = require("../../src/structures/Command");
const { MessageEmbed } = require("discord.js");
const { developers, contributors, source } = require("../../config");
const { version: DiscordVersion } = require("discord.js");
const Command = require('../../src/structures/Command');
const { MessageEmbed, version: DiscordVersion } = require('discord.js');
const { developers, contributors, source, color } = require('../../config');
const db = require('quick.db');
const Backend = new db.table('backend');
module.exports = class Info extends Command {
constructor() {
super({
name: "info",
description: "Show the Makers and Contributors of the Bot",
aliases: ["about"],
module: "General",
cooldown: 0,
guildOnly: false,
developerOnly: false
});
}
constructor() {
super({
name: 'info',
description: 'Show the Makers and Contributors of the Bot',
aliases: [ 'about' ],
module: 'General',
cooldown: 0,
guildOnly: false,
developerOnly: false
});
}
async command(ctx) {
let result;
const contribs = [];
for (const { id, nick, reason } of contributors) {
const user = await ctx.client.users.fetch(id);
contribs.push(`${user} (${nick}) - ${reason}`);
}
const Contributors = contribs.join("\n");
let CreditEmbed = new MessageEmbed()
.setTitle(`Thaldrin, a Random Image and Utility Bot`)
.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("Node", `${process.version}`, true)
.addField("Contributors", Contributors)
.addField("Source", `[gitdab.com/r/thaldrin](${source})`);
async command(ctx) {
let result;
const contribs = [];
for (const { id, nick, reason } of contributors) {
const user = await ctx.client.users.fetch(id);
contribs.push(`${user} (${nick}) - ${reason}`);
}
const Contributors = contribs.join('\n');
let CreditEmbed = new MessageEmbed()
.setTitle(`${ctx.client.user.username}, a Random Image and Utility Bot`)
.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('Node', `${process.version}`, true)
.addField('Servers', ctx.client.guilds.size, true)
.addField('Users', ctx.client.users.size, true) */
.addField('Contributors', Contributors)
.addField('Source', `[gd/r/thaldrin](${source})`, true)
.addField(
'Support Server',
`[${ctx.client.guilds.get('438316852347666432').name}](https://discord.gg/${ctx.db.backend.get(
'Info.invite'
)})`,
true
)
.addField('Website', `[thaldr.in](https://thaldr.in)`, true);
ctx.send(CreditEmbed);
}
ctx.send(CreditEmbed);
}
};

View file

@ -0,0 +1,70 @@
const Command = require('../../src/structures/Command');
module.exports = class ServerInfo extends Command {
constructor() {
super({
name: 'serverinfo',
description: 'Shows Information about your Server!',
aliases: [ 'server', 'sinfo', 'si' ],
module: 'General',
cooldown: 0,
guildOnly: true,
developerOnly: false
});
}
async command(ctx) {
const total = ctx.guild.members.size;
const users = ctx.guild.members.filter((m) => !m.user.bot).size;
const bots = ctx.guild.members.filter((m) => m.user.bot).size;
const Features = ctx.guild.features;
let OnlineUsers =
ctx.utils.emotes.MemberStatus['online'] +
ctx.guild.members.filter((m) => m.presence.status === 'online').size;
let DNDUsers =
ctx.utils.emotes.MemberStatus['dnd'] + ctx.guild.members.filter((m) => m.presence.status === 'dnd').size;
let IdleUsers =
ctx.utils.emotes.MemberStatus['idle'] + ctx.guild.members.filter((m) => m.presence.status === 'idle').size;
let OfflineUsers =
ctx.utils.emotes.MemberStatus['offline'] +
ctx.guild.members.filter((m) => m.presence.status === 'offline').size;
let features = [];
Features.forEach((f) => features.push(ctx.utils.emotes.features[f.toLowerCase()] || f));
let Embed = new ctx.utils.discord.MessageEmbed();
Embed.setTitle(ctx.guild.name)
.setColor(ctx.config.color)
.setThumbnail(ctx.guild.iconURL())
.addField(
'Members',
`${ctx.utils.format.bold(`Total:`)} ${ctx.utils.format.code(total)}\n${ctx.utils.format.bold(
`Users:`
)} ${ctx.utils.format.code(users)}\n${ctx.utils.format.bold(`Bots:`)} ${ctx.utils.format.code(bots)}
${OnlineUsers}
${DNDUsers}
${IdleUsers}
${OfflineUsers}`
)
.addField('Owner', ctx.guild.owner, true)
.addField('Large?', ctx.guild.large ? ctx.utils.emotes.settings.on : ctx.utils.emotes.settings.off, true)
.addField(
'Boost Level / Boosters',
`${ctx.guild.premiumTier} / ${ctx.guild.premiumSubscriptionCount}`,
true
)
.addField('Region', ctx.utils.emotes.regions[ctx.guild.region] || ctx.guild.region, true)
.addField('Features', features.join(' **|** '));
if (ctx.guild.vanityURLCode) {
Embed.addField(
'Vanity URL',
`[discord.gg/${ctx.guild.vanityURLCode}](https://discord.gg/${ctx.guild.vanityURLCode})`
);
}
/* .addField('Large?')
.addField('Large?'); */
ctx.send(Embed);
}
};

View file

@ -0,0 +1,50 @@
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');
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);
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
});
}
async command(ctx) {
let SystemEmbed = new MessageEmbed()
.setTitle(`${ctx.client.user.username} | v${ctx.config.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);
}
};

View file

@ -0,0 +1,59 @@
const Command = require('../../src/structures/Command');
module.exports = class Userinfo extends Command {
constructor() {
super({
name: 'userinfo',
description: 'Shows User Information',
aliases: [ 'user', 'ui', 'uinfo' ],
module: 'General',
cooldown: 2,
guildOnly: true,
developerOnly: false,
nsfw: false
});
}
async command(ctx) {