Here's an command for avatar with Download button
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if(
context.params.event.content.startsWith
`-av` ||
context.params.event.content.startsWith
`-AV`
) {
let user_id = context.params.event.mentions[0]
? context.params.event.mentions[0].id
: context.params.event.author.id;
let user = await lib.discord.users['@0.1.5'].retrieve({
user_id: user_id,
});
let avatar_url = null;
let title = null;
let hex = null;
if (user.avatar) {
let extention = user.avatar.startsWith('a_') ? 'gif' : 'png';
avatar_url = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.${extention}?size=4096`;
title = `${user.username}'s avatar`;
}
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `\`\`\`js\nProfile picture of '${user.username}'\`\`\``,
tts: false,
embeds: [
{
type: 'rich',
description: '',
color: 0x2F3136,
image: {
url: `${avatar_url}`,
height: 100,
width: 100,
},
},
],
components: [
{
type: 1,
components: [
{
type: 2,
label: 'Download',
style: 5,
url: `${avatar_url}`
},
],
},
],
});
}
//----------------------------------ShaunNoob---------------------------------//