Use the command "<PREFIX>whiteboard" followed by the text you want to write on an image of a whiteboard. This command is just a copy of Starblasters tweet command(https://autocode.com/snippet/starsblaster/cachsnpt_73MYmcXFdUs7Xs5hHuXVs5iqXVkdwYhL64Zx/) .
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const jimp = require('jimp');
module.exports = async (event, context) => {
if (event.content.startsWith(`${process.env.prefix}whiteboard`)) {
let board = event.content.split(' ');
if (!board[1]) {
return lib.discord.channels['@0.1.1'].messages.create({
channel_id: event.channel_id,
content: `What do you wanna write on the whiteboard!`,
});
}
board = board.slice(1).join(' ');
let whiteboard =
'https://media.istockphoto.com/vectors/realistic-office-whiteboard-empty-whiteboard-with-marker-pens-stock-vector-id1162497535?k=20&m=1162497535&s=612x612&w=0&h=KHPQFeXkh_HO6L_2bYdIP0Zf2SHugohPyeLg6XRsvEk=';
let img = await jimp.read(whiteboard);
img.resize(798, 507);
await jimp.loadFont(jimp.FONT_SANS_32_BLACK).then((font) => {
img.print(
font,
285,
117,
{
text: board,
alignmentX: jimp.HORIZONTAL_ALIGN_LEFT,
alignmentY: jimp.VERTICAL_ALIGN_TOP,
},
290,
290
);
});
let buffer = await img.getBufferAsync(jimp.MIME_PNG);
await lib.discord.channels['@0.1.2'].messages.destroy({
message_id: event.id,
channel_id: event.channel_id,
});
return lib.discord.channels['@0.1.1'].messages.create({
channel_id: event.channel_id,
content: ``,
filename: 'whiteboard.png',
file: buffer,
});
}
};