1.2.1 • Published 3 years ago
iapg v1.2.1
❔ iapg
A simple npm package to configure and enhance the ways on coding your discord bot. Compatible with discord.js v12 but it should also work on older versions. Variety of different usages for this api.
🛠 Usages (Click on it for more info on how to use it)
- ReactionPages - simple pagination to make your "MessageEmbed" interactable.
- flip - flip your text horizontaly & verticaly
- calculator - create a usable calculator in discord
🔧 Thingy's
1️⃣ ReactionPages
Constructor :
ReactionPages(message, pages, textPageChange, emojis, time);
// message* : message constructor
// pages*: array that contains your pages (embeds). eg: const pages = [embed1, embed2]
// textPageChange*: boolean that when is true, make that the user can change pages by sending a message
// emojis*: array that contains 2 emojis that switch pages (left, right). eg: ["⏪", "⏩"]
// time*: time in ms on how much time the embed should be interactable (default 60000 so 60s). eg: 30000 (30s)
// * you can change the names of the variable
Example :
const iapg = require("iapg");
const ReactionPages = iapg.ReactionPages;
const { MessageEmbed } = require("discord.js");
module.exports.run = async (client, message, args) => {
// May be different for you
const embed1 = new MessageEmbed().setTitle("Page 1");
const embed2 = new MessageEmbed().setTitle("Page 2");
// Create an array of embeds.
const pages = [embed1, embed2];
// Change pages when sending numbers.
const textPageChange = true;
// Create the emoji array (left, right)
const emojis = ["⏪", "⏩"];
// Time on how long you want the embed to be interactable
const time = 30000;
ReactionPages(message, pages, textPageChange, emojis, time);
};
2️⃣ flip
Example :
const iapg = require("iapg");
// or you can destructure it : const { flip } = require("iapg");
module.exports.run = async (client, message, args) => {
message.channel.send(iapg.flip("iapg"));
};
// Output :
// ƃdɐᴉ
3️⃣ calculator
Example :
const iapg = require("iapg");
// or you can destructure it : const { calculator } = require("iapg");
module.exports.run = async (client, message, args) => {
await iapg.calculator(message);
};