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 {
constructor (client) {
super(client, {
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.'",
aliases: ["cmds"],
});
}
constructor (client) {
super(client, {
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.',
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;

View file

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

View file

@ -1,36 +1,37 @@
const Command = require("../../base/Command.js");
const Discord = require("discord.js");
const Command = require('../../base/Command.js');
const Discord = require('discord.js');
class Eval extends Command {
constructor (client) {
super(client, {
description: "Evaluates arbitrary Javascript.",
usage: "eval <expression>",
aliases: ["ev"],
permLevel: "Bot Owner",
devOnly: true
});
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
const code = args.join(" ");
try {
const evaled = eval(code);
const clean = await this.client.functions.clean(evaled);
const MAX_CHARS = 3 + 2 + clean.length + 3;
if (MAX_CHARS > 2000) {
message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(clean), "output.txt")] });
}
message.channel.send(`\`\`\`js\n${clean}\n\`\`\``);
} catch (err) {
const e = await this.client.functions.clean(err);
const MAX_CHARS = 1 + 5 + 1 + 3 + e.length + 3;
if (MAX_CHARS > 2000) {
return message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(e), "error.txt")] });
}
message.channel.send(`\`ERROR\` \`\`\`xl\n${e}\n\`\`\``);
constructor (client) {
super(client, {
description: 'Evaluates arbitrary Javascript.',
usage: 'eval <expression>',
aliases: ['ev'],
permLevel: 'Bot Owner',
devOnly: true
});
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
const code = args.join(' ');
try {
const evaled = eval(code);
const clean = await this.client.functions.clean(evaled);
const MAX_CHARS = 3 + 2 + clean.length + 3;
if (MAX_CHARS > 2000) {
message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(clean), 'output.txt')] });
}
message.channel.send(`\`\`\`js\n${clean}\n\`\`\``);
} catch (err) {
const e = await this.client.functions.clean(err);
const MAX_CHARS = 1 + 5 + 1 + 3 + e.length + 3;
if (MAX_CHARS > 2000) {
return message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(e), 'error.txt')] });
}
message.channel.send(`\`ERROR\` \`\`\`xl\n${e}\n\`\`\``);
}
}
}
}
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 {
constructor (client) {
super(client, {
description: "Grab last message sent to a channel.",
usage: "lastmessage",
});
}
constructor (client) {
super(client, {
description: 'Grab last message sent to a channel.',
usage: 'lastmessage',
});
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
const lastMsg = await this.client.functions.getLastMessage(message.channel);
message.channel.send(lastMsg);
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
const lastMsg = await this.client.functions.getLastMessage(message.channel);
message.channel.send(lastMsg);
}
}
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 {
constructor (client) {
super(client, {
description: "Lists all members found that match the input",
usage: "`msearch` [query] - Finds users in this server that match the query.`",
aliases: ['membersearch']
});
}
constructor (client) {
super(client, {
description: 'Lists all members found that match the input',
usage: '`msearch` [query] - Finds users in this server that match the query.`',
aliases: ['membersearch']
});
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
if (!args[0])
return message.channel.send(
`No username provided.`
);
var mlist = "";
var count = 0;
async run (message, args, data) { // eslint-disable-line no-unused-vars
if (!args[0]) return message.channel.send('No username provided.');
this.client.functions.searchForMembers(message.guild, args[0]).forEach((member) => {
if (member) {
mlist += `\`${member.user.tag}\``;
count = count + 1;
}
mlist += "**, **";
});
let mlist = '';
let count = 0;
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) {
return message.channel.send("No users found!");
};
const mlist1 = `Found ${count} users:\n` + mlist;
message.channel.send(mlist1);
}
if (!mlist1) return message.channel.send('No users found!');
message.channel.send(mlist1);
}
}
module.exports = Msearch;

View file

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

View file

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