Acquire a discord ID by using this command. (message.create.prefix)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const jimp = require('jimp');
module.exports = async (event, context) => {
const ID = context.params.event.mentions[0]
? context.params.event.mentions[0].id
: context.params.event.author.id;
const member2 = await lib.discord.guilds['@0.1.0'].members.retrieve({
user_id: ID, // required
guild_id: context.params.event.guild_id,
});
let timeout = await lib.utils.kv['@0.1.16'].get({
key: `timeout`,
defaultValue: false,
});
let member = event.author.id;
if (event.mentions.length >= 1) {
member = event.mentions[0].id;
}
let user = await lib.discord.users['@0.1.4'].retrieve({
user_id: member,
});
let img = await jimp.read('https://i.imgur.com/vS7Pz9Q.png');
let avatar_jimp = await jimp.read(user.avatar_url);
avatar_jimp.circle();
avatar_jimp.resize(725, 725);
img.composite(avatar_jimp, 78, 64);
await jimp.loadFont(jimp.FONT_SANS_128_WHITE).then((font) => {
img.print(
font,
940,
245,
{
text: `${user.username}#${user.discriminator}`,
},
);
});
await jimp.loadFont(jimp.FONT_SANS_64_BLACK).then((font) => {
img.print(
font,
590,
893,
{
text: `${user.username}`,
},
);
});
await jimp.loadFont(jimp.FONT_SANS_64_BLACK).then((font) => {
img.print(
font,
810,
1074,
{
text: `#${user.discriminator}`,
},
);
});
await jimp.loadFont(jimp.FONT_SANS_64_BLACK).then((font) => {
img.print(
font,
470,
1243,
{
text: `${user.id}`,
},
);
});
await jimp.loadFont(jimp.FONT_SANS_64_BLACK).then((font) => {
img.print(
font,
681,
1400,
{
text: `${new Date(member2.joined_at)}`,
},
);
});
await jimp.loadFont(jimp.FONT_SANS_64_BLACK).then((font) => {
img.print(
font,
552,
1569,
{
text: `${
member2.nick ? member2.nick : 'None'
}`,
},
);
});
await jimp.loadFont(jimp.FONT_SANS_64_BLACK).then((font) => {
img.print(
font,
552,
1743,
{
text: `${member2.user.bot ? 'Yes' : 'No'}`,
},
);
});
let buffer = await img.getBufferAsync(jimp.MIME_PNG);
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: event.channel_id,
content: ``,
filename: 'id_card.png',
file: buffer,
});
};