formatting fixes

This commit is contained in:
Emily 2020-10-18 11:58:58 +11:00
parent 33219cb3f1
commit 41c3b51ed6
7 changed files with 144 additions and 148 deletions

View File

@ -1,17 +1,17 @@
const Command = require("../../base/Command.js"); const Command = require('../../base/Command.js');
class Help extends Command { class Help extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
description: "Lists what commands Woomy has, what they do, and how to use them.", description: 'Lists what commands Woomy has, what they do, and how to use them.',
usage: "'`help` - Lists all commands.\n`help <command>` - Shows detailed information on a specific command.'", usage: '`help` - Lists all commands.\n`help <command>` - Shows detailed information on a specific command.',
aliases: ["cmds"], aliases: ['cmds'],
}); });
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars async run (message, args, data) { // eslint-disable-line no-unused-vars
} }
} }
module.exports = Help; module.exports = Help;

View File

@ -1,24 +1,24 @@
const Command = require("../../base/Command.js"); const Command = require('../../base/Command.js');
class Ping extends Command { class Ping extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
description: "Latency and API response times.", description: 'Latency and API response times.',
usage: "ping", usage: 'ping',
aliases: ["pong"] aliases: ['pong']
}); });
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars async run (message, args, data) { // eslint-disable-line no-unused-vars
try { try {
const msg = await message.channel.send('Pinging...') const msg = await message.channel.send('Pinging...');
msg.edit( msg.edit(
`Pong! \`${msg.createdTimestamp - message.createdTimestamp}ms\` (💗 \`${Math.round(this.client.ws.ping)}ms\`)` `Pong! \`${msg.createdTimestamp - message.createdTimestamp}ms\` (💗 \`${Math.round(this.client.ws.ping)}ms\`)`
) );
} catch (err) { } catch (err) {
this.client.logger.err(err) this.client.logger.err(err);
}
} }
}
} }
module.exports = Ping; module.exports = Ping;

View File

@ -1,36 +1,37 @@
const Command = require("../../base/Command.js"); const Command = require('../../base/Command.js');
const Discord = require("discord.js"); const Discord = require('discord.js');
class Eval extends Command { class Eval extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
description: "Evaluates arbitrary Javascript.", description: 'Evaluates arbitrary Javascript.',
usage: "eval <expression>", usage: 'eval <expression>',
aliases: ["ev"], aliases: ['ev'],
permLevel: "Bot Owner", permLevel: 'Bot Owner',
devOnly: true devOnly: true
}); });
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars async run (message, args, data) { // eslint-disable-line no-unused-vars
const code = args.join(" "); const code = args.join(' ');
try { try {
const evaled = eval(code); const evaled = eval(code);
const clean = await this.client.functions.clean(evaled); const clean = await this.client.functions.clean(evaled);
const MAX_CHARS = 3 + 2 + clean.length + 3; const MAX_CHARS = 3 + 2 + clean.length + 3;
if (MAX_CHARS > 2000) { if (MAX_CHARS > 2000) {
message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(clean), "output.txt")] }); message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(clean), 'output.txt')] });
} }
message.channel.send(`\`\`\`js\n${clean}\n\`\`\``); message.channel.send(`\`\`\`js\n${clean}\n\`\`\``);
} catch (err) { } catch (err) {
const e = await this.client.functions.clean(err); const e = await this.client.functions.clean(err);
const MAX_CHARS = 1 + 5 + 1 + 3 + e.length + 3; const MAX_CHARS = 1 + 5 + 1 + 3 + e.length + 3;
if (MAX_CHARS > 2000) { if (MAX_CHARS > 2000) {
return message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(e), "error.txt")] }); return message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(e), 'error.txt')] });
} }
message.channel.send(`\`ERROR\` \`\`\`xl\n${e}\n\`\`\``);
message.channel.send(`\`ERROR\` \`\`\`xl\n${e}\n\`\`\``);
}
} }
}
} }
module.exports = Eval; module.exports = Eval;

View File

@ -1,17 +1,17 @@
const Command = require("../../base/Command.js"); const Command = require('../../base/Command.js');
class Lastmessage extends Command { class Lastmessage extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
description: "Grab last message sent to a channel.", description: 'Grab last message sent to a channel.',
usage: "lastmessage", usage: 'lastmessage',
}); });
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars async run (message, args, data) { // eslint-disable-line no-unused-vars
const lastMsg = await this.client.functions.getLastMessage(message.channel); const lastMsg = await this.client.functions.getLastMessage(message.channel);
message.channel.send(lastMsg); message.channel.send(lastMsg);
} }
} }
module.exports = Lastmessage; module.exports = Lastmessage;

