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

dispage

v1.1.1

Published

The easiest and most customizable way to add discord.js an embed button page system to your bot.

Downloads

14

Readme

About

dispage is a powerful Node.js module that allows you to easily create button to switch over embed pages on a discord message.

Dependencies

Needs discord.js v14.6.0 or higher. If discord.js isn't installed yet :

npm install discord.js@latest

Installation

npm i dispage

Importing

Javascript

const Dispage = require('dispage')

Typescript

import Dispage from 'dispage';

Simple example

const embeds = [
    new MessageEmbed().setDescription('Embed #1'),
    new MessageEmbed().setDescription('Embed #2')
];
return new Dispage()
    .setEmbeds(embeds)
    .start(message)

Simple example

If you want to push things further...

const embeds = [
    'embed 1',
    'embed 2 !!',
    'embed 3 !?!',
    'embed 4 !!!!!!!!?'
].map((desc, i) => new Discord.EmbedBuilder()
    .setTitle(`📃 Page #${i + 1}`)
    .setColor('BLURPLE')
    .setDescription(desc))

new Dispage()
    .setEmbeds(embeds)
    // This style will be given to every button that doesn't have a specific style
    .setMainStyle('Secondary')
    .editButton('previous', { emoji: "824240081409540157", label: "Previous" })
    // Setting a property (here, style) to null will remove it. 👇
    .editButton('stop', { emoji: "961338862259544114", label: null })
    .editButton('next', { emoji: "824240024509874186", label: "Next" })
    // We can edit as many buttons as we want and as many times as we wish
    .editButton('stop', { style : "Success" })
    // You can create your own custom button
    .addButton({
        label: "Go to Message",
        style: "Link",
        url: "https://discord.com/channels/937626764916719626/937633296878293002/978956060972974101"
    })
    // Finally after having setup everything. We can start
    .start(message)

Page 1 Page 2

Properties

Instead of (for example) setting index to 1 by hand. Use the build-in (setIndex) method. Same for embeds (.setEmbeds), ended (.end()), duration (.setDuration) etc..

| Property | Type | Default Value | | ------------- | ----------------------------------------- | ------------------------ | | client | Client | null | | index | number | 0 | | embeds | Embed[] | [] | | message | Message | null | | interaction | Interaction | null | | collector | InteractionCollector<ButtonInteraction> | null | | reply | Message | null | | ended | boolean | false | | started | boolean | false | | deleted | boolean | false | | duration | number | 60000 | | mainStyle | MessageButtonStyle | "PRIMARY" | | buttons | MessageButtonOptions[] | MessageButtonOptions[] |

Methods

On the Return column, this means that the methode returns the original instance of the class. Like discord.js's MessageEmbed where we can call multiple times multiple methods following themselves. Like this: new Dispage().setMainStyle('SECONDARY').setIndex(2) etc..

PS: ⚠ MEANS [DEPRECATED] (Meaning you shouldn't use it anymore)

| Name | Arguments | Return | | :-------------------: | :----------------------------: | :------------------------: | | setMainStyle | MessageButtonStyle | this | | showDisabledButtons | boolean | this | | removeUser | User | this | | addUser | User | this | | setUser | User | this | | addButton | MessageButtonOptions | this | | removeButton | string | this | | editButton | string, MessageButtonOptions | this | | getRows | boolean | MessageActionRow[] | | setEmbeds | Embed[] | this | | addEmbed | Embed | this | | addEmbeds | Embed[] | this | | _fixEmbeds | Embed[] / Embed / Embed[][] | Embed[] | | setDuration | number | this | | addDuration | number | this | | next | ❌ | Promise<this> | | previous | ❌ | Promise<this> | | changeToPage | number | Promise<Message> | | doesIndexExist | number | boolean | | setIndex | Number | this | | edit | MessageEditOptions | Promise<Discord.Message> | | disableButtons | ❌ | void | | end | ❌ | void | | delete | ❌ | void | | update | ❌ | void | | getOpts | Boolean | MessageOptions | | isMessage | ❌ | boolean | | isInteraction | ❌ | boolean | | canEdit | ❌ | boolean | | isValidCtx | Context | boolean | | checkForErrors | Context | string[] | | start | Context | Promise<this> |

Trouble

Having a problem using dispage ? Open an issue on Github & Don't hesitate to send a message to the discord tag below 👇 !

Credits

Made by voxlinou1 (Vox#6198 on discord)