0.0.2 • Published 1 year ago

meta-discord v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Image generation tools for Discord.JS / Node.JS

📦 Installation

npm i meta-discord@latest

🖼️ Cards

PARAMETERTYPEREQUIREDDESCRIPTION
userIdstring✔️Discord User ID
imgOptionsobject✖️Customize the card in multiple ways

🔴 imgOptions

PARAMETERTYPEDEFAULTDESCRIPTION
customTagstring✖️Text below the user
customBadgesstring[]✖️Your own png badges path and URL
customBackgroundstring✖️Change the background to any image path and URL
overwriteBadgesbooleanfalseMerge your badges with the discord defaults
badgesFramebooleanfalseCreates a small frame behind the badges
removeBadgesbooleanfalseRemoves badges, whether custom or from discord
usernameColorstring✖️Username HEX color
tagColorstring✖️Tag HEX color
borderColorstring or string[]✖️Border HEX color, can be gradient if 2 colors are used
borderAllignstringhorizontalGradient alignment if 2 colors are used
presenceStatusstring✖️User status to be displayed below the avatar
squareAvatarbooleanfalseChange avatar shape to a square

📃 Discord.js v14 Example

const { AttachmentBuilder } = require('discord.js');
const { profileImage } = require('meta-discord');
await interaction.deferReply();
const user = interaction.options.getUser('user-option');
const buffer = await profileImage(user.id, {
  customTag: 'Admin',
  ...imgOptions
});
const attachment = new AttachmentBuilder(buffer, { name: 'profile.png' });
interaction.followUp({ files: [attachment] });
client.on("channelCreate", (channel) => {
    console.log(`${channel} has been created`)
})

1️] Example One

Default

profileImage('ID')

2] Example Two

Default

profileImage('ID', {
 customTag: 'Minecraft Modder',
 customBadges: [ './badges/booster.png','./badges/orange.png', './badges/giveaway.png' ],
 overwriteBadges: false,
 usernameColor: '#d9dfef',
 borderColor: ['#f90257', '#043a92'],
 presenceStatus: 'idle',
 squareAvatar: true
});

3] Example Three Bot

Default

profileImage('ID', {
 customTag: 'Minecraft Bot',
 customBackground: './imgs/axoBackground.png',
 usernameColor: '#ffbddf',
 borderColor: '#fe6a90',
 presenceStatus: 'online',
 squareAvatar: true
});
PARAMETERTYPEREQUIREDDESCRIPTION
userIdstring✔️Discord User ID
imgOptionsobject✖️Customize the card in multiple ways

🔴 imgOptions

PARAMETERTYPEDEFAULTDESCRIPTION
customTagstring✖️Text below the user
customBadgesstring[]✖️Your own png badges path and URL
customBackgroundstring✖️Change the background to any image path and URL
overwriteBadgesbooleanfalseMerge your badges with the discord defaults
badgesFramebooleanfalseCreates a small frame behind the badges
removeBadgesbooleanfalseRemoves badges, whether custom or from discord
usernameColorstring✖️Username HEX color
tagColorstring✖️Tag HEX color
borderColorstring or string[]✖️Border HEX color, can be gradient if 2 colors are used
borderAllignstringhorizontalGradient alignment if 2 colors are used
presenceStatusstring✖️User status to be displayed below the avatar
squareAvatarbooleanfalseChange avatar shape to a square
rankDataobject✖️Input users rank data

🔴 rankData

PARAMETERTYPEDEFAULTDESCRIPTION
currentXpnumber✖️Current user XP
requiredXpnumber✖️XP required to level up
levelnumber✖️Current user level
ranknumber✖️Position on the leaderboard
barColorstring✖️HEX XP bar color

📃 Discord.js v14 Example

const { AttachmentBuilder } = require('discord.js');
const { profileImage } = require('meta-discord');
await interaction.deferReply();
const user = interaction.options.getUser('user-option');
const buffer = await profileImage(user.id, {
  rankData: {
    currentXp: 2100,
    requiredXp: 3000,
    rank: 10,
    level: 20,
    barColor: '0b7b95'
  },
  ...imgOptions
});
const attachment = new AttachmentBuilder(buffer, { name: 'profile.png' });
interaction.followUp({ files: [attachment] });
client.on("channelCreate", (channel) => {
    console.log(`${channel} has been created`)
})

1️] Example

Default

profileImage('UserID', {
 customBadges: [  './skull.png', './letter.png', './rocket.png', './crown.png', './hearth.png'  ],
 borderColor: '#087996',
 presenceStatus: 'dnd',
 badgesFrame: true,
 rankData: {
   currentXp: 2100,
   requiredXp: 3000,
   rank: 10,
   level: 20,
   barColor: '0b7b95'
 }
});
PARAMETERTYPEREQUIREDDESCRIPTION
userIdstring✔️Discord User ID
serverNamestring✔️Discord Server Name
imgOptionsobject✖️Customize the card in multiple ways

🔴 imgOptions

PARAMETERTYPEDEFAULTDESCRIPTION
leavestringfalseChange to welcome or leave image
customBackgroundstring✖️Change the background to any image path and URL
usernameColorstring✖️Username HEX color
Colorstring✖️Text HEX color
borderColorstring or string[]✖️Border HEX color, can be gradient if 2 colors are used
borderAllignstringhorizontalGradient alignment if 2 colors are used
presenceStatusstring✖️User status to be displayed below the avatar
squareAvatarbooleanfalseChange avatar shape to a square

📃 Discord.js v14 Example

const { AttachmentBuilder } = require('discord.js');
const { welcomeImage } = require('meta-discord');
await interaction.deferReply();
const user = interaction.options.getUser('user-option');
const buffer = await welcomeImage(user.id,'Server Name',{
   leave:true,     //if leave image
  ...imgOptions
});
const attachment = new AttachmentBuilder(buffer, { name: 'profile.png' });
interaction.followUp({ files: [attachment] });
client.on("channelCreate", (channel) => {
    console.log(`${channel} has been created`)
})

1️] Example One Welcome Card

Default

welcomeImage('UserID','Meta Development');

2] Example One Leave Card

Default

welcomeImage('UserID','Meta Development',{
 leave: true
});

3] Example Two Welcome Card

Default

welcomeImage('UserID','Meta Development',{
     borderColor: '#5663EC',
     presenceStatus: 'dnd',
     squareAvatar: true
   });

4] Example Two Leave Card

Default

welcomeImage('UserID','Meta Development',{
     borderColor: '#5663EC',
     presenceStatus: 'dnd',
     squareAvatar: true,
     leave: true
   });

Requirements

  • Basic knowledge on JavaScript
  • Basic knowledge on Discord.JS (v14)
  • Basic knowledge on Node.JS

Credits