wow
This commit is contained in:
parent
26236cf8a5
commit
db9b3fda7e
12 changed files with 536 additions and 0 deletions
25
DiscordModules/dev/blacklist.js
Normal file
25
DiscordModules/dev/blacklist.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const Command = require('../../src/structures/Command');
|
||||
module.exports = class Blacklist extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'blacklist',
|
||||
description: 'Master the Blacklist',
|
||||
aliases: ['bl'],
|
||||
module: 'Developers',
|
||||
cooldown: 0,
|
||||
guildOnly: false,
|
||||
developerOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
console.log(ctx.args)
|
||||
let ACTION = ctx.args[0]
|
||||
let ID = ctx.args[1]
|
||||
let REASON = ctx.args.shift().shift().join(' ')
|
||||
// let REASON = ctx.args[2]
|
||||
|
||||
let X = await ctx.utils.db.blacklist(ID, ACTION, REASON)
|
||||
console.log(X)
|
||||
}
|
||||
};
|
45
DiscordModules/dev/dig.js
Normal file
45
DiscordModules/dev/dig.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const Command = require("../../src/structures/Command");
|
||||
const exec = require("shell-exec");
|
||||
const dig = require("node-dig-dns");
|
||||
const {
|
||||
MessageEmbed
|
||||
} = require("discord.js");
|
||||
let DomainReg = new RegExp(
|
||||
`(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]`
|
||||
);
|
||||
module.exports = class Dig extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: "dig",
|
||||
description: "dig website dns information stuff",
|
||||
aliases: [],
|
||||
module: "Developers",
|
||||
cooldown: 10,
|
||||
guildOnly: false,
|
||||
developerOnly: true,
|
||||
nsfw: false
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
let count = 0;
|
||||
let domain = ctx.args[0];
|
||||
let type = ctx.args[1];
|
||||
const DIG = new MessageEmbed().setTitle(`${domain} (${type})`);
|
||||
if (domain.match(DomainReg)) {
|
||||
try {
|
||||
let result = await dig([domain, type]);
|
||||
|
||||
result.answer.forEach(r => {
|
||||
count++;
|
||||
DIG.addField(`Answer ${count}`, r.value);
|
||||
});
|
||||
} catch (error) {
|
||||
DIG.setDescription(
|
||||
`Either the Domain you are trying to dig for doesn't exist or the record you are requesting does not exist.`
|
||||
);
|
||||
}
|
||||
}
|
||||
ctx.send(DIG);
|
||||
}
|
||||
};
|
80
DiscordModules/dev/eval.js
Executable file
80
DiscordModules/dev/eval.js
Executable file
|
@ -0,0 +1,80 @@
|
|||
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;
|
||||
};
|
||||
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
if (!ctx.args.length) return;
|
||||
|
||||
const client = ctx.client;
|
||||
|
||||
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);
|
||||
|
||||
try {
|
||||
let evaled = await eval(code);
|
||||
|
||||
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');
|
||||
|
||||
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('🗑');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
28
DiscordModules/dev/exec.js
Normal file
28
DiscordModules/dev/exec.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const Command = require('../../src/structures/Command');
|
||||
const exec = require('shell-exec');
|
||||
module.exports = class Exec extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'exec',
|
||||
description: 'Execute shell commands',
|
||||
aliases: [ 'ex' ],
|
||||
module: 'Developers',
|
||||
cooldown: 1,
|
||||
guildOnly: false,
|
||||
developerOnly: true,
|
||||
nsfw: false
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
const trying = await ctx.send('Attempting to execute ' + ctx.utils.format.bold(ctx.args.join(' ')));
|
||||
|
||||
await exec(ctx.args.join(' '))
|
||||
.then((r) => {
|
||||
trying.edit('```bash\n' + r.stdout + '```');
|
||||
})
|
||||
.catch((error) => {
|
||||
trying.edit('Failed to execute ' + ctx.utils.format.bold(ctx.args.join(' ')));
|
||||
});
|
||||
}
|
||||
};
|
38
DiscordModules/dev/reload.js
Executable file
38
DiscordModules/dev/reload.js
Executable file
|
@ -0,0 +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
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
if (!ctx.args.length) return;
|
||||
const date = Date.now();
|
||||
|
||||
const data = ctx.args[0];
|
||||
const [ module, command ] = data.split('/');
|
||||
|
||||
if (!module || !command) return;
|
||||
|
||||
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);
|
||||
|
||||
return ctx.send(`Reloaded \`${Command.name}\` in ${(Date.now() - date) / 1000}s.`);
|
||||
} catch (err) {
|
||||
return ctx.send(`Failed to reload the command.\n\`${err}\``);
|
||||
}
|
||||
}
|
||||
};
|
19
DiscordModules/dev/stop.js
Executable file
19
DiscordModules/dev/stop.js
Executable file
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
await ctx.send('Restarting.');
|
||||
process.exit();
|
||||
}
|
||||
};
|
34
DiscordModules/dev/update.js
Normal file
34
DiscordModules/dev/update.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const Command = require('../../src/structures/Command');
|
||||
const exec = require('shell-exec');
|
||||
module.exports = class Update extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'update',
|
||||
description: 'Execute shell commands',
|
||||
aliases: [ 'up', 'pull' ],
|
||||
module: 'Developers',
|
||||
cooldown: 1,
|
||||
guildOnly: false,
|
||||
developerOnly: true,
|
||||
nsfw: false
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
const trying = await ctx.send(
|
||||
`${ctx.utils.emotes.random.loading} Getting the latest updates from ${ctx.config.source.replace(
|
||||
'https://',
|
||||
''
|
||||
)} ${ctx.utils.emotes.random.loading}`
|
||||
);
|
||||
|
||||
await exec('git pull')
|
||||
.then((r) => {
|
||||
trying.edit('```fix\n' + r.stdout + '```');
|
||||
})
|
||||
.catch((error) => {
|
||||
trying.edit(`Failed to get the latest updates.`);
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
};
|
35
models/Server.js
Normal file
35
models/Server.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const mongoose = require("mongoose");
|
||||
|
||||
const ServerSchema = new mongoose.Schema({
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
sourcefynnder: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
shortlinks: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
embeds: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true
|
||||
},
|
||||
int: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true
|
||||
},
|
||||
prefix: {
|
||||
type: Array,
|
||||
required: false,
|
||||
default: ["'"]
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("server", ServerSchema);
|
31
models/User.js
Normal file
31
models/User.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
const mongoose = require("mongoose");
|
||||
|
||||
const User = new mongoose.Schema({
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
economy: {
|
||||
bank: Number,
|
||||
cash: Number
|
||||
},
|
||||
blacklist: {
|
||||
state: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
reason: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
date: {
|
||||
type: Date,
|
||||
required: false
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("user", User);
|
80
utils/src/Shortlinks.js
Executable file
80
utils/src/Shortlinks.js
Executable file
|
@ -0,0 +1,80 @@
|
|||
const ShortLinkReg = /(?:\s|^)(gh|gl|gd|owo|aud|sg|ttv|teknik|bb|yt|bc|bcu|sc|bot|sw|tw|npm|xkcd)\/([a-zA-Z0-9-_.#/!]*)/g;
|
||||
const ShortLinks = {
|
||||
gh: 'https://github.com/$link$',
|
||||
gl: 'https://gitlab.com/$link$',
|
||||
yt: 'https://youtu.be/$link$',
|
||||
tw: 'https://twitter.com/$link$',
|
||||
npm: 'https://npm.im/$link$',
|
||||
ttv: 'https://twitch.tv/$link$',
|
||||
gd: 'https://gitdab.com/$link$',
|
||||
owo: 'https://owo.codes/$link$',
|
||||
sg: 'https://git.supernets.org/$link$',
|
||||
teknik: 'https://git.teknik.io/$link$',
|
||||
bb: 'https://bitbucket.org/$link$',
|
||||
bc: 'https://$link$.bandcamp.com/',
|
||||
bcu: 'https://bandcamp.com/$link$',
|
||||
sc: 'https://soundcloud.com/$link$',
|
||||
aud: 'https://audius.co/$link$',
|
||||
// aur: 'https://aur.archlinux.org/packages/$link$',
|
||||
sw: 'https://steamcommunity.com/sharedfiles/filedetails/?id=$link$',
|
||||
bot: '<https://discordapp.com/oauth2/authorize?client_id=$link$&scope=bot>',
|
||||
xkcd: 'https://xkcd.com/$link$'
|
||||
};
|
||||
const ShortLinkDirs = {
|
||||
gh: 'Github',
|
||||
gl: 'Gitlab',
|
||||
gd: 'Gitdab',
|
||||
yt: 'Youtube',
|
||||
tw: 'Twitter',
|
||||
npm: 'NPM',
|
||||
ttv: 'TwitchTv',
|
||||
owo: 'owo_codes',
|
||||
sg: 'Supernets_Git',
|
||||
aud: 'Audius',
|
||||
teknik: 'Teknik_Git',
|
||||
bb: 'BitBucket',
|
||||
bc: 'Bandcamp_Band',
|
||||
bcu: 'Bandcamp_User',
|
||||
sc: 'Soundcloud',
|
||||
// aur: 'Arch_Packages',
|
||||
sw: 'Steam_Workshop',
|
||||
bot: 'Discord_Bot_Invite',
|
||||
xkcd: 'xkcd'
|
||||
};
|
||||
const db = require('quick.db');
|
||||
const backend = new db.table('backend');
|
||||
module.exports = async function Shortlink(enabled, msg) {
|
||||
if (!enabled || enabled === null || enabled === undefined) return;
|
||||
let res = msg.content.match(ShortLinkReg);
|
||||
if (!res) return;
|
||||
res = res.map((x) => (x.startsWith(' ') ? x.substring(1) : x));
|
||||
let links = [];
|
||||
let Amount = [];
|
||||
|
||||
for (const m in res) {
|
||||
for (const x in ShortLinks) {
|
||||
let url = res[m];
|
||||
if (!url.startsWith(x)) continue;
|
||||
url = url.replace(x + '/', '');
|
||||
|
||||
if (x == 'gh' || x == 'gl' || x == 'gd') {
|
||||
url = url.replace('#', '/issues/');
|
||||
}
|
||||
|
||||
if (x == 'gl') {
|
||||
url = url.replace('!', '/merge_requests/');
|
||||
} else if (x == 'gd') {
|
||||
url = url.replace('!', '/pulls/');
|
||||
} else if (x == 'gh') {
|
||||
url = url.replace('!', '/pull/');
|
||||
}
|
||||
|
||||
url = ShortLinks[x].replace('$link$', url);
|
||||
links.push(`${url}`);
|
||||
await backend.add(`Shortlink.${ShortLinkDirs[x]}`, 1);
|
||||
await backend.add(`Shortlink.total`, 1);
|
||||
}
|
||||
}
|
||||
|
||||
msg.channel.send(links.join('\n'));
|
||||
};
|
78
utils/src/SourceFynnder.js
Executable file
78
utils/src/SourceFynnder.js
Executable file
|
@ -0,0 +1,78 @@
|
|||
const axios = require('axios');
|
||||
const db = require('quick.db');
|
||||
const backend = new db.table('backend');
|
||||
const Servers = new db.table('servers');
|
||||
let md5 = new RegExp(
|
||||
'((?:!)?https?://static[0-9]*.(?:e621|e926).net/data/(?:sample/|preview/|)[0-9a-f]{2}/[0-9a-f]{2}/([0-9a-f]{32}).([0-9a-z]+))',
|
||||
'igm'
|
||||
);
|
||||
|
||||
let search_md5 = 'https://e621.net/post/show.json?md5=';
|
||||
let e6 = 'https://e621.net/post/show/';
|
||||
let e9 = 'https://e926.net/post/show/';
|
||||
|
||||
const version = '0.1.0';
|
||||
|
||||
async function SourceFynnderBot(enabled, msg) {
|
||||
if (!enabled || enabled === null || enabled === undefined) return;
|
||||
res = msg.content.match(md5);
|
||||
if (!res) return;
|
||||
|
||||
let Sources = [];
|
||||
for (const m in res) {
|
||||
let URL = res[m];
|
||||
let hash = URL.split(md5)[2];
|
||||
|
||||
let {
|
||||
data
|
||||
} = await axios.get(search_md5 + hash, {
|
||||
headers: {
|
||||
'user-agent': `SourceFynnder/${version} (ry / codepupper)`
|
||||
}
|
||||
});
|
||||
if (data.rating === 's') {
|
||||
Source = e9 + data.id;
|
||||
} else {
|
||||
Source = e6 + data.id;
|
||||
}
|
||||
Sources.push(`:link::mag: ${Source}`);
|
||||
}
|
||||
msg.channel.send(Sources);
|
||||
await backend.add('SourceFynnder.found', Sources.length);
|
||||
await backend.add('SourceFynnder.foundBot', Sources.length);
|
||||
await Servers.add(`${msg.guild.id}.foundSources`, Sources.length);
|
||||
};
|
||||
|
||||
async function SourceFynnderAPI(url) {
|
||||
url = url.toString().replace(/\,/g, ' ')
|
||||
res = url.match(md5);
|
||||
if (!res) throw new Error('Not a Valid e621/e926 URL');
|
||||
|
||||
let Sources = [];
|
||||
for (const m in res) {
|
||||
let URL = res[m];
|
||||
let hash = URL.split(md5)[2];
|
||||
|
||||
let {
|
||||
data
|
||||
} = await axios.get(search_md5 + hash, {
|
||||
headers: {
|
||||
'user-agent': `SourceFynnder/${version} (ry / codepupper)`
|
||||
}
|
||||
});
|
||||
if (data.rating === 's') {
|
||||
Source = e9 + data.id;
|
||||
} else {
|
||||
Source = e6 + data.id;
|
||||
}
|
||||
Sources.push(`${Source}`);
|
||||
}
|
||||
await backend.add('SourceFynnder.found', Sources.length);
|
||||
await backend.add('SourceFynnder.foundAPI', Sources.length);
|
||||
return Sources
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
SourceFynnder: SourceFynnderBot,
|
||||
APIFind: SourceFynnderAPI
|
||||
}
|
43
vars.js
Normal file
43
vars.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
module.exports = {
|
||||
name: 'Thaldrin',
|
||||
version: '3.6.4',
|
||||
color: '#ff995d',
|
||||
hostname: '127.2.11.1',
|
||||
//hostname: 'localhost',
|
||||
port: '8080',
|
||||
type: {
|
||||
beta: true,
|
||||
prod: false
|
||||
},
|
||||
prefixes: ["'", `<@434662676547764244> `, '<@!434662676547764244> '],
|
||||
developers: [{
|
||||
id: '318044130796109825',
|
||||
nick: 'ry'
|
||||
},
|
||||
{
|
||||
id: '251788826232619008',
|
||||
nick: 'feo'
|
||||
}
|
||||
],
|
||||
logs: {
|
||||
usage: '663740167684620318'
|
||||
},
|
||||
contributors: [{
|
||||
id: '150745989836308480',
|
||||
nick: 'Cyn',
|
||||
reason: 'Shortlink Code :3'
|
||||
},
|
||||
{
|
||||
id: '356323373443448843',
|
||||
nick: 'Twiggy',
|
||||
reason: 'Letting me use his Sona as the Mascot <3'
|
||||
},
|
||||
{
|
||||
id: '289947794142396427',
|
||||
nick: 'Fynn',
|
||||
reason: 'Letting me use his name for `SourceFynnder` <3'
|
||||
}
|
||||
],
|
||||
source: 'https://gitdab.com/r/thaldrin',
|
||||
invite: 'https://discordapp.com/oauth2/authorize?client_id=434662676547764244&scope=bot&permissions=379968'
|
||||
};
|
Loading…
Reference in a new issue