fuck node
This commit is contained in:
parent
9ad8081971
commit
304d0ccb96
49 changed files with 1305 additions and 403 deletions
90
DiscordModules/Developers/eval.js
Executable file
90
DiscordModules/Developers/eval.js
Executable file
|
@ -0,0 +1,90 @@
|
|||
const Command = require("../../src/structures/Command");
|
||||
const { table } = require("quick.db");
|
||||
const Servers = new table("servers");
|
||||
const Users = new table("users");
|
||||
|
||||
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);
|
||||
|
||||
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("🗑");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
39
DiscordModules/Developers/reload.js
Executable file
39
DiscordModules/Developers/reload.js
Executable file
|
@ -0,0 +1,39 @@
|
|||
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);
|
||||
|
||||
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}\``);
|
||||
}
|
||||
}
|
||||
}
|
21
DiscordModules/Developers/setup.js
Executable file
21
DiscordModules/Developers/setup.js
Executable file
|
@ -0,0 +1,21 @@
|
|||
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);
|
||||
}
|
||||
};
|
18
DiscordModules/Developers/stop.js
Executable file
18
DiscordModules/Developers/stop.js
Executable file
|
@ -0,0 +1,18 @@
|
|||
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) {
|
||||
process.exit();
|
||||
}
|
||||
};
|
104
DiscordModules/General/help.js
Executable file
104
DiscordModules/General/help.js
Executable file
|
@ -0,0 +1,104 @@
|
|||
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
|
||||
});
|
||||
}
|
||||
|
||||
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")
|
||||
]
|
||||
];
|
||||
|
||||
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()))
|
||||
);
|
||||
|
||||
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.`
|
||||
);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
42
DiscordModules/General/info.js
Executable file
42
DiscordModules/General/info.js
Executable file
|
@ -0,0 +1,42 @@
|
|||
const Command = require("../../src/structures/Command");
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
const { developers, contributors, source } = require("../../config");
|
||||
const { version: DiscordVersion } = require("discord.js");
|
||||
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
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})`);
|
||||
|
||||
ctx.send(CreditEmbed);
|
||||
}
|
||||
};
|
25
DiscordModules/General/ping.js
Executable file
25
DiscordModules/General/ping.js
Executable file
|
@ -0,0 +1,25 @@
|
|||
const Command = require('../../src/structures/Command');
|
||||
|
||||
module.exports = class Ping extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'ping',
|
||||
description: 'Pings Discord to check the API and gateway latency.',
|
||||
aliases: [],
|
||||
module: 'General',
|
||||
cooldown: 0,
|
||||
guildOnly: false,
|
||||
developerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
const m = await ctx.send(`Pinging..`);
|
||||
|
||||
const rest = Math.round(m.createdTimestamp - ctx.msg.createdTimestamp);
|
||||
const ws = Math.round(ctx.client.ws.ping);
|
||||
const shard = Math.round(ctx.guild.shard.ping);
|
||||
|
||||
return m.edit(`REST ${rest / 1000}s (${rest}ms)\nWS ${ws / 1000}s (${ws}ms)\nShard Avg. ${shard / 1000}s (${shard}ms) [${ctx.guild.shard.pings.join(', ')}]`);
|
||||
}
|
||||
}
|
58
DiscordModules/Images/e621.js
Executable file
58
DiscordModules/Images/e621.js
Executable file
|
@ -0,0 +1,58 @@
|
|||
const Command = require("../../src/structures/Command");
|
||||
const yiff = require("yiff");
|
||||
const { MessageEmbed } = require("discord.js");
|
||||
let Icon =
|
||||
"https://cdn6.aptoide.com/imgs/0/7/f/07f23fe390d6d20f47839932ea23c678_icon.png?w=240";
|
||||
|
||||
module.exports = class E621 extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: "e621",
|
||||
description: "Get Images from e621",
|
||||
aliases: ["e6"],
|
||||
module: "Images",
|
||||
cooldown: 5,
|
||||
guildOnly: false,
|
||||
developerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
let Embed = new MessageEmbed().setColor("RED");
|
||||
if (!ctx.channel.nsfw) {
|
||||
Embed.setTitle("NSFW").setDescription(
|
||||
`This channel is not marked as NSFW, please mark it as such and rerun this command.`
|
||||
);
|
||||
return ctx.send(Embed);
|
||||
}
|
||||
if (ctx.args < 1) {
|
||||
Embed.setTitle("Search Terms").setDescription(
|
||||
"I need more tags than that to search for an Image."
|
||||
);
|
||||
return ctx.send(Embed);
|
||||
}
|
||||
|
||||
const Server = await ctx.db.servers.get(ctx.guild.id);
|
||||
let Settings;
|
||||
if (Server === null) {
|
||||
Settings = ctx.utils.db.defaults.server;
|
||||
} else {
|
||||
Settings = Server;
|
||||
}
|
||||
|
||||
let message = await ctx.send(`Searching...`);
|
||||
|
||||
let req;
|
||||
let Message;
|
||||
await yiff.e621.CubFilter(ctx.args.join(" ")).then(E => (req = E));
|
||||
if (Settings.embeds) {
|
||||
Message = new MessageEmbed().setImage(req.image);
|
||||
|
||||
message.delete();
|
||||
} else {
|
||||
Message = `${req.image}`;
|
||||
message.delete();
|
||||
}
|
||||
ctx.send(Message);
|
||||
}
|
||||
};
|
62
DiscordModules/Settings/settings.js
Executable file
62
DiscordModules/Settings/settings.js
Executable file
|
@ -0,0 +1,62 @@
|
|||
const Command = require("../../src/structures/Command");
|
||||
module.exports = class Settings extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: "settings",
|
||||
description: "Show the Settings of this Server",
|
||||
aliases: ["config"],
|
||||
module: "Settings",
|
||||
cooldown: 5,
|
||||
guildOnly: true,
|
||||
developerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async command(ctx) {
|
||||
const SettingsEmbed = new ctx.utils.discord.MessageEmbed();
|
||||
const Server = await ctx.db.servers.get(ctx.guild.id);
|
||||
// console.log(Server);
|
||||
if (Server !== null) {
|
||||
SettingsEmbed.setTitle(`Settings for ${ctx.guild.name}`)
|
||||
.addField("Prefixes", Server.prefix.join(", "), false)
|
||||
.addField(
|
||||
"SourceFynnder",
|
||||
Server.SourceFynnder
|
||||
? ctx.utils.emotes.settings.on
|
||||
: ctx.utils.emotes.settings.off,
|
||||
true
|
||||
)
|
||||
.addField(
|
||||
"Shortlinks",
|
||||
Server.Shortlinks
|
||||
? ctx.utils.emotes.settings.on
|
||||
: ctx.utils.emotes.settings.off,
|
||||
true
|
||||
)
|
||||
.addBlankField(true)
|
||||
.addField(
|
||||
"Image Embeds",
|
||||
Server.embeds
|
||||
? ctx.utils.emotes.settings.on
|
||||
: ctx.utils.emotes.settings.off,
|
||||
true
|
||||
)
|
||||
.addField(
|
||||
"Image Text",
|
||||
Server.rp_text
|
||||
? ctx.utils.emotes.settings.on
|
||||
: ctx.utils.emotes.settings.off,
|
||||
true
|
||||
)
|
||||
.addField("Default Yiff", Server.default_yiff, true);
|
||||
ctx.send(SettingsEmbed);
|
||||
} else {
|
||||
SettingsEmbed.setTitle(
|
||||
`No Settings for ${ctx.guild.name}`
|
||||
).setDescription(
|
||||
`You shouldn't see this.\n Your Server might not have been set up Properly when you invited me.\n\nPlease [join my support server](https://discord.gg/xNAcF8m) and notify my Developer`
|
||||
);
|
||||
ctx.send(SettingsEmbed);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue