1.0.3 • Published 2 years ago
discord-pager-lifeng v1.0.3
discord-pager-lifeng87
Create page with discord message
Install
npm i discord-pager-lifeng
Preview
Example
const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
const { Pager } = require("discord-pager-lifeng87")
const { token } = require('./config.json');
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
] });
const pager = new Pager({
client:client
});
const pageEmbeds = [
{
embeds:[
new EmbedBuilder()
.setDescription("1")
.setColor("Aqua")
]
},
{
embeds:[
new EmbedBuilder()
.setDescription("2")
.setColor("Aqua")
]
},
{
embeds:[
new EmbedBuilder()
.setDescription("3")
.setColor("Aqua")
]
},
{
embeds:[
new EmbedBuilder()
.setDescription("4")
.setColor("Aqua")
]
},
{
embeds:[
new EmbedBuilder()
.setDescription("5")
.setColor("Aqua")
]
}
]
client.on('messageCreate', async (message) => {
if(message.content.startsWith('?test')){
const replyMsg = await message.reply(pager.createInitPage(pageEmbeds));
await replyMsg.edit(pager.runPage(replyMsg.id, pageEmbeds));
}
});
client.once('ready', () => {
console.log('Ready!');
});
client.login(token);