discord-button-embed
v2.0.3
Published
discord-button-embed is a package that allows users to easily create multiple embeds with buttons.
Downloads
17
Maintainers
Readme
discord-button-embed is a package that allows users to easily create multiple embeds with buttons.
How to use 📃
Importing 🐱👤
var Discord = require("discord.js");
const Buttons = require("discord-buttons");
const ButtonsEmbed = require("discord-button-embed");
const Client = new Discord.Client();
Buttons(Client);
ButtonsEmbed(Client);
Discord.MessageButton = Buttons.MessageButton;
Discord.MessageActionRow = Buttons.MessageActionRow;
Method 📚
(method) ExtendTextChannel.page(author: string, options?: {
embeds?: any[];
buttons?: {
id?: string;
emoji?: string;
label?: string;
style?: string;
url?: string;
}[];
timeout?: string | number;
disable?: boolean;
onlyURL?: boolean;
}): Promise<void>
- disable - So that the buttons still remain. Default: false, means the buttons will removed.
- onlyURL - So that only the URL Button remains. Default: false, means the buttons still the same. LOL
Example 🐱🐉
var embeds = [], buttons = [];
const desc = [1, 2, 3, 4, 5, 6];
for (var i = 0; i < desc.length; i++) {
const embed = new Discord.MessageEmbed();
embed.setDescription(`ID: ${desc[i]}`);
embeds.push(embed);
}
for (var i = 0; i < desc.length; i++) {
const button = { id: `btn_${desc[i]}`, label: `BTN: ${desc[i]} `, style: "green" };
buttons.push(button);
}
const url = { label: "Google", style: "url", url: "https://google.com" };
buttons = [...buttons, url];
message.channel.page(message.author.id, {
embeds: embeds,
buttons: buttons
});
- URL buttons must be on the last index of btn array.