⎛ℹ️⎞ About
UltraX Package is a unique package made by UltraX that allows you to create cool things using simple functions and make it faster, for example there is an invite logger, discord buttons paginator, etc...
⎜📥⎟ Installation
To install UltraX package you need:
Then you can open your application's terminal and type:
$ npm install ultrax
⎜➡️⎟ Usage
The available functions are:
-
sleep
- Functions that creates timeout easily and fast.
-
passGen
- Function to create passwords made by letters and numbers randomly with specified length.
-
bin
- Function that allows you to bin codes.
-
ButtonPaginator
- Function to create embed pages using buttons easily.
-
welcomeImage
- Function that creates a welcome image fully customizable using canvas.
Events:
Functions:
sleep
sleep is a simple function, where is make it easier and faster to make a timeout in your code.
Example:
const ultrax = require('ultrax')
const sleep = ultrax.sleep
console.log('Start!')
sleep(5000)
console.log('5 Seconds passed')
passGen
this is a simple function that can generate passwords using letters and numbers and the password length is custom so you can change it to any length you want!
Example:
const ultrax = require('ultrax')
const passGen = ultrax.passGen
console.log(passGen(6))
Bin
This is a way to bin a code.
Example:
const ultrax = require('ultrax')
if (!args.join(' ')) return message.channel.send('What do you want to bin?');
else {
const bin = await ultrax.bin(args.join(' '));
console.log('Here i binned the code ' + bin)
}
Button Paginator
Button Paginator function allows you to create embed pages easily and fast.
styles are:
-
red
-
grey
-
blurple
-
green
-
url
Example:
const ultrax = require('ultrax')
const { MessageEmbed } = require("discord.js")
const embed1 = new MessageEmbed()
.setTitle("1st page embed");
const embed2 = new MessageEmbed()
.setTitle("2nd page embed");
const embed3 = new MessageEmbed()
.setTitle("3rd page embed");
const embed4 = new MessageEmbed()
.setTitle("4th page embed");
await ultrax.ButtonPaginator(message, [embed1, embed2, embed3, embed4], [{
style: 'green',
label: 'back',
id: 'back'
},
{
style: 'blurple',
label: 'next',
id: 'next'
}
]);
welcomeImage
This function is used to create a welcome image using canvas, fully customizable and fast!
The function returns a Promise to Buffer the image and make it an Attachment, so you need to await it.
await welcomeImage()
As we mentioned before its fully customizable, so lets see the parameters and the options available.
Parameters:
- background
- avatar
- text_1 (Title)
- text_2 (Subtitle)
- text_3 (Footer)
- color
Options:
font
{default: "San Serif"}attachmentName
{default: "welcome"}
So now lets talk about the correct Syntax for it!
await welcomeImage(background, avatar, text_1, text_2, text_3, color)
The background must be a PNG image's URL.
As example this URL:
https://cdn.discordapp.com/attachments/850808002545319957/859359637106065408/bg.png
The color must be a HEX color's code.
As example this HEX:
#FFFFFF
In case you will use the options:
await welcomeImage(background, avatar, text_1, text_2, text_3, color, {font: "Your Font", attachmentName: 'Hello'})
the attachmentName
is always PNG, so whatever name you will put it will end with .png
as example Hello.png
To use custom fonts, you need to install the font (ttf/otf) yourself and use registerFont()
to register the font and be able to use it.
Example:
const { registerFont } = require('canvas')
registerFont('ShadowsIntoLight-Regular.ttf', { family: "Shadows Into Light" });
After all these explanations and examples, lets see a full and nice welcome image function working inside of an guildMemberAdd
event!
Example:
const ultrax = require('ultrax')
const { registerFont } = require('canvas')
registerFont('ShadowsIntoLight-Regular.ttf', { family: "Shadows Into Light" });
Client.on('guildMemberAdd', async member => {
let bg = 'https://cdn.discordapp.com/attachments/850808002545319957/859359637106065408/bg.png'
let avatar = member.user.displayAvatarURL({ format: "png" })
let text1 = "welcome"
let text2 = member.user.tag
let text3 = `You're the ${member.guild.memberCount}th member`
let color = '#ffffff'
const options = {
font: "Shadows Into Light",
attachmentName: `welcome-${member.id}`
}
const image = await ultrax.welcomeImage(bg, avatar, text1, text2, text3, color, options)
})
Events:
Invite Logger Event
This event is for logging invite uses. This is same as guildMemberAdd
event but this is custom event which has 3 parameters:
Example:
const ultrax = require("ultrax")
const discord = require('discord.js')
const client = new discord.Client()
ultrax.inviteLogger(client)
client.on('inviteJoin', (member, invite, inviter) => {
console.log(`${member.user.tag} joined using invite code ${invite.code} from ${inviter.tag}. Invite was used ${invite.uses} times since its creation.`)
});
⎝🔶⎠ Contact us
In case you have idea's to improve the package, or maybe you found some bugs or you need help, you can contact us from our discord server!
![]()
