1.5.1 • Published 2 years ago

utilityxtreme v1.5.1

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

UtilityXtreme is a library that simplifies of creating your own Discord bot application.

  • Easy to use & Beginner friendly.
  • 99.9% Promise based.
  • Supportable with latest discord.js version (v14).
  • Open-source project.
  • Feature-rich.
  • 100% written in TypeScript.

Table of Contents

Requirements

Optional:

  • Use TypeScript instead of JavaScript for the typings.
  • Use an IDE with a powerful Intellisense (example: Visual Studio code) for the typings.

Installation

npm install utilityxtreme
yarn add utilityxtreme

Documentation

Warn: This package is focused on declaration files, any comments are not going to be defined in the documentation site.

Click here to visit the documentation website.

Modules preview

  • Modules
    • Classes
      • ApplicationCommandsLoader: Loads application commands to Discord.
      • BoostDetector: Detects whenever a guild member has boosted or has removed a boost from a guild.
      • ButtonsPaginatorBuilder: An advanced paginator using buttons.
      • Calculator: A simple and pre-ready calculator (mathjs not required).
      • FileBuilder: Creates a file for Discord, by using Buffer.
      • JSONDatabase: The methods are similar to Map but the data is saved in a JSON file.
      • StringSelectMenuPaginatorBuilder: An advanced paginator using dropdown/select menus.
    • Functions
      • calculateString: Calculates some simple math equations.
      • censorString: Replaces some characters in a string with '*' (changeable).
      • createDiscordTimestamp: Creates a Discord timestamp.
      • hexColorGen: Generates a random HEX color code.
      • idGen: Generates a random integer.
      • isDiscordInviteURL: Detects whenever a string includes a Discord invite URL.
      • isWebURL: Detects whenever a string includes any web URL.
      • randomizedString: Generates some random characters.
      • reverseString: Reverses a string.
      • async sleep: Sleeps for a specific time.

Example Discord Bot

TypeScript:

import { Client, SlashCommandBuilder } from 'discord.js';
import { ApplicationCommandsLoader } from 'utilityxtreme';

const botToken = "Your bot token";
const botId = "Your bot id";

const client: Client = new Client({
    intents: ['Guilds']
});

const commands: SlashCommandBuilder[] = [
    new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!')
];

const loader: ApplicationCommandsLoader = new ApplicationCommandsLoader(botToken, botId, commands);

loader.on('loaderStarted', () => { console.log('Started loading application commands...') });
loader.on('loaderFinished', () => { console.log('Finished loading application commands.') });

loader.start().catch(console.error);

client.on('interactionCreate', async (interaction) => {
    if (!interaction.isChatInputCommand()) return;

    if (interaction.commandName === 'ping') {
        await interaction.reply({ content: 'Pong!' });
    };
});

client.login(botToken);

JavaScript: (CommonJS)

const { Client, SlashCommandBuilder } = require('discord.js');
const { ApplicationCommandsLoader } = require('utilityxtreme');

const botToken = "Your bot token";
const botId = "Your bot id";

const client = new Client({
    intents: ['Guilds']
});

const commands = [
    new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!')
];

const loader = new ApplicationCommandsLoader(botToken, botId, commands);

loader.on('loaderStarted', () => { console.log('Started loading application commands...') });
loader.on('loaderFinished', () => { console.log('Finished loading application commands.') });

loader.start().catch(console.error);

client.on('interactionCreate', async (interaction) => {
    if (!interaction.isChatInputCommand()) return;

    if (interaction.commandName === 'ping') {
        await interaction.reply({ content: 'Pong!' });
    };
});

client.login(botToken);

Developers

Support

Did you find a problem (or a bug), or want to share some new ideas? Join the Discord server below!

You can create an Issue or a Pull Request instead on GitHub.

Other information

License:

This project is under the license GPL-3.0.

Development:

This package is not associated with the discord.js development team.

↑ Back to top

1.5.1

2 years ago

1.5.0

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago