discord-embed-pages-selection
v1.3.8
Published
Swap embed pages using discord's selection option!
Downloads
22
Maintainers
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