324 FUCKING FORMATTING ERRORS

This commit is contained in:
Emily 2020-10-17 16:00:41 +11:00
parent ec0cdd859f
commit f555831aeb
6 changed files with 167 additions and 167 deletions

View File

@ -1,11 +1,11 @@
module.exports = class {
constructor (client) {
this.client = client;
}
constructor (client) {
this.client = client;
}
async run () {
await this.client.functions.wait(1000);
this.client.user.setActivity(`BNA | v${this.client.version}`, { type: "WATCHING" }) // lol
this.client.logger.ready(`Connected to Discord as ${this.client.user.tag}`);
}
async run () {
await this.client.functions.wait(1000);
this.client.user.setActivity(`BNA | v${this.client.version}`, { type: 'WATCHING' }); // lol
this.client.logger.ready(`Connected to Discord as ${this.client.user.tag}`);
}
};

View File

@ -5,7 +5,7 @@ const { CommandHandler, EventHandler } = require('./util/handlers');
const Functions = require('./util/functions');
const Database = require('./util/database');
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 pkg = require('../package.json');
@ -23,7 +23,7 @@ class WoomyClient extends Client {
if (this.config.devmode === true) {
this.dev = true;
// sentry.init({ dsn: this.config.keys.sentry });
};
}
// Essential modules
this.logger = logger;
@ -38,8 +38,8 @@ class WoomyClient extends Client {
// Handlers, to load commands and events
this.commandHandler = new CommandHandler(this);
this.eventHandler = new EventHandler(this);
};
};
}
}
async function init() {
const client = new WoomyClient();
@ -54,17 +54,17 @@ async function init() {
client.login(client.config.devtoken);
} else {
client.login(client.config.token);
};
};
}
}
init();
process.on('uncaughtException', (err) => {
const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, 'g'), './');
console.error('Uncaught Exception: ', errorMsg);
process.exit(1);
const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, 'g'), './');
console.error('Uncaught Exception: ', errorMsg);
process.exit(1);
});
process.on('unhandledRejection', err => {
console.error('Uncaught Promise Error: ', err);
console.error('Uncaught Promise Error: ', err);
});

View File

@ -1,13 +1,13 @@
const discord = require("discord.js");
const config = require("../config.json");
const discord = require('discord.js');
const config = require('../config.json');
const manager = new discord.ShardingManager("./index.js", {
totalShards: "auto",
token: config.token
const manager = new discord.ShardingManager('./index.js', {
totalShards: 'auto',
token: config.token
});
manager.on("shardCreate", (shard) => {
console.log("Shard " + shard.id + " launched");
manager.on('shardCreate', (shard) => {
console.log('Shard ' + shard.id + ' launched');
});
manager.spawn();

View File

@ -4,7 +4,7 @@ const { inspect, promisify } = require('util');
class Functions {
constructor (client) {
this.client = client;
};
}
userError (channel, cmd, error) {
const embed = new MessageEmbed()
@ -15,12 +15,12 @@ class Functions {
.setFooter(`Run 'help ${cmd.help.name}' for more information.`);
channel.send(embed);
};
}
async getLastMessage (channel) {
let messages = await channel.messages.fetch({ limit: 2 });
return messages.last().content;
};
}
async awaitReply(message, question, limit = 60000) {
const filter = (m) => m.author.id === message.author.id;
@ -48,35 +48,35 @@ class Functions {
try {
match = guild.members.cache.find(x => x.displayName.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);
guild.members.cache.forEach(member => {
if (
(member.displayName.toLowerCase().startsWith(query) ||
if (
(member.displayName.toLowerCase().startsWith(query) ||
member.user.tag.toLowerCase().startsWith(query)) &&
member.id != (match && match.id)
) {
matches.push(member);
};
}
});
return matches;
};
}
findRole (input, message) {
let role;
role = message.guild.roles.cache.find(r => r.name.toLowerCase() === input.toLowerCase());
if(!role) {
role = message.guild.roles.cache.get(input.toLowerCase());
};
}
if(!role) return;
return role;
};
}
intBetween (min, max) {
return Math.round((Math.random() * (max - min) + min));
};
}
@ -85,8 +85,8 @@ class Functions {
return true;
} else {
return false;
};
};
}
}
shutdown () {
const exitQuotes = [
@ -99,34 +99,34 @@ class Functions {
];
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();
console.log(exitQuotes);
};
}
async clean (text) {
if (text && text.constructor.name === 'Promise') {
text = await text;
};
}
if (typeof text !== 'string') {
text = inspect(text, { depth: 1});
};
}
text = text
.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(/`/g, '`' + String.fromCharCode(8203))
.replace(/@/g, '@' + String.fromCharCode(8203))
.replace(this.client.token, 'mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0');
return text;
};
}
wait () {
promisify(setTimeout);
};
};
}
}
module.exports = Functions;

View File

