Removed JS structure.
This commit is contained in:
parent
d7f2232dc0
commit
a0a322a7ee
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"extends": "tesseract"
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"prefix": "!!", // Bot Prefix
|
||||
"token": "<token>", // Bot Token
|
||||
"owners": ["<id>"] // Array of bot owner IDs
|
||||
}
|
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"name": "d.js-v12-bot",
|
||||
"version": "0.0.1",
|
||||
"description": "A Discord bot built on Discord.JS v12",
|
||||
"main": "src/index",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"discord.js",
|
||||
"bot"
|
||||
],
|
||||
"author": "Keanu Timmermans",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"discord.js": "^12.2.0",
|
||||
"moment": "^2.27.0",
|
||||
"ms": "^2.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-tesseract": "^0.0.2"
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
const Command = require('./../Structures/Command.js');
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['hallo']
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
message.channel.send('Hello');
|
||||
}
|
||||
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
const Command = require('../../Structures/Command');
|
||||
const { MessageEmbed, version: djsversion } = require('discord.js');
|
||||
const { version } = require('../../../package.json');
|
||||
const { utc } = require('moment');
|
||||
const os = require('os');
|
||||
const ms = require('ms');
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['info', 'bot', 'botinfo'],
|
||||
category: 'Information'
|
||||
});
|
||||
}
|
||||
|
||||
run(message) {
|
||||
const core = os.cpus()[0];
|
||||
const embed = new MessageEmbed()
|
||||
.setThumbnail(this.client.user.displayAvatarURL())
|
||||
.setColor(message.guild.me.displayHexColor || 'BLUE')
|
||||
.addField('General', [
|
||||
`**❯ Client:** ${this.client.user.tag} (${this.client.user.id})`,
|
||||
`**❯ Commands:** ${this.client.commands.size}`,
|
||||
`**❯ Servers:** ${this.client.guilds.cache.size.toLocaleString()}`,
|
||||
`**❯ Users:** ${this.client.guilds.cache.reduce((a, b) => a + b.memberCount, 0).toLocaleString()}`,
|
||||
`**❯ Channels:** ${this.client.channels.cache.size.toLocaleString()}`,
|
||||
`**❯ Creation Date:** ${utc(this.client.user.createdTimestamp).format('Do MMMM YYYY HH:mm:ss')}`,
|
||||
`**❯ Node.JS:** ${process.version}`,
|
||||
`**❯ Version:** v${version}`,
|
||||
`**❯ Discord.JS:** ${djsversion}`,
|
||||
'\u200b'
|
||||
])
|
||||
.addField('System', [
|
||||
`**❯ Platform:** ${process.platform}`,
|
||||
`**❯ Uptime:** ${ms(os.uptime() * 1000, { long: true })}`,
|
||||
`**❯ CPU:**`,
|
||||
`\u3000 • Cores: ${os.cpus().length}`,
|
||||
`\u3000 • Model: ${core.model}`,
|
||||
`\u3000 • Speed: ${core.speed}MHz`,
|
||||
`**❯ Memory:**`,
|
||||
`\u3000 • Total: ${this.client.utils.formatBytes(process.memoryUsage().heapTotal)}`,
|
||||
`\u3000 • Used: ${this.client.utils.formatBytes(process.memoryUsage().heapTotal)}`
|
||||
])
|
||||
.setTimestamp();
|
||||
message.channel.send(embed);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,90 +0,0 @@
|
|||
/* eslint-disable no-undef */
|
||||
/* eslint-disable no-warning-comments */
|
||||
const Command = require('../../Structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const moment = require('moment');
|
||||
|
||||
const filterLevels = {
|
||||
DISABLED: 'Off',
|
||||
MEMBERS_WITHOUT_ROLES: 'No Role',
|
||||
ALL_MEMBERS: 'Everyone'
|
||||
};
|
||||
const verificationLevels = {
|
||||
NONE: 'None',
|
||||
LOW: 'Low',
|
||||
MEDIUM: 'Medium',
|
||||
HIGH: '(╯°□°)╯︵ ┻━┻',
|
||||
VERY_HIGH: '┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻'
|
||||
};
|
||||
const regions = {
|
||||
brazil: 'Brazil',
|
||||
europe: 'Europe',
|
||||
hongkong: 'Hong Kong',
|
||||
india: 'India',
|
||||
japan: 'Japan',
|
||||
russia: 'Russia',
|
||||
singapore: 'Singapore',
|
||||
southafrica: 'South Africa',
|
||||
sydney: 'Sydney',
|
||||
'us-central': 'US Central',
|
||||
'us-east': 'US East',
|
||||
'us-west': 'US West',
|
||||
'us-south': 'US South'
|
||||
};
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['server', 'guild', 'guildinfo'],
|
||||
category: 'Information'
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
const roles = message.guild.roles.cache.sort((a, b) => b.position - a.position).map(role => role.toString());
|
||||
const members = message.guild.members.cache;
|
||||
const channels = message.guild.channels.cache;
|
||||
const emojis = message.guild.emojis.cache;
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
.setDescription(`**Guild information for __${message.guild.name}__**`)
|
||||
.setColor('BLUE')
|
||||
.setThumbnail(message.guild.iconURL({ dynamic: true }))
|
||||
.addField('General', [
|
||||
`**❯ Name:** ${message.guild.name}`,
|
||||
`**❯ ID:** ${message.guild.id}`,
|
||||
`**❯ Owner:** ${message.guild.owner.user.tag} (${message.guild.ownerID})`,
|
||||
`**❯ Region:** ${regions[message.guild.region]}`,
|
||||
`**❯ Boost Tier:** ${message.guild.premiumTier ? `Tier ${message.guild.premiumTier}` : 'None'}`,
|
||||
`**❯ Explicit Filter:** ${filterLevels[message.guild.explicitContentFilter]}`,
|
||||
`**❯ Verification Level:** ${verificationLevels[message.guild.verificationLevel]}`,
|
||||
`**❯ Time Created:** ${moment(message.guild.createdTimestamp).format('LT')} ${moment(message.guild.createdTimestamp).format('LL')} ${moment(message.guild.createdTimestamp).fromNow()})`,
|
||||
'\u200b'
|
||||
])
|
||||
.addField('Statistics', [
|
||||
`**❯ Role Count:** ${roles.length}`,
|
||||
`**❯ Emoji Count:** ${emojis.size}`,
|
||||
`**❯ Regular Emoji Count:** ${emojis.filter(emoji => !emoji.animated).size}`,
|
||||
`**❯ Animated Emoji Count:** ${emojis.filter(emoji => emoji.animated).size}`,
|
||||
`**❯ Member Count:** ${message.guild.memberCount}`,
|
||||
`**❯ Humans:** ${members.filter(member => !member.user.bot).size}`,
|
||||
`**❯ Bots:** ${members.filter(member => member.user.bot).size}`,
|
||||
`**❯ Text Channels:** ${channels.filter(channel => channel.type === 'text')}`,
|
||||
`**❯ Voice Channels:** ${channels.filter(channel => channel.type === 'voice')}`,
|
||||
`**❯ Boost Count:** ${message.guild.premiumSubscriptionCount || '0'}`,
|
||||
`\u200b`
|
||||
])
|
||||
.addField('Presence', [
|
||||
`**❯ Online:** ${members.filter(member => member.presence.status === 'online').size}`,
|
||||
`**❯ Idle:** ${members.filter(member => member.presence.status === 'idle').size}`,
|
||||
`**❯ Do Not Disturb:** ${members.filter(member => member.presence.stats === 'dnd').size}`,
|
||||
`**❯ Offline:** ${members.filter(member => member.presence.status === 'offline').size}`,
|
||||
'\u200b'
|
||||
])
|
||||
.addField(`Roles [${roles.length - 1}]`, roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None')
|
||||
.setTimestamp();
|
||||
message.channel.send(embed);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,60 +0,0 @@
|
|||
const Command = require('../../Structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const moment = require('moment');
|
||||
|
||||
const flags = {
|
||||
DISCORD_EMPLOYEE: 'Discord Employee',
|
||||
DISCORD_PARTNER: 'Discord Partner',
|
||||
BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)',
|
||||
BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)',
|
||||
HYPESQUAD_EVENTS: 'HypeSquad Events',
|
||||
HOUSE_BRAVERY: 'House of Bravery',
|
||||
HOUSE_BRILLIANCE: 'House of Brilliance',
|
||||
HOUSE_BALANCE: 'House of Balance',
|
||||
EARLY_SUPPORTER: 'Early Supporter',
|
||||
TEAM_USER: 'Team User',
|
||||
SYSTEM: 'System',
|
||||
VERIFIED_BOT: 'Verified Bot',
|
||||
VERIFIED_DEVELOPER: 'Verified Bot Developer'
|
||||
};
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['user', 'ui'],
|
||||
category: 'Information'
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, [target]) {
|
||||
const member = message.mentions.members.last() || message.guild.members.cache.get(target) || message.member;
|
||||
const roles = member.roles.cache
|
||||
.sort((a, b) => b.position - a.position)
|
||||
.map(role => role.toString())
|
||||
.slice(0, -1);
|
||||
const userFlags = member.user.flags.toArray();
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
.setThumbnail(member.user.displayAvatarURL({ dynamic: true, size: 512 }))
|
||||
.setColor(member.displayHexColor || 'BLUE')
|
||||
.addField('User', [
|
||||
`**❯ Username:** ${member.user.username}`,
|
||||
`**❯ Discriminator:** ${member.user.discriminator}`,
|
||||
`**❯ ID:** ${member.id}`,
|
||||
`**❯ Flags:** ${userFlags.length ? userFlags.map(flag => flags[flag]).join(', ') : 'None'}`,
|
||||
`**❯ Avatar:** [Link to avatar](${member.user.displayAvatarURL({ dynamic: true })})`,
|
||||
`**❯ Time Created:** ${moment(member.user.createdTimestamp).format('LT')} ${moment(member.user.createdTimestamp).format('LL')} ${moment(member.user.createdTimestamp).fromNow()}`,
|
||||
`**❯ Status:** ${member.user.presence.status}`,
|
||||
`**❯ Game:** ${member.user.presence.game || 'Not playing a game.'}`
|
||||
])
|
||||
.addField('Member', [
|
||||
`**❯ Highest Role:** ${member.roles.highest.id === message.guild.id ? 'None' : member.roles.highest.name}`,
|
||||
`**❯ Server Join Date:** ${moment(member.joinedAt).format('LL LTS')}`,
|
||||
`**❯ Hoist Role:** ${member.roles.hoist ? member.roles.hoist.name : 'None'}`,
|
||||
`**❯ Roles:** [${roles.length}]: ${roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None'}`,
|
||||
]);
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,56 +0,0 @@
|
|||
const Command = require('../../Structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['help', 'halp'],
|
||||
category: 'Utilities'
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, [command]) {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor('BLUE')
|
||||
.setAuthor(`${message.guild.name} Help Menu`, message.guild.iconURL({ dynamic: true }))
|
||||
.setThumbnail(this.client.user.displayAvatarURL())
|
||||
.setFooter(`Requested by ${message.author.username}`, message.author.displayAvatarURL({ dynamic: true }))
|
||||
.setTimestamp();
|
||||
|
||||
if (command) {
|
||||
const cmd = this.client.commands.get(command) || this.client.command.get(this.aliases.get(command));
|
||||
|
||||
if (!cmd) return message.channel.send(`\`${command}\` is not a valid command.`);
|
||||
|
||||
embed.setAuthor(`${this.client.utils.capitalise(cmd.name)} Command Help`, this.client.user.displayAvatarURL());
|
||||
embed.setDescription([
|
||||
`**❯ Aliases:** ${cmd.aliases.length ? cmd.aliases.map(alias => `\`${alias}\``).join(' ') : 'No Aliases'}`,
|
||||
`**❯ Description:** ${cmd.description}`,
|
||||
`**❯ Category:** ${cmd.category}`,
|
||||
`**❯ Usage:** ${cmd.usage}`
|
||||
]);
|
||||
|
||||
return message.channel.send(embed);
|
||||
} else {
|
||||
embed.setDescription([
|
||||
`These are the available commands for ${message.guild.name}`,
|
||||
`This bot's prefix is: ${this.client.prefix}`,
|
||||
`Command Parameters: \`<>\` is a strict & \`[]\` is optional`
|
||||
]);
|
||||
let categories;
|
||||
if (!this.client.owners.includes(message.author.id)) {
|
||||
categories = this.client.utils.removeDuplicates(this.client.commands.filter(cmd => cmd.category !== 'Owner').map(cmd => cmd.category));
|
||||
} else {
|
||||
categories = this.client.utils.removeDuplicates(this.client.commands.map(cmd => cmd.category));
|
||||
}
|
||||
|
||||
for (const category of categories) {
|
||||
embed.addField(`**${this.client.utils.capitalise(category)}**`, this.client.commands.filter(cmd =>
|
||||
cmd.category === category).map(cmd => `\`${cmd.name}\``).join(' '));
|
||||
}
|
||||
return message.channel.send(embed);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
const Command = require('../../Structures/Command');
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['pong'],
|
||||
category: 'Utilities'
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
const msg = await message.channel.send('Pinging...');
|
||||
|
||||
const latency = msg.createdTimestamp - message.createdTimestamp;
|
||||
const choices = ['Is this really my ping?', "Is this okay? I can't look!", "I hope it isn't bad!"];
|
||||
const response = choices[Math.floor(Math.random() * choices.length)];
|
||||
|
||||
msg.edit(`${response} - Bot Latency: \`${latency}ms\`, API Latency: \`${Math.round(this.client.ws.ping)}ms\``);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
const Command = require('../../Structures/Command.js');
|
||||
const ms = require('ms');
|
||||
|
||||
module.exports = class extends Command {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
aliases: ['uptime'],
|
||||
category: 'Utilities'
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
message.channel.send(`My uptime is \`${ms(this.client.uptime, { long: true })}\``);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
const Event = require('../../Structures/Event');
|
||||
|
||||
module.exports = class extends Event {
|
||||
|
||||
async run(message) {
|
||||
const mentionRegex = RegExp(`^<@!${this.client.user.id}>$`);
|
||||
const mentionRegexPrefix = RegExp(`^<@!${this.client.user.id}> `);
|
||||
|
||||
if (!message.guild || message.author.bot) return;
|
||||
|
||||
if (message.content.match(mentionRegex)) message.channel.send(`My prefix for ${message.guild.name} is \`${this.client.prefix}\`.`);
|
||||
|
||||
const prefix = message.content.match(mentionRegexPrefix) ?
|
||||
message.content.match(mentionRegexPrefix)[0] : this.client.prefix;
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [cmd, ...args] = message.content.slice(prefix.length).trim().split(/ +/g);
|
||||
|
||||
const command = this.client.commands.get(cmd.toLowerCase()) || this.client.commands.get(this.client.aliases.get(cmd.toLowerCase()));
|
||||
if (command) {
|
||||
command.run(message, args);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
const Event = require('../Structures/Event');
|
||||
|
||||
module.exports = class extends Event {
|
||||
|
||||
constructor(...args) {
|
||||
super(...args, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
|
||||
run() {
|
||||
console.log([
|
||||
`Logged in as ${this.client.user.tag}`,
|
||||
`Loaded ${this.client.commands.size} commands.`,
|
||||
`Loaded ${this.client.events.size} events.`
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
const { Client, Collection } = require('discord.js');
|
||||
const Util = require('./Util.js');
|
||||
|
||||
module.exports = class BotClient extends Client {
|
||||
|
||||
constructor(options = {}) {
|
||||
super({
|
||||
disableMentions: 'everyone'
|
||||
});
|
||||
this.validate(options);
|
||||
|
||||
this.commands = new Collection();
|
||||
|
||||
this.events = new Collection();
|
||||
|
||||
this.aliases = new Collection();
|
||||
|
||||
this.utils = new Util(this);
|
||||
|
||||
this.owners = options.owners;
|
||||
}
|
||||
|
||||
validate(options) {
|
||||
if (typeof options !== 'object') throw new TypeError('Options should be a type of Object.');
|
||||
|
||||
if (!options.token) throw new Error('You must pass a token for the client.');
|
||||
this.token = options.token;
|
||||
|
||||
if (!options.prefix) throw new Error('You must pass a prefix for the client.');
|
||||
if (typeof options.prefix !== 'string') throw new TypeError('Prefix should be a type of String.');
|
||||
this.prefix = options.prefix;
|
||||
}
|
||||
|
||||
async start(token = this.token) {
|
||||
this.utils.loadCommands();
|
||||
this.utils.loadEvents();
|
||||
super.login(token);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
module.exports = class Command {
|
||||
|
||||
constructor(client, name, options = {}) {
|
||||
this.client = client;
|
||||
this.name = options.name || name;
|
||||
this.aliases = options.aliases || [];
|
||||
this.description = options.description || 'No description provided.';
|
||||
this.category = options.category || 'Miscellaneous';
|
||||
this.usage = `${this.client.prefix}${this.name} ${options.usage || ''}`.trim();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
async run(message, args) {
|
||||
throw new Error(`Command ${this.name} doesn't provide a run method.`);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,15 +0,0 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
module.exports = class Event {
|
||||
|
||||
constructor(client, name, options = {}) {
|
||||
this.name = name;
|
||||
this.client = client;
|
||||
this.type = options.once ? 'once' : 'on';
|
||||
this.emitter = (typeof options.emitter === 'string' ? this.client[options.emitter] : options.emitter) || this.client;
|
||||
}
|
||||
|
||||
async run(...args) {
|
||||
throw new Error(`The run method has not been implemented in ${this.name}`);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,81 +0,0 @@
|
|||
const path = require('path');
|
||||
const { promisify } = require('util');
|
||||
const glob = promisify(require('glob'));
|
||||
const Command = require('./Command.js');
|
||||
const Event = require('./Event.js');
|
||||
|
||||
module.exports = class Util {
|
||||
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
isClass(input) {
|
||||
return typeof input === 'function' &&
|
||||
typeof input.prototype === 'object' &&
|
||||
input.toString().substring(0, 5) === 'class';
|
||||
}
|
||||
|
||||
get directory() {
|
||||
return `${path.dirname(require.main.filename)}${path.sep}`;
|
||||
}
|
||||
|
||||
trimArray(arr, maxLen = 10) {
|
||||
if (arr.length > maxLen) {
|
||||
const len = arr.length - maxLen;
|
||||
arr = arr.slice(0, maxLen);
|
||||
arr.push(`${len} more...`);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
formatBytes(bytes) {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
return `${parseFloat((bytes / Math.pow(1024, i)).toFixed(2))} ${sizes[i]}`;
|
||||
}
|
||||
|
||||
removeDuplicates(arr) {
|
||||
return [...new Set(arr)];
|
||||
}
|
||||
|
||||
capitalise(string) {
|
||||
return string.split(' ').map(str => str.slice(0, 1).toUpperCase() + str.slice(1)).join(' ');
|
||||
}
|
||||
|
||||
async loadCommands() {
|
||||
return glob(`${this.directory}commands/**/*.js`).then(commands => {
|
||||
for (const commandFile of commands) {
|
||||
delete require.cache[commandFile];
|
||||
const { name } = path.parse(commandFile);
|
||||
const File = require(commandFile);
|
||||
if (!this.isClass(File)) throw new TypeError(`Command ${name} doesn't export a class.`);
|
||||
const command = new File(this.client, name.toLowerCase());
|
||||
if (!(command instanceof Command)) throw new TypeError(`Command ${name} doesn't belong in commands.`);
|
||||
this.client.commands.set(command.name, command);
|
||||
if (command.aliases.length) {
|
||||
for (const alias of command.aliases) {
|
||||
this.client.aliases.set(alias, command.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async loadEvents() {
|
||||
return glob(`${this.directory}events/**/*.js`).then(events => {
|
||||
for (const eventFile of events) {
|
||||
delete require.cache[eventFile];
|
||||
const { name } = path.parse(eventFile);
|
||||
const File = require(eventFile);
|
||||
if (!this.isClass(File)) throw new TypeError(`Event ${name} doesn't export a class!`);
|
||||
const event = new File(this.client, name.toLowerCase());
|
||||
if (!(event instanceof Event)) throw new TypeError(`Event ${name} doesn't belong in the Events Directory.`);
|
||||
this.client.events.set(event.name, event);
|
||||
event.emitter[event.type](name, (...args) => event.run(...args));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
const BotClient = require('./Structures/BotClient');
|
||||
const config = require('../config.json');
|
||||
|
||||
const client = new BotClient(config);
|
||||
client.start();
|
Loading…
Reference in New Issue