!minecraft-user <username> sends info on a minecraft user like uuid, skin, head, username history
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (!context.params.event.content.split(' ').slice(1).length) {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `You Must Provide a Username! π‘`,
});
} else {
let result = await lib['minecraft-api'].minecraft['@2.1.0'].User.Info({
username: `${context.params.event.content.split(' ').slice(1)}`,
});
if (result.error) {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Invalid Username! π‘`,
});
} else {
const x = result.name_history.map((get, i) => {
return `> **[${i + 1}]** \`${get.name}\` - ${get.changedToAt}\n`;
});
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ` `,
embeds: [
{
type: 'rich',
title: ``,
color: 0x03f6f6,
fields: [
{
name: 'UUID',
value: `${result.uuid}`,
},
{
name: 'Skin',
value: `[Click here](${result.skin})`,
},
{
name: `Username history`,
value: x.join(''),
},
],
image: {
url: `${result.image}`,
width: 120,
height: 270,
},
author: {
name: `${result.username}`,
icon_url: `https://crafatar.com/renders/head/${result.uuid}`,
},
thumbnail: {
url: `https://crafatar.com/renders/head/${result.uuid}`,
width: 120,
height: 111,
},
footer: {
text: `${context.params.event.author.username}#${context.params.event.author.discriminator}`,
icon_url: `https://cdn.discordapp.com/avatars/${context.params.event.author.id}/${context.params.event.author.avatar}.webp`,
},
},
],
});
}
}