fuck node

This commit is contained in:
ry 2019-10-14 13:19:41 +02:00
parent 9ad8081971
commit 304d0ccb96
49 changed files with 1305 additions and 403 deletions

104
DiscordModules/General/help.js Executable file
View 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
View 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
View 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(', ')}]`);
}
}