[core](paginator) custom button system

This commit is contained in:
derpystuff 2022-06-07 15:16:47 +02:00
parent 72828b408f
commit 6526b79c86
3 changed files with 46 additions and 41 deletions

View file

@ -1,4 +1,5 @@
const { Constants } = require('detritus-client');
const { InteractionCallbackTypes } = require('detritus-client/lib/constants');
const { paginator } = require('../../../../labscore/client');
const createEmbedMessage = (title, description) => ({
@ -20,9 +21,18 @@ module.exports = {
createEmbedMessage("Page2", "eee"),
createEmbedMessage("Page 3", "h")
]
const paging = await paginator.createPaginator({
const buttons = ["previous","next", {customId: "german", emoji: `<:german:856501761857683486>`, style: 4}]
const page = await paginator.createPaginator({
context,
pages
pages,
buttons
});
// Custom button example, event only triggers for
page.on("interaction", async (e) => {
if(e.context.customId == "german"){
await e.context.respond(InteractionCallbackTypes.UPDATE_MESSAGE, {"content": "german button activated"})
}
})
},
};