@ -1,132 +1,132 @@
const fs = require("fs");
const fs = require('fs');
class CommandHandler {
constructor (client) {
this.client = client;
}
load (name, category) {
try {
const path = this.client.path + "/commands/" + category + "/" + name + ".js";
const props = new (require(path))(this.client);
this.client.logger.debug(`Loading command ${category}/${name}`);
props.help.name = name;
props.help.category = category;
if (props.init) {
props.init(this.client);
}
this.client.commands.set(props.help.name, props);
this.client.cooldowns.set(props.help.name, new Map());
props.conf.aliases.forEach(alias => {
this.client.aliases.set(alias, props.help.name);
});
return;
} catch (err) {
return `Failed to load command ${name}: ${err.stack}`;
constructor (client) {
this.client = client;
}
}
loadAll () {
const commandDirectories = fs.readdirSync("./commands/");
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
commandDirectories.forEach((dir) => {
const commandFiles = fs.readdirSync("./commands/" + dir + "/");
commandFiles.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
cmd = cmd.substring(0, cmd.length - 3);
const resp = this.load(cmd, dir);
if (resp) {
this.client.logger.error(resp);
load (name, category) {
try {
const path = this.client.path + '/commands/' + category + '/' + name + '.js';
const props = new (require(path))(this.client);
this.client.logger.debug(`Loading command ${category}/${name}`);
props.help.name = name;
props.help.category = category;
if (props.init) {
props.init(this.client);
}
this.client.commands.set(props.help.name, props);
this.client.cooldowns.set(props.help.name, new Map());
props.conf.aliases.forEach(alias => {
this.client.aliases.set(alias, props.help.name);
});
return;
} catch (err) {
return `Failed to load command ${name}: ${err.stack}`;
}
});
});
this.client.logger.info(`Loaded a total of ${this.client.commands.size} commands.`)
}
async unload (name, category) {
const path = this.client.path + "/commands/" + category + "/" + name + ".js";
let command;
if (this.client.commands.has(name)) {
command = this.client.commands.get(name);
} else if (this.client.aliases.has(name)) {
command = this.client.commands.get(this.client.aliases.get(name));
};
if (!command) {
return `\`${name}\` does not exist as a command or an alias.`
}
this.client.logger.debug(`Unloading command ${category}/${name}`);
if (command.shutdown) {
await command.shutdown(this.client)
loadAll () {
const commandDirectories = fs.readdirSync('./commands/');
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
commandDirectories.forEach((dir) => {
const commandFiles = fs.readdirSync('./commands/' + dir + '/');
commandFiles.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
cmd = cmd.substring(0, cmd.length - 3);
const resp = this.load(cmd, dir);
if (resp) {
this.client.logger.error(resp);
}
});
});
this.client.logger.info(`Loaded a total of ${this.client.commands.size} commands.`);
}
delete require.cache[require.resolve(path)];
return false;
}
unloadAll () {
const commandDirectories = fs.readdirSync("./commands/");
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
commandDirectories.forEach((dir) => {
const commandFiles = fs.readdirSync("./commands/" + dir + "/");
commandFiles.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
cmd = cmd.substring(0, cmd.length - 3);
const resp = this.unload(cmd, dir);
if (resp) {
this.client.logger.error(resp);
async unload (name, category) {
const path = this.client.path + '/commands/' + category + '/' + name + '.js';
let command;
if (this.client.commands.has(name)) {
command = this.client.commands.get(name);
} else if (this.client.aliases.has(name)) {
command = this.client.commands.get(this.client.aliases.get(name));
}
});
});
}
if (!command) {
return `\`${name}\` does not exist as a command or an alias.`;
}
this.client.logger.debug(`Unloading command ${category}/${name}`);
if (command.shutdown) {
await command.shutdown(this.client);
}
delete require.cache[require.resolve(path)];
return false;
}
unloadAll () {
const commandDirectories = fs.readdirSync('./commands/');
this.client.logger.debug(`Found ${commandDirectories.length} command directories.`);
commandDirectories.forEach((dir) => {
const commandFiles = fs.readdirSync('./commands/' + dir + '/');
commandFiles.filter((cmd) => cmd.split('.').pop() === 'js').forEach((cmd) => {
cmd = cmd.substring(0, cmd.length - 3);
const resp = this.unload(cmd, dir);
if (resp) {
this.client.logger.error(resp);
}
});
});
}
}
class EventHandler {
constructor (client) {
this.client = client;
}
load (name) {
try {
this.client.logger.debug(`Loading event ${name}`);
const path = this.client.path + "/events/" + name + ".js";
const event = new (require(path))(this.client);
this.client.on(name, (...args) => event.run(...args));
delete require.cache[require.resolve(path)];
return;
} catch (err) {
return `Failed to load event ${name}: ${err}`;
constructor (client) {
this.client = client;
}
}
unload (name) {
load (name) {
try {
this.client.logger.debug(`Loading event ${name}`);
}
const path = this.client.path + '/events/' + name + '.js';
const event = new (require(path))(this.client);
this.client.on(name, (...args) => event.run(...args));
delete require.cache[require.resolve(path)];
loadAll () {
const eventFiles = fs.readdirSync(this.client.path + "/events");
eventFiles.forEach(file => {
const name = file.split(".")[0];
const resp = this.load(name);
return;
} catch (err) {
return `Failed to load event ${name}: ${err}`;
}
}
if (resp) {
this.client.logger.error(resp);
}
});
}
unload (name) { //eslint-disable-line no-unused-vars
}
loadAll () {
const eventFiles = fs.readdirSync(this.client.path + '/events');
eventFiles.forEach(file => {
const name = file.split('.')[0];
const resp = this.load(name);
if (resp) {
this.client.logger.error(resp);
}
});
}
}
module.exports = {
CommandHandler: CommandHandler,
EventHandler: EventHandler
CommandHandler: CommandHandler,
EventHandler: EventHandler
};

View File

@ -14,7 +14,7 @@ const customLevels = {
error: 5
},
colours: {
colours: {
debug: 'black magentaBG',
cmd: 'black whiteBG',
info: 'black cyanBG',
@ -36,14 +36,14 @@ const logger = createLogger({
transports: [
new transports.Console({
level: 'error',
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DD hh:mm:ss'
}),
format.colorize(),
fmt
)
level: 'error',
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DD hh:mm:ss'
}),
format.colorize(),
fmt
)
})
]
});