Optimized some things, fixed ifunny not properly appending to image

This commit is contained in:
TheEssem 2020-03-02 17:10:29 -06:00
parent 6963c44e60
commit 0ff784089b
2 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,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";
const size = await gm(image.path).sizePromise();
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("South").resize(size.width, null).out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().extent(size.width, size.height + (42 * Math.min(size.width / 1024, size.height / 42))).out("null:").out(watermark).gravity("South").resize(size.width, null).out("-layers", "composite").bufferPromise(image.type);
return message.channel.createMessage("", {
file: buffer,
name: `ifunny.${image.type}`

View file

@ -15,14 +15,14 @@ module.exports = async (message) => {
// prefix can be a mention or a set of special characters
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
const guildConf = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0];
const prefix = prefixMention.test(message.content) ? message.content.match(prefixMention)[0] : guildConf.prefix;
const prefix = prefixMention.test(message.content) ? message.content.match(prefixMention)[0] : (await database.guilds.find({ id: message.channel.guild.id }).exec())[0].prefix;
// ignore other stuff
if (message.content.startsWith(prefix) === false && !message.mentions.includes(client.user) && message.channel.id !== "573553254575898626") return;
if (message.content.startsWith(prefix) === false && !message.mentions.includes(client.user)) return;
// && message.channel.id !== "573553254575898626"
// funny stuff
if (message.channel.id === "573553254575898626" && message.channel.guild.id === "433408970955423765") {
/*if (message.channel.id === "573553254575898626" && message.channel.guild.id === "433408970955423765") {
const generalChannel = client.guilds.get("631290275456745502").channels.get("631290275888627713");
if (message.attachments.length !== 0) {
const attachments = [];
@ -34,7 +34,7 @@ module.exports = async (message) => {
} else {
await client.createMessage(generalChannel.id, message.content);
}
}
}*/
// separate commands and args
const escapedPrefix = misc.regexEscape(prefix);