Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ultrax

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ultrax

UltraX Package is a unique package that allows you to create cool things using simple functions and events.

  • 2.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42
increased by35.48%
Maintainers
1
Weekly downloads
 
Created
Source

UltraX

UltraX

version build downloads

User-friendly functions and events that makes life easier
UltraX is a unique package that gives you multiple useful usages using functions and events.

NPM info

split

✘ Install

$ npm install ultrax

split

✘ Table of Content

  • Functions:

    • sleep() - A simple function that makes it easier to timeout in your code.

    • passGen() - Function to create passwords made by letters and numbers randomly with a specified length.

    • bin() - Function to bin code into a SourceBin.

    • buttonPaginator() - Function to create a paginator with buttons.

    • welcomeImage() - This function is used to create a welcome image using canvas, fully customizable and fast!

    • sussybaka() - Create a sussybaka image from an image url.

    • dababy() - Create a dababy image from an image url.

    • wikipedia() - A simple function to allow you to fetch a topic from Wikipedia and send an embed with the information.

    • boostImage() - Function that creates a booster card, using the French Noodles API.

    • remind() - Function to make remind command

  • Events:

    • reminder - This event fires when it's time to remind someone of a reminder created by the Remind Function.

    • inviteJoin - This event fires when a user joins by an invite link from another user, it provides information who joined, by what invite link and who made that invite link.

    • boost - This event emits when the server is boosted and returns the booster as GuildMember, with all data existing about it.

split

✘ Functions:

sleep

A simple function that makes it easier to timeout in your code.

(async () => {
  const  { sleep } = require('ultrax');

  console.log('Started!'); // => Logs "Started!"

  await sleep(2000); // => Waits 2 seconds

  console.log('Two seconds passed!'); // => Logs "Two seconds passed!"
})();

sleep(ms: Number)


passGen

Function to create passwords made by letters and numbers randomly with a specified length.

const  { passGen } = require('ultrax');

console.log(passGen(6));  // => NzA8YT

passGen(length: Number)


bin

Function to bin code into a SourceBin.

(async () => {
  const  { bin } = require('ultrax')

  if (!args[0]) return message.channel.send('What do you want to bin?');

  const url = await bin(args.join(' '));

  console.log(url) // => https://sourceb.in/bFD3tHt1vB
})(); 

bin(code: String)


buttonPaginator

Function to create a paginator with buttons.

Example:

const { buttonPaginator } = require('ultrax');
const { MessageEmbed, MessageButton } = 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");

const buttonBack = new MessageButton()
  .setStyle("DANGER")
  .setEmoji("◀");

const buttonForward = new MessageButton()
  .setStyle("SUCCESS")
  .setEmoji("▶");

await buttonPaginator(message, [embed1, embed2, embed3, embed4], [buttonBack, buttonForward]); // => Replies with a paginated embed to your message

buttonPaginator(message: Message, embeds: MessageEmbed[], buttons: MessageButton[])

buttonPaginator

welcomeImage

This function is used to create a welcome image using canvas, fully customizable and fast!

Example:

A nice welcome image function working inside of a guildMemberAdd event.

const { welcomeImage } = require('ultrax');

client.on('guildMemberAdd', async member => {
  const bg = 'https://imgur.com/okIR1iY.png';
  const avatar = member.user.displayAvatarURL({ format: "png" });
  const title = "welcome";
  const subtitle = member.user.tag;
  const footer = `You're the ${member.guild.memberCount}th member`;
  const color = '#ffffff';
  const channel = member.guild.channels.cache.get('716220553391767569')
  const options = {
    font: "sans-serif",
    attachmentName: `welcome-${member.id}`,
    title_fontSize: 80,
    subtitle_fontSize: 50,
    footer_fontSize: 30
  };

  const image = await welcomeImage(bg, avatar, title, subtitle, footer, color, options);

  channel.send({ files: [image] });
});

To use a custom font, you need to register your font, and give it a family name, after registering it, you can use the specified family name in the options. More information about registering fonts can be found here.

welcomeImage

Parameters:

ParameterTypeOptionalDescription
backgroundStringThe background for the welcome image
avatarStringThe avatar for the welcome image
titleStringThe title for the welcome image
subtitleStringThe subtitle for the welcome image
footerStringThe footer for the welcome image
colorStringThe color for the welcome image
optionsWelcomeImageSettingsOptionsThe options for the welcome image

