Removed unnecessary comments, replaced instances of console.error with a throw

This commit is contained in:
TheEssem 2019-12-10 09:53:43 -06:00
parent 346312f006
commit 08ec2ca9ea
25 changed files with 37 additions and 52 deletions

View file

@ -9,8 +9,8 @@ exports.run = async (message) => {
await message.channel.guild.banMember(member.id, 0, `ban command used by @${message.author.username}#${message.author.discriminator}`);
return `Successfully banned ${member.mention}.`;
} catch (error) {
console.error(error);
return `${message.author.mention}, I was unable to ban the member. Have you given me permissions?`;
throw error;
//return `${message.author.mention}, I was unable to ban the member. Have you given me permissions?`;
}
} else {
return `${message.author.mention}, you need to provide a member to ban!`;

View file

@ -9,7 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`;
const watermark = "./assets/images/bandicam.png";
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const data = gm(image.data).composite(watermark).gravity("North").resize(null, size.height);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -9,7 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`;
const watermark = "./assets/images/deviantart.png";
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const data = gm(image.data).composite(watermark).gravity("Center").resize(null, size.height);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -9,7 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`;
const watermark = "./assets/images/funky.png";
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const data = gm(image.data).composite(watermark).gravity("NorthEast").resize(null, size.height);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -11,11 +11,11 @@ exports.run = async (message) => {
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
gm(image.data).gravity("West").crop("50%", 0).strip().write(data2, (error) => {
if (error) console.error;
if (error) throw error;
gm(data2).flop().strip().write(data, async (error) => {
if (error) console.error;
if (error) throw error;
gm(data2).append(data, true).toBuffer(image.type, (error, resultBuffer) => {
if (error) console.error;
if (error) throw error;
return message.channel.createMessage("", {
file: resultBuffer,
name: `haah.${image.type}`

View file

@ -4,8 +4,8 @@ exports.run = async (message, args) => {
await message.channel.guild.banMember(args[0], 0, `hackban command used by @${message.author.username}#${message.author.discriminator}`);
return `Successfully banned user with ID \`${args[0]}\`.`;
} catch (e) {
console.error(e);
return `${message.author.mention}, I was unable to ban the member. Have you given me permissions?`;
throw e;
//return `${message.author.mention}, I was unable to ban the member. Have you given me permissions?`;
}
};

View file

