npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

discordjs-helper-pack

v1.1.3

Published

Classes written to help discordjs developers.

Downloads

179

Readme

Discordjs Helper Pack

A helper library that shortens the classes and actions in the Discordjs library. Documents for installing and using npm are available below. It is an open source library.

| Class | Corresponding | | ------- | ------- | | Configuration | Commands file,Prefix Commands File, Events file and isChatInputCommand() - (type: function) | | Tools | ItentsAll-> Receives all intents | | TextSelectBox | StringSelectMenuBuilder, StringSelectMenuOptionBuilder | | UserSelectBox | UserSelectMenuBuilder | | Button | ButtonBuilder, ButtonStyle | | ButtonAction | Collector Action | | Modal | ModalBuilder, TextInputBuilder, TextInputStyle | | ModalAction | interactionCreate and isModalSubmit Action | | MessageSender | EmbedBuilder | | ActionRow | ActionRowBuilder() and addComponents() - (type: function) | | Command | SlashCommandBuilder | | Event | Event action | | Affix | Prefix Command | | EmojiReact | messageReaction Event | | Crumbs | Helper functions |

Set up:

npm i discordjs-helper-pack

Configuration Example:

const { Configuration } = require('discordjs-helper-pack') 

Configuration({
	// incessary information
	client: client,
	dirname: __dirname,

	commandsFileName: 'commands', // commands file
	eventsFileName: 'events', // events file
	chatInputCommand: true, // command interaction
	
	//prefix configurations
    prefix: 'm!',
    prefixCommandsFileName: 'prefixCommands'
})

Tools Examples:

const { Tools } = require('discordjs-helper-pack') 
const { ItentsAll } = new Tools()

new Client({
	intents: ItentsAll()
})

TextSelectBox Example:

const { TextSelectBox } = require('discordjs-helper-pack')

const { ActionRow } = require('discord-helper-pack')

# customId, title
const textbox = new TextSelectBox('horoscope','Horoscope')

default: label, value
textbox.add(label, value, description, boxDefault, emoji)
textbox.add('Aquarius', 'aquarius', 'choose Aquarius')

const select = textbox.build()

// irrelevant
ActionRow(select)

UserSelectBox Example:

const { UserSelectBox } = require('discordjs-helper-pack')

default: customId, description
const select = new UserSelectBox(customId, description).build()
const select = new UserSelectBox(customId, placeholder, max, min, disabled,setUsers,addUsers).build()

Button Example:

const { Button } = require('discordjs-helper-pack')

const button = new Button()

default value: customId, label, buttonStyle
btn.add()

// example
btn.add("example", "this is a example", btn.style.Secondary)

// and others values
emoji, disabled
btn.add("example", "this is a example", btn.style.Secondary, "emoji", true)

const btns = btn.build()

// use example
i.reply({components: [btns]})

ButtonAction Example:

const { ButtonAction } = require('discordjs-helper-pack')

const action = new ButtonAction(interaction)
action.on(async (interaction)=>{
    if(interaction.customId==="btn1"){
        await interaction.reply('btn1 clicked!')
    }
})
action.end(async (interaction)=>{})

Modal Example:

const { Modal } = require('discordjs-helper-pack')

new Modal(customId, title)

default: customId, label
.add(customId, label)

// other
.add(customId, label, value, {paragraph, required, placeholder, max, min})

// example
const modal = new Modal('user', 'User İnformation')

modal.add('firstname', 'First Name')
modal.add('lastname', 'Last Name')

// ready
const built = modal.build()


interaction.showModal(built)
// oth
interaction.showModal(modal.build())

ModalAction Example:

const { ModalAction } = require('discordjs-helper-pack') 
new ModalAction()
.on(async(interaction)=> {})

// Real Example
const modalAction = new ModalAction()

modalAction.on(async(interaction)=>{
	if(interaction.customId == "userform"){
		// codes
	}
})

ActionRow Examples:

const { ActionRow } = require('discord-helper-pack')

ActionRow(components)

ActionRow(btn1, btn2, btn3)

Command Examples:

const { Command } = require('discordjs-helper-pack') 

const c = new Command(command name, command description)
c.command.addRoleOption() // SlashCommandBuilder features 
c.build(async(interaction)=>{}) // function

// example
module.exports = new Command('command name', 'command description')
.build(async (interaction)=>{
	await interaction.reply('oldu')
})

Event Examples:

const { Event } = require('discordjs-helper-pack') 

once: default value = false
new Event('event name', once?)
.build(async(client, event)=>{})

new Event('ready', true).build(async(client, event)=>{})

Affix Examples:

const { Affix } = require('discordjs-helper-pack') 

module.exports = new Affix('Test Command', description?, usage?)
.build('test', async (message, helper)=>{})

enabled default value: true
.build(commandName, func, enabled)

// helper features
.client => client
.getUser() => message.author.id
.getArgs() => message.content.split(' ')
.bot() => message.author.bot

EmojiReact Example:

new EmojiReact(content or embed, channelId, client)
.build(emoji, addFunc, removeFunc, updateFunc)

// example
new EmojiReact(content or embed, channelId, client)
.build('🦁', async(reaction, user)=>{}, async(reaction, user)=>{}, async(reaction, user)=>{})

Crumbs Example:

const { Crumbs } = require('discordjs-helper-pack')


const crumbs = new Crumbs()

crumbs.randomColor() // random color function