View File

@ -1,41 +1,36 @@
const Command = require("../../base/Command.js"); const Command = require('../../base/Command.js');
class Msearch extends Command { class Msearch extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
description: "Lists all members found that match the input", description: 'Lists all members found that match the input',
usage: "`msearch` [query] - Finds users in this server that match the query.`", usage: '`msearch` [query] - Finds users in this server that match the query.`',
aliases: ['membersearch'] aliases: ['membersearch']
}); });
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars async run (message, args, data) { // eslint-disable-line no-unused-vars
if (!args[0]) if (!args[0]) return message.channel.send('No username provided.');
return message.channel.send(
`No username provided.`
);
var mlist = "";
var count = 0;
this.client.functions.searchForMembers(message.guild, args[0]).forEach((member) => { let mlist = '';
if (member) { let count = 0;
mlist += `\`${member.user.tag}\``;
count = count + 1;
}
mlist += "**, **";
});
mlist = mlist.substring(0, mlist.length - 6); this.client.functions.searchForMembers(message.guild, args[0]).forEach((member) => {
if (member) {
mlist += `\`${member.user.tag}\``;
count = count + 1;
}
mlist += '**, **';
});
var mlist1 = `Found ${count} users:\n` + mlist; mlist = mlist.substring(0, mlist.length - 6);
if (!mlist1) { const mlist1 = `Found ${count} users:\n` + mlist;
return message.channel.send("No users found!");
};
message.channel.send(mlist1); if (!mlist1) return message.channel.send('No users found!');
}
message.channel.send(mlist1);
}
} }
module.exports = Msearch; module.exports = Msearch;

View File

@ -1,55 +1,55 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const Command = require("../../base/Command.js"); const Command = require('../../base/Command.js');
class Avatar extends Command { class Avatar extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
description: "View a full-sized image of a person's profile picture.", description: 'View a full-sized image of a person\'s profile picture.',
usage: "avatar <user>", usage: 'avatar <user>',
examples: "`avatar` - Gets your avatar.\n`avatar emily` - Gets the avatar of the user 'emily' ", examples: '`avatar` - Gets your avatar.\n`avatar emily` - Gets the avatar of the user "emily"',
aliases: ["pfp"], aliases: ['pfp'],
botPerms: ["EMBED_LINKS"] botPerms: ['EMBED_LINKS']
}); });
} }
async run (message, args, data) { // eslint-disable-line no-unused-vars async run (message, args, data) { // eslint-disable-line no-unused-vars
if(!args[0]) { if (!args[0]) {
const embed = this.createEmbed(message.author); const embed = this.createEmbed(message.author);
return message.channel.send(embed); return message.channel.send(embed);
}; }
let user = message.mentions.users.first(); let user = message.mentions.users.first();
if (!user && message.guild) { if (!user && message.guild) {
user = this.client.functions.searchForMembers(message.guild, args[0]); user = this.client.functions.searchForMembers(message.guild, args[0]);
if (user.length > 1) { if (user.length > 1) {
return message.channel.send( return message.channel.send(
'Found multiple users, please be more specific or @mention the user instead.' 'Found multiple users, please be more specific or @mention the user instead.'
); );
}; }
if (user.length < 1) { if (user.length < 1) {
return message.channel.send( return message.channel.send(
'Specified user couldn\'t be found, check for typing errors.' 'Specified user couldn\'t be found, check for typing errors.'
); );
}; }
}; }
user = user[0].user; user = user[0].user;
const embed = this.createEmbed(user); const embed = this.createEmbed(user);
return message.channel.send(embed); return message.channel.send(embed);
}; }
createEmbed (user) { createEmbed (user) {
const URL = user.avatarURL({format: "png", dynamic: true, size: 2048}) const URL = user.avatarURL({format: 'png', dynamic: true, size: 2048});
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(user.tag) .setTitle(user.tag)
.setDescription(`**[Avatar URL](${URL})**`) .setDescription(`**[Avatar URL](${URL})**`)
.setImage(URL); .setImage(URL);
return embed; return embed;
}; }
}; }
module.exports = Avatar; module.exports = Avatar;

View File

@ -1,9 +1,9 @@
module.exports = class { module.exports = class {
constructor (client) { constructor (client) {
this.client = client; this.client = client;
} }
async run (error) { async run (error) {
this.client.logger.log(`An error event was sent by Discord.js: \n${JSON.stringify(error)}`, "error"); this.client.logger.log(`An error event was sent by Discord.js: \n${JSON.stringify(error)}`, 'error');
} }
}; };