// For HTTP Requests var http = require('unirest'); let boardList=[] let embed = [] let pages =[] const { MessageEmbed, MessageButton } = require("discord.js"); const { Pagination } = require("pagination.djs"); require("dotenv").config(); exports.run = async (client, interaction) => { const pagination = new Pagination(interaction, { firstEmoji: "⏮", // First button emoji prevEmoji: "◀️", // Previous button emoji nextEmoji: "▶️", // Next button emoji lastEmoji: "⏭", // Last button emoji limit: 2, // number of entries per page idle: 30000, // idle time in ms before the pagination closes ephemeral: false, // ephemeral reply prevDescription: "", postDescription: "", buttonStyle: "SECONDARY", loop: false, // loop through the pages }); // eslint-disable-line no-unused-vars await interaction.deferReply(); // const reply = await interaction.editReply("Ping?"); // await interaction.editReply(`Pong! Latency is ${reply.createdTimestamp - interaction.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms.`); var Request = http.get('https://board.grwh.work/jsonrpc.php').headers({ Accept: 'application/json', 'Content-Type': 'application/json' }).send({ "jsonrpc": "2.0", "method": "getAllProjects", "id": 0 }); Request.auth({ user: 'jsonrpc', pass: process.env.KANBOARD_API_KEY, sendImmediately: false }).then(function (response) { let data = response.body.result const pusherFunc = board=>boardList.push({name:"Project Name", value:board.name + "\nID: " + board.id + "\n" + "https://board.grwh.work/board/" + board.id}); data.forEach(pusherFunc); console.log(boardList) pagination.setTitle("Project List"); pagination.setDescription("This is a list of all currently active projects."); pagination.setColor("#00ff00"); pagination.setFooter("Boards:"); pagination.setTimestamp(); pagination.addFields(boardList); pagination.paginateFields(true); pagination.render(); }) }; exports.commandData = { name: "list", description: "Lists all of the current projects", options: [], defaultPermission: true, }; // Set guildOnly to true if you want it to be available on guilds only. // Otherwise false is global. exports.conf = { permLevel: "User", guildOnly: false };