welcomeImage(background: String, avatar: String, title: String, subtitle: String, footer: String, color: String, options: WelcomeImageSettingsOptions)


WelcomeImageSettingsOptions

ParameterTypeOptionalDefaultDescription
fontStringsans-serifThe font for the text in the welcome image
attachmentNameStringwelcomeThe name for the attachment that contains the welcome image
title_fontSizeNumber72 pixelsThe title's font size for the welcome image
subtitle_fontSizeNumber42 pixelsThe subtitle's font size for the welcome image
footer_fontSizeNumber32 pixelsThe footer's font size for the welcome image

{ font: String, attachmentName: String, title_fontSize: String, subtitle_fontSize: String, footer: String }


sussybaka

Create a sussybaka image from an image url.

Example

const { sussybaka } = require("ultrax");

client.on("messageCreate", async (message) => {
  if (message.content === "!sussybaka") {
    const image = await sussybaka(message.mentions.users.first()?.displayAvatarURL({ format: 'png' }) || message.author.displayAvatarURL({ format: 'png' }));

    return message.channel.send({ files: [image] });
  }
});

sussybaka(url: String)

sussybaka

dababy

Create a dababy image from an image url.

Example

const { dababy } = require('ultrax');

client.on("messageCreate", async (message) => {
  if (message.content === "!dababy") {
    const image = await dababy(message.mentions.users.first()?.displayAvatarURL({ format: 'png' }) || message.author.displayAvatarURL({ format: 'png' }));

    return message.channel.send({ files: [image] });
  }
});

dababy(url: String)

dababy

wikipedia

A simple function to allow you to fetch a topic from Wikipedia and send an embed with the information.

Example

const { Wikipeda } = require('ultrax') 

let query = 'earth'

const res = new Wikipedia({ 
	reply: message, // Use 'interaction' instead for any interaction based commands
	color: "RED",
	query: query
});

await res.send();

new Wikipedia({ message|interaction: Message, interaction: CommandInteraction, color: String, query: String })

wikipedia

boostImage

Function that creates a booster card, using the French Noodles API.

Example

A nice boost image function working inside of the Boost Event.

const { MessageEmbed } = require('discord.js');
const { boostImage, boost } = require('ultrax');
boost.init(client);

client.on('boost', async (booster) => {
  const channel = client.channels.cache.get('716239290350436423');
  const avatar = booster.user.displayAvatarURL({ format: 'png' });
  const boostCard = boostImage(avatar);

  let embed = new MessageEmbed()
    .setDescription(`${booster.user.toString()} boosted the server!`)
    .setImage(boostCard)
    .setColor('#FF39F8');
  channel.send({ embeds: [embed] });
});

boostImage(avatar: String)

boost

remind

Function to create a reminder, to actually triger something after the reminder triggers use the Reminder Event.

Example

const { remind } = require("ultrax");

const time = args[0];
const reason = args.slice(1).join(" ");

if (!time) return message.channel.send("Over how long do you want to be reminded?");
if (!reason) return message.channel.send("What do you want me to remind you of?");

remind(message.author.id, time, reason);
message.channel.send("Successfully set a reminder.");

split

✘ Events

Reminder Event

This event fires when it's time to remind someone of a reminder created by the Remind Function.

Example

const { reminder, connectToMongoDB } = require("ultrax")
connectToMongoDB('MONGO DB URL');
remind.init(client);

client.on('reminder', (userId, reason, time) => {
	const user = client.users.cache.get(userId);
  user.send(`You asked me \`${time}\` ago to remind you of: \`${reason}\``);
});

connectToMongoDB(url: String) remind.init(client: Client)

inviteLogger

This event fires when a user joins by an invite link from another user, it provides information who joined, by what invite link and who made that invite link.

Example:

const { inviteLogger } = require("ultrax");
inviteLogger.init(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} time(s) since its creation.`); // => Iliannnn#0001 joined using the invite code Dx7aRg7Q from UltraX#0001. Invite was used 1 time(s) since its creation.
});

inviteLogger.init(client)

Boost Event

This event fires when a user boosts the server and it provides information about the user who boosted the server, you can make you're boost message a bit more interesting using the boostImage Function.

Function:

Example:

const { boost } = require('ultrax');
boost.init(client);

client.on('boost', async (booster) => {
	const boostChannel = client.channels.cache.get('716239290350436423');

	boostChannel.send({ content: `${booster} boosted the server!` });
});

split

✘ 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 in our Discord server!

Keywords

FAQs

Package last updated on 26 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc