Check out plugin initialization and configuration below!
Click on a badge to learn more.
Installation • Download • How to use? • Customization
Plugin initialization looks like this:
const plugin = require("gamemax.paginator");
[...]
You can initialize the plugin to a global variable, which makes the plugin more accessible to you.
require("gamemax.paginator").init(<object>); // Specify your variable (object)
// After that, the plugin will be available along this path:
new <object>.paginator()
You can also change the name of the element, for example:
require("gamemax.paginator").init(<object>, "example");
// After that, the plugin will be available along this path:
new <object>.example()
const { Pages } = require("gamemax.paginator");
const page = new Pages(message.author.id); // Collector filter.
page.add("Hello"); // You can also specify an array with text: page.add([ "Hello", "Hello 2", etc. ]);
page.create(message.channel); // send message
You can customize the plugin by adding your own emoji, functions, and custom checks.
new plugin(message.author.id, [
{ emoji: "📌", execute: (channel) => channel.send("This is custom reaction!"), imports: [message.channel] },
{ emoji: "👀", execute: (text) => console.log(text), imports: ["This text will be printed to the console."] }
/* etc.. */
], 60000); // Collector running time in ms
And so, let's now tell you in detail what is responsible for what.
-
emoji
- Emoji that will be placed and perform your further action. -
execute
- The function that will execute when you click on your 'custom' reaction. -
imports
- Required parameters to run the function. They must be in an array or you will get an error. For example, in theexecute
parameter you want something to be displayed in the console. We indicate callback inexecute
exampletext
and in the imports we include our text["Hello bro"]
You can control user actions using our events.
let page = new Pages(message.author.id);
page.on("create", (data) => console.log(data))
Available events:
-
create
- Returns an object with message and collector content -
add
- Returns a string (or writing). Fires when using the<page>.add()
function -
update
- Will return the object on page refresh -
select
- Returns an object containing the page you selected and its content. -
end
- Returnstrue
if everything worked successfully