@ -11,11 +11,11 @@ exports.run = async (message) => {
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
gm(image.data).gravity("South").crop(0, "50%").strip().write(data2, (error) => {
if (error) console.error;
if (error) throw error;
gm(data2).flip().strip().write(data, async (error) => {
if (error) console.error;
if (error) throw error;
gm(data).append(data2).toBuffer(image.type, (error, resultBuffer) => {
if (error) console.error;
if (error) throw error;
return message.channel.createMessage("", {
file: resultBuffer,
name: `hooh.${image.type}`

View file

@ -9,7 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`;
const watermark = "./assets/images/hypercam.png";
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const data = gm(image.data).composite(watermark).gravity("NorthWest").resize(null, size.height);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -9,7 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`;
const watermark = "./assets/images/ifunny.png";
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const data = gm(image.data).append(watermark).gravity("South").resize(size.width, null);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -9,8 +9,8 @@ exports.run = async (message) => {
await message.channel.guild.kickMember(member.id, `kick command used by @${message.author.username}#${message.author.discriminator}`);
return `Successfully kicked ${member.mention}.`;
} catch (error) {
console.error(error);
return `${message.author.mention}, I was unable to kick the member. Have you given me permissions?`;
throw error;
//return `${message.author.mention}, I was unable to kick the member. Have you given me permissions?`;
}
} else {
return `${message.author.mention}, you need to provide a member to kick!`;

View file

@ -8,9 +8,9 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
gm(image.data).resize(800, 800).stream((error, stream) => {
if (error) console.error;
if (error) throw error;
gm(stream).out("-liquid-rescale", "400x400").stream(async (error, stream2) => {
if (error) console.error;
if (error) throw error;
const data = gm(stream2).out("-liquid-rescale", "1200x1200");
const resultBuffer = await gmToBuffer(data);
await processMessage.delete();

View file

@ -14,10 +14,10 @@ exports.run = async (message, args) => {
chunks.push(data);
});
child.once("error", (error) => {
if (error) console.error;
if (error) throw error;
});
child.stderr.once("data", (error) => {
if (error) console.error;
if (error) throw error;
});
child.stdout.once("close", () => {
const data = Buffer.concat(chunks);

View file

@ -10,11 +10,11 @@ exports.run = async (message) => {
const watermark = "./assets/images/memecenter.png";
let resultBuffer;
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const command = gm(image.data).out(watermark).background("#FFFFFF").gravity("East").out("-smush").out("-9");
const output = await gmToBuffer(command, "png");
gm(output).size(async (error, size2) => {
if (error) console.error;
if (error) throw error;
resultBuffer = output;
if (size.width !== size2.width) {
const command2 = gm(output).gravity("West").chop(size2.width - size.width, 0);

View file

@ -11,7 +11,7 @@ exports.run = async (message, args) => {
chunks.push(chunk);
});
writable.once("error", (error) => {
if (error) console.error;
if (error) throw error;
});
writable.once("end", () => {
const imageBuffer = Buffer.concat(chunks);

View file

@ -8,7 +8,7 @@ exports.run = async (message, args) => {
await handler.load(args[0]);
return `${message.author.mention}, the command \`${args[0]}\` has been reloaded.`;
} catch (error) {
if (error) console.error;
if (error) throw error;
}
};

View file

@ -9,7 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`;
const watermark = "./assets/images/shutterstock.png";
gm(image.data).size(async (error, size) => {
if (error) console.error;
if (error) throw error;
const command = gm(image.data).composite(watermark).gravity("Center").resize(null, size.height);
const output = await gmToBuffer(command);
return message.channel.createMessage("", {

View file

@ -11,7 +11,7 @@ exports.run = async (message, args) => {
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;");
gm(474, 332).out("+size").background("none").gravity("Center").out("-pointsize", 72).out("-font", "Bitstream Vera Sans").out(`pango:<span foreground="white">${wrap(cleanedMessage, {width: 15, indent: ""})}</span>`).write(file, async (error) => {
if (error) console.error;
if (error) throw error;
const command = gm(template).composite(file).gravity("Center").geometry("474x332+160+10");
const resultBuffer = await gmToBuffer(command, "png");
return message.channel.createMessage("", {

View file

@ -9,8 +9,6 @@ exports.run = async (message) => {
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const command = gm(image.data).out("-duplicate", "29").scale("256x256>").scale("256x256<").background("transparent").virtualPixel("background").out("-distort", "SRT", "'%[fx:360*t/n]'").set("delay", "5").set("dispose", "Background").out("-loop", "0");
const resultBuffer = await gmToBuffer(command, "gif");
// xc:none -fill white -draw circle 128,128 128,0
// .out("-layers", "composite")
await processMessage.delete();
return message.channel.createMessage("", {
file: resultBuffer,

View file

@ -96,13 +96,4 @@ exports.params = {
add: "[name] [content]",
delete: "[name]",
edit: "[name] [content]"
};
/*{
default: "Gets a tag",
add: "Adds a tag",
delete: "Deletes a tag",
edit: "Edits a tag",
list: "Lists all tags in the server",
random: "Gets a random tag"
}*/
};

View file

@ -8,7 +8,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
gm(image.data).command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").stream(async (error, output) => {
if (error) console.error;
if (error) throw error;
const data = gm(output).resize("800x800>");
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -11,11 +11,11 @@ exports.run = async (message) => {
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
gm(image.data).gravity("East").crop("50%", 0).strip().write(data2, (error) => {
if (error) console.error;
if (error) throw error;
gm(data2).flop().strip().write(data, async (error) => {
if (error) console.error;
if (error) throw error;
gm(data).append(data2, true).toBuffer(image.type, (error, resultBuffer) => {
if (error) console.error;
if (error) throw error;
return message.channel.createMessage("", {
file: resultBuffer,
name: `waaw.${image.type}`

View file

@ -8,7 +8,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`;
gm(image.data).resize(128).stream(async (error, output) => {
if (error) console.error;
if (error) throw error;
const data = gm(output).virtualPixel("tile").matteColor("none").out("-background", "none").resize("512x512!").out("-distort").out("Perspective").out("0,0,57,42 0,128,63,130 128,0,140,60 128,128,140,140");
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {

View file

@ -11,11 +11,11 @@ exports.run = async (message) => {
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`;
gm(image.data).gravity("North").crop(0, "50%").strip().write(data2, (error) => {
if (error) console.error;
if (error) throw error;
gm(data2).flip().strip().write(data, async (error) => {
if (error) console.error;
if (error) throw error;
gm(data2).append(data).toBuffer(image.type, (error, resultBuffer) => {
if (error) console.error;
if (error) throw error;
return message.channel.createMessage("", {
file: resultBuffer,
name: `woow.${image.type}`

View file

@ -12,8 +12,6 @@ module.exports = async () => {
for (const [id, guild] of client.guilds) {
const guildDB = (await database.guilds.find({ id: id }).exec())[0];
const xpDB = (await database.xp.find({ id: id }).exec())[0];
// .length === 0 && guildDB.constructor === Object
// !Object.entries(guildDB)
if (!guildDB) {
console.log(`Registering guild database entry for guild ${id}...`);
const newGuild = new database.guilds({
@ -23,8 +21,6 @@ module.exports = async () => {
});
await newGuild.save();
}
// .length === 0 && xpDB.constructor === Object
// !Object.entries(xpDB)
if (!xpDB) {
console.log(`Registering xp database entry for guild ${id}...`);
const memberInfo = {};

View file

@ -36,7 +36,7 @@ const paginationEmbed = async (message, pages, timeout = 120000) => {
if (manageMessages) msg.removeReaction("🔢", userID);
});
}).catch(error => {
if (error) console.error;
if (error) throw error;
});
break;
case "▶":