Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return message.channel.send('I can\'t attach messages!');
}
const args = message.content.split(/\s+/g).slice(1).join(" ");
if (args.length < 1) {
return message.channel.send('Please provide some text!');
}
await message.channel.startTyping()
const text = message.content.split(/\s+/g).slice(1).join(" ");
const shits = await Jimp.read('assets/images/SHITS.png');
const blank = await Jimp.read('assets/images/blank.png');
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
blank.resize(195, 175);
const search = blank.print(font, 0, 0, text, 175);
shits.composite(search, 810, 31);
shits.getBuffer(Jimp.MIME_PNG, async(err, buffer) => {
await message.channel.send({
files: [{
name: 'shits.png',
attachment: buffer
}]
})
await message.channel.stopTyping()
})
async run (message) {
if (!message.channel.permissionsFor(this.client.user.id).has('ATTACH_FILES')) {
return message.channel.send('I can\'t attach messages!');
}
const args = message.content.split(/\s+/g).slice(1).join(" ");
if (args.length < 1) {
return message.channel.send('Please provide some text!');
}
const text = message.content.split(/\s+/g).slice(1).join(" ");
const shits = await Jimp.read('assets/images/SHITS.png');
const blank = await Jimp.read('assets/images/blank.png');
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
blank.resize(195, 175);
const search = blank.print(font, 0, 0, text, 175);
shits.composite(search, 810, 31);
shits.getBuffer(Jimp.MIME_PNG, async (err, buffer) => {
try {
return await message.channel.send({
files: [{
name: 'shits.png',
attachment: buffer
}]
})
} catch (err) {
return message.channel.send(`✖ Something went wrong while executing that function.`);
args = message.mentions.users.first().username;
} else {
if (args < 1) {
args = message.author.username;
} else if (args.join(' ').length > 35) {
return message.channel.send(`The limit is 35 characters! You're ${args.join(' ').length - 35} characters over the limit!`);
} else {
args = args.join(' ');
}
}
const text = args;
const shit = await Jimp.read('assets/images/shit.jpg');
const blank = await Jimp.read('assets/images/Empty.png');
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
blank.resize(350, 350);
const search = blank.print(font, 0, 0, text, 350);
search.rotate(310);
shit.composite(search, 195, 585);
shit.getBuffer(Jimp.MIME_PNG, async(err, buffer) => {
try {
return await message.channel.send({
files: [{
name: 'shit.png',
attachment: buffer
}]
})
} catch (err) {
exports.writeOGFile = async function({ text }) {
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
const img = new Jimp(800, 400, "#fff");
await img.print(font, 10, 10, text);
const imgBuf = await img.getBufferAsync(Jimp.MIME_PNG);
const url = path.join(
`static`,
`og-image`,
`${slugify(text)}-${revHash(imgBuf)}.png`
);
const publicPath = path.join(process.cwd(), `public`, url);
await img.writeAsync(publicPath);
return path.join("/", url);
};
const getScaledFont = (width, color) => {
if (width > 1600)
return color === 'black' ? Jimp.FONT_SANS_128_BLACK : Jimp.FONT_SANS_128_WHITE;
else if (width > 700)
return color === 'black' ? Jimp.FONT_SANS_32_BLACK : Jimp.FONT_SANS_32_WHITE;
else
return color === 'black' ? Jimp.FONT_SANS_16_BLACK : Jimp.FONT_SANS_16_WHITE;
}
if (args < 1) {
args = message.author.username;
} else if (args.join(' ').length > 35) {
return message.channel.send(`The limit is 35 characters! You're ${args.join(' ').length - 35} characters over the limit!`);
} else {
args = args.join(' ');
}
}
await message.channel.startTyping()
const text = args;
const shit = await Jimp.read('assets/images/shit.jpg');
const blank = await Jimp.read('assets/images/Empty.png');
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
blank.resize(350, 350);
const search = blank.print(font, 0, 0, text, 350);
search.rotate(310);
shit.composite(search, 195, 585);
shit.getBuffer(Jimp.MIME_PNG, async(err, buffer) => {
return await message.channel.send({
files: [{
name: 'shit.png',
attachment: buffer
}]
})
await message.channel.stopTyping()
})
Jimp.read(imgPath).then((image) => {
img = image;
return Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
}).then((font) => {
img.print(font, 350, 25, text, 280).write("images/img01.png", () => {
execute: async function(text, buffer) {
const template = await Jimp.read(Buffer.from(buffer[0]));
const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
buffer = await template.print(font, 350, 25, text, 280);
return await buffer.getBufferAsync(Jimp.MIME_JPEG);
}
};