1.0.6 • Published 3 years ago

gamemax.paginator v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

                                                          node.js Star Discord Donate

♻️ Plugin installation:

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()

❓ Example to use:

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

🔓 Plugin customization:

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 the execute parameter you want something to be displayed in the console. We indicate callback in execute example text and in the imports we include our text ["Hello bro"]

🎉 Events

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 - Returns true if everything worked successfully

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago