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,11 +1,11 @@
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"],
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'],
});
}

View file

@ -1,22 +1,22 @@
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"]
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...')
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)
this.client.logger.err(err);
}
}
}

View file

@ -1,33 +1,34 @@
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",
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(" ");
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({ 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")] });
return message.channel.send({ files: [new Discord.MessageAttachment(Buffer.from(e), 'error.txt')] });
}
message.channel.send(`\`ERROR\` \`\`\`xl\n${e}\n\`\`\``);
}
}

View file

@ -1,10 +1,10 @@
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",
description: 'Grab last message sent to a channel.',
usage: 'lastmessage',
});
}

View file

@ -1,38 +1,33 @@
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.`",
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.`
);
if (!args[0]) return message.channel.send('No username provided.');
var mlist = "";
var count = 0;
let mlist = '';
let count = 0;
this.client.functions.searchForMembers(message.guild, args[0]).forEach((member) => {
if (member) {
mlist += `\`${member.user.tag}\``;
count = count + 1;
}
mlist += "**, **";
mlist += '**, **';
});
mlist = mlist.substring(0, mlist.length - 6);
var mlist1 = `Found ${count} users:\n` + mlist;
const mlist1 = `Found ${count} users:\n` + mlist;
if (!mlist1) {
return message.channel.send("No users found!");
};
if (!mlist1) return message.channel.send('No users found!');
message.channel.send(mlist1);
}

View file

@ -1,22 +1,22 @@
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"]
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]) {
if (!args[0]) {
const embed = this.createEmbed(message.author);
return message.channel.send(embed);
};
}
let user = message.mentions.users.first();
@ -26,30 +26,30 @@ class Avatar extends Command {
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.'
);
};
};
}
}
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 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;
};
};
}
}
module.exports = Avatar;

View file

@ -4,6 +4,6 @@ module.exports = class {
}
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');
}
};