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

discord-embed-pages-selection

v1.3.8

Published

Swap embed pages using discord's selection option!

Downloads

20

Readme

Discord-Embed-Pages-Selection

Swap embed pages using discord's selection option!

Functions:

There is only one function in this package:

menupages.pageSelect(message, arrayOfSelectionData, arrayOfEmbeds, settings)

message:

This is your discord message.

arrayOfSelectionData:

This is an array of the menu options data. (See example at the bottom of the page)

Advanced option: You can add a linked page to each selection data, this is useful for having multiple selections go to the same page, or creating a home page that cannot be returned to when left.

Example:

{
    "name": "PAGE 1",
    "description": "PAGE 1",
    "emoji": {
      "name": "🧀",
      "animated": false
    },
    "linkedPage": 10
  }

Note: The number is the INDEX of the array of embeds.

Note+: Adding the linked page to one selection data may require you to relink all the different selection datas to their respective embeds.

arrayOfEmbeds:

This is an array of Discord Message Embeds

settings:

This is a JSON of settings. Valid settings:

ephemeral: A string of what the bot should respond with when another user tries to use the page embed other than the user who created it. (Set to false to disable) [Optional, Default Value: "You do not own this embed!"]

timeout: A time (in milliseconds) after which the bot should stop responding to that embed page [Required, Default Value: 60*1000 (60 seconds)]

placeholder: A string of what the menu should display when no option has been selected [Required, Default Value: "Click To Select Page!"]

message: A string to display above the embed. (Set to false to disable) [Optional, Default Value: false]

extraRows: An array of MessageActionRows that will be displayed beneath the selection menu. Useful for having a button to take you to the bots invite. [Optional, Default Value: []]

extraPos: A string of where the extra rows should appear relative to the selection embed. Options are above or below. [Optional, Default Value: "below"]

buttons: A JSON of data regarding page turning buttons. [Required, Default Value: false]

Example:

{
                delete: {
                    style: "red",
                    emoji: "❌",
                    text: "Delete"
                },
                forward: {
                    style: "green",
                    emoji: "⏩",
                    text: "Forward"
                },
                backward: {
                    style: "green",
                    emoji: "⏪",
                    text: "Backward"
                }
            }

buttonsPos: A string of where the buttons that move through the embed pages should be located relative to the selection menu. Valid options are above or below. [Required, Default Value: "above"]

Example:

const Discord = require("discord.js");
const disbut = require("discord-buttons");
const menupages = require("discord-embed-pages-selection");

const client = new Discord.Client();
disbut(client);

client.login(process.env.token);

client.on("message", async message=>{
  if(message.author.bot || message.channel.type == "dm")return;
  if(message.content == "selectionEmbed"){
    const embed = new Discord.MessageEmbed()
    .setColor("YELLOW")
    .setTitle("PAGE 1")
    
    const embed2 = new Discord.MessageEmbed()
    .setColor("GREEN")
    .setTitle("PAGE 2")
    
    menupages.pageSelect(message,[
  {
    "name": "PAGE 1",
    "description": "PAGE 1",
    "emoji": {
      "name": "🧀",
      "animated": false
    }
  },
  {
    "name": "PAGE 2",
    "description": "PAGE 2",
    "emoji": {
      "name": "😳",
      "animated": false
    }
  }
],[embed, embed2], {
  timeout: 60*1000,
  placeholder: "CLICK TO SELECT PAGE",
  ephemeral: "YOU DO NOT OWN THIS EMBED",
  message: "USE THE SELECTION PAGE BELOW TO CHANGE PAGE",
  extraRows: [],
  extraPos: "below"
})
  }
})

Support

Join the discord for support and for other packages/discord bots:

https://discord.gg/u9gFdnu