1.3.8 • Published 3 years ago

discord-embed-pages-selection v1.3.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

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

1.2.8

3 years ago

1.2.7

3 years ago

1.3.8

3 years ago

1.2.12

3 years ago

1.2.13

3 years ago

1.2.10

3 years ago

1.2.11

3 years ago

1.2.16

3 years ago

1.2.17

3 years ago

1.2.14

3 years ago

1.2.15

3 years ago

1.2.18

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.21

3 years ago

1.2.22

3 years ago

1.2.9

3 years ago

1.2.0

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.1.4

3 years ago

1.2.2

3 years ago

1.1.3

3 years ago

1.2.1

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago