324 FUCKING FORMATTING ERRORS
This commit is contained in:
parent
ec0cdd859f
commit
f555831aeb
6 changed files with 167 additions and 167 deletions
|
@ -5,7 +5,7 @@ module.exports = class {
|
||||||
|
|
||||||
async run () {
|
async run () {
|
||||||
await this.client.functions.wait(1000);
|
await this.client.functions.wait(1000);
|
||||||
this.client.user.setActivity(`BNA | v${this.client.version}`, { type: "WATCHING" }) // lol
|
this.client.user.setActivity(`BNA | v${this.client.version}`, { type: 'WATCHING' }); // lol
|
||||||
this.client.logger.ready(`Connected to Discord as ${this.client.user.tag}`);
|
this.client.logger.ready(`Connected to Discord as ${this.client.user.tag}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
12
bot/index.js
12
bot/index.js
|
@ -5,7 +5,7 @@ const { CommandHandler, EventHandler } = require('./util/handlers');
|
||||||
const Functions = require('./util/functions');
|
const Functions = require('./util/functions');
|
||||||
const Database = require('./util/database');
|
const Database = require('./util/database');
|
||||||
const logger = require('./util/logger');
|
const logger = require('./util/logger');
|
||||||
const sentry = require('@sentry/node');
|
const sentry = require('@sentry/node'); // eslint-disable-line no-unused-vars
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
const pkg = require('../package.json');
|
const pkg = require('../package.json');
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class WoomyClient extends Client {
|
||||||
if (this.config.devmode === true) {
|
if (this.config.devmode === true) {
|
||||||
this.dev = true;
|
this.dev = true;
|
||||||
// sentry.init({ dsn: this.config.keys.sentry });
|
// sentry.init({ dsn: this.config.keys.sentry });
|
||||||
};
|
}
|
||||||
|
|
||||||
// Essential modules
|
// Essential modules
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
@ -38,8 +38,8 @@ class WoomyClient extends Client {
|
||||||
// Handlers, to load commands and events
|
// Handlers, to load commands and events
|
||||||
this.commandHandler = new CommandHandler(this);
|
this.commandHandler = new CommandHandler(this);
|
||||||
this.eventHandler = new EventHandler(this);
|
this.eventHandler = new EventHandler(this);
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
const client = new WoomyClient();
|
const client = new WoomyClient();
|
||||||
|
@ -54,8 +54,8 @@ async function init() {
|
||||||
client.login(client.config.devtoken);
|
client.login(client.config.devtoken);
|
||||||
} else {
|
} else {
|
||||||
client.login(client.config.token);
|
client.login(client.config.token);
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
const discord = require("discord.js");
|
const discord = require('discord.js');
|
||||||
const config = require("../config.json");
|
const config = require('../config.json');
|
||||||
|
|
||||||
const manager = new discord.ShardingManager("./index.js", {
|
const manager = new discord.ShardingManager('./index.js', {
|
||||||
totalShards: "auto",
|
totalShards: 'auto',
|
||||||
token: config.token
|
token: config.token
|
||||||
});
|
});
|
||||||
|
|
||||||
manager.on("shardCreate", (shard) => {
|
manager.on('shardCreate', (shard) => {
|
||||||
console.log("Shard " + shard.id + " launched");
|
console.log('Shard ' + shard.id + ' launched');
|
||||||
});
|
});
|
||||||
|
|
||||||
manager.spawn();
|
manager.spawn();
|
|
@ -4,7 +4,7 @@ const { inspect, promisify } = require('util');
|
||||||
class Functions {
|
class Functions {
|
||||||
constructor (client) {
|
constructor (client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
};
|
}
|
||||||
|
|
||||||
userError (channel, cmd, error) {
|
userError (channel, cmd, error) {
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
|
@ -15,12 +15,12 @@ class Functions {
|
||||||
.setFooter(`Run 'help ${cmd.help.name}' for more information.`);
|
.setFooter(`Run 'help ${cmd.help.name}' for more information.`);
|
||||||
|
|
||||||
channel.send(embed);
|
channel.send(embed);
|
||||||
};
|
}
|
||||||
|
|
||||||
async getLastMessage (channel) {
|
async getLastMessage (channel) {
|
||||||
let messages = await channel.messages.fetch({ limit: 2 });
|
let messages = await channel.messages.fetch({ limit: 2 });
|
||||||
return messages.last().content;
|
return messages.last().content;
|
||||||
};
|
}
|
||||||
|
|
||||||
async awaitReply(message, question, limit = 60000) {
|
async awaitReply(message, question, limit = 60000) {
|
||||||
const filter = (m) => m.author.id === message.author.id;
|
const filter = (m) => m.author.id === message.author.id;
|
||||||
|
@ -48,7 +48,7 @@ class Functions {
|
||||||
try {
|
try {
|
||||||
match = guild.members.cache.find(x => x.displayName.toLowerCase() == query);
|
match = guild.members.cache.find(x => x.displayName.toLowerCase() == query);
|
||||||
if (!match) guild.members.cache.find(x => x.user.username.toLowerCase() == query);
|
if (!match) guild.members.cache.find(x => x.user.username.toLowerCase() == query);
|
||||||
} catch (err) {};
|
} catch (err) {} //eslint-disable-line no-empty
|
||||||
|
|
||||||
if (match) matches.push(match);
|
if (match) matches.push(match);
|
||||||
guild.members.cache.forEach(member => {
|
guild.members.cache.forEach(member => {
|
||||||
|
@ -58,25 +58,25 @@ class Functions {
|
||||||
member.id != (match && match.id)
|
member.id != (match && match.id)
|
||||||
) {
|
) {
|
||||||
matches.push(member);
|
matches.push(member);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return matches;
|
return matches;
|
||||||
};
|
}
|
||||||
|
|
||||||
findRole (input, message) {
|
findRole (input, message) {
|
||||||
let role;
|
let role;
|
||||||
role = message.guild.roles.cache.find(r => r.name.toLowerCase() === input.toLowerCase());
|
role = message.guild.roles.cache.find(r => r.name.toLowerCase() === input.toLowerCase());
|
||||||
if(!role) {
|
if(!role) {
|
||||||
role = message.guild.roles.cache.get(input.toLowerCase());
|
role = message.guild.roles.cache.get(input.toLowerCase());
|
||||||
};
|
}
|
||||||
if(!role) return;
|
if(!role) return;
|
||||||
return role;
|
return role;
|
||||||
};
|
}
|
||||||
|
|
||||||
intBetween (min, max) {
|
intBetween (min, max) {
|
||||||
return Math.round((Math.random() * (max - min) + min));
|
return Math.round((Math.random() * (max - min) + min));
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ class Functions {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
shutdown () {
|
shutdown () {
|
||||||
const exitQuotes = [
|
const exitQuotes = [
|
||||||
|
@ -99,34 +99,34 @@ class Functions {
|
||||||
];
|
];
|
||||||
|
|
||||||
this.client.db.pool.end().then(() => {
|
this.client.db.pool.end().then(() => {
|
||||||
this.client.logger.info('Connection to database closed.')
|
this.client.logger.info('Connection to database closed.');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.client.destroy();
|
this.client.destroy();
|
||||||
|
|
||||||
console.log(exitQuotes);
|
console.log(exitQuotes);
|
||||||
};
|
}
|
||||||
|
|
||||||
async clean (text) {
|
async clean (text) {
|
||||||
if (text && text.constructor.name === 'Promise') {
|
if (text && text.constructor.name === 'Promise') {
|
||||||
text = await text;
|
text = await text;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (typeof text !== 'string') {
|
if (typeof text !== 'string') {
|
||||||
text = inspect(text, { depth: 1});
|
text = inspect(text, { depth: 1});
|
||||||
};
|
}
|
||||||
|
|
||||||
text = text
|
text = text
|
||||||
.replace(/`/g, "`" + String.fromCharCode(8203))
|
.replace(/`/g, '`' + String.fromCharCode(8203))
|
||||||
.replace(/@/g, "@" + String.fromCharCode(8203))
|
.replace(/@/g, '@' + String.fromCharCode(8203))
|
||||||
.replace(this.client.token, "mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0");
|
.replace(this.client.token, 'mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0');
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
};
|
}
|
||||||
|
|
||||||
wait () {
|
wait () {
|
||||||
promisify(setTimeout);
|
promisify(setTimeout);
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
module.exports = Functions;
|
module.exports = Functions;
|
|
@ -1,4 +1,4 @@
|
||||||
const fs = require("fs");
|
const fs = require('fs');
|
||||||
|
|
||||||
class CommandHandler {
|
class CommandHandler {
|
||||||
constructor (client) {
|
constructor (client) {
|
||||||
|
@ -7,7 +7,7 @@ class CommandHandler {
|
||||||
|
|
||||||
load (name, category) {
|
load (name, category) {
|
||||||
try {
|
try {
|
||||||
const path = this.client.path + "/commands/" + category + "/" + name + ".js";
|
const path = this.client.path + '/commands/' + category + '/' + name + '.js';
|
||||||
const props = new (require(path))(this.client);
|
const props = new (require(path))(this.client);
|
||||||
|
|
||||||
this.client.logger.debug(`Loading command ${category}/${name}`);
|
this.client.logger.debug(`Loading command ${category}/${name}`);
|
||||||
|
@ -34,11 +34,11 @@ class CommandHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAll () {
|
loadAll () {
|
||||||
const commandDirectories = fs.readdirSync("./commands/");
|
const commandDirectories = fs.readdirSync('./commands/');
|
||||||
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
|
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
|
||||||
commandDirectories.forEach((dir) => {
|
commandDirectories.forEach((dir) => {
|
||||||
const commandFiles = fs.readdirSync("./commands/" + dir + "/");
|
const commandFiles = fs.readdirSync('./commands/' + dir + '/');
|
||||||
commandFiles.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
|
commandFiles.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
|
||||||
cmd = cmd.substring(0, cmd.length - 3);
|
cmd = cmd.substring(0, cmd.length - 3);
|
||||||
const resp = this.load(cmd, dir);
|
const resp = this.load(cmd, dir);
|
||||||
if (resp) {
|
if (resp) {
|
||||||
|
@ -46,11 +46,11 @@ class CommandHandler {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.client.logger.info(`Loaded a total of ${this.client.commands.size} commands.`)
|
this.client.logger.info(`Loaded a total of ${this.client.commands.size} commands.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async unload (name, category) {
|
async unload (name, category) {
|
||||||
const path = this.client.path + "/commands/" + category + "/" + name + ".js";
|
const path = this.client.path + '/commands/' + category + '/' + name + '.js';
|
||||||
|
|
||||||
let command;
|
let command;
|
||||||
|
|
||||||
|
@ -58,27 +58,27 @@ class CommandHandler {
|
||||||
command = this.client.commands.get(name);
|
command = this.client.commands.get(name);
|
||||||
} else if (this.client.aliases.has(name)) {
|
} else if (this.client.aliases.has(name)) {
|
||||||
command = this.client.commands.get(this.client.aliases.get(name));
|
command = this.client.commands.get(this.client.aliases.get(name));
|
||||||
};
|
}
|
||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
return `\`${name}\` does not exist as a command or an alias.`
|
return `\`${name}\` does not exist as a command or an alias.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.client.logger.debug(`Unloading command ${category}/${name}`);
|
this.client.logger.debug(`Unloading command ${category}/${name}`);
|
||||||
|
|
||||||
if (command.shutdown) {
|
if (command.shutdown) {
|
||||||
await command.shutdown(this.client)
|
await command.shutdown(this.client);
|
||||||
}
|
}
|
||||||
delete require.cache[require.resolve(path)];
|
delete require.cache[require.resolve(path)];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unloadAll () {
|
unloadAll () {
|
||||||
const commandDirectories = fs.readdirSync("./commands/");
|
const commandDirectories = fs.readdirSync('./commands/');
|
||||||
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
|
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
|
||||||
commandDirectories.forEach((dir) => {
|
commandDirectories.forEach((dir) => {
|
||||||
const commandFiles = fs.readdirSync("./commands/" + dir + "/");
|
const commandFiles = fs.readdirSync('./commands/' + dir + '/');
|
||||||
commandFiles.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
|
commandFiles.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
|
||||||
cmd = cmd.substring(0, cmd.length - 3);
|
cmd = cmd.substring(0, cmd.length - 3);
|
||||||
const resp = this.unload(cmd, dir);
|
const resp = this.unload(cmd, dir);
|
||||||
if (resp) {
|
if (resp) {
|
||||||
|
@ -98,7 +98,7 @@ class EventHandler {
|
||||||
try {
|
try {
|
||||||
this.client.logger.debug(`Loading event ${name}`);
|
this.client.logger.debug(`Loading event ${name}`);
|
||||||
|
|
||||||
const path = this.client.path + "/events/" + name + ".js";
|
const path = this.client.path + '/events/' + name + '.js';
|
||||||
const event = new (require(path))(this.client);
|
const event = new (require(path))(this.client);
|
||||||
this.client.on(name, (...args) => event.run(...args));
|
this.client.on(name, (...args) => event.run(...args));
|
||||||
delete require.cache[require.resolve(path)];
|
delete require.cache[require.resolve(path)];
|
||||||
|
@ -109,14 +109,14 @@ class EventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unload (name) {
|
unload (name) { //eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAll () {
|
loadAll () {
|
||||||
const eventFiles = fs.readdirSync(this.client.path + "/events");
|
const eventFiles = fs.readdirSync(this.client.path + '/events');
|
||||||
eventFiles.forEach(file => {
|
eventFiles.forEach(file => {
|
||||||
const name = file.split(".")[0];
|
const name = file.split('.')[0];
|
||||||
const resp = this.load(name);
|
const resp = this.load(name);
|
||||||
|
|
||||||
if (resp) {
|
if (resp) {
|
||||||
|
|
Loading…
Reference in a new issue