diff --git a/config.yml b/config.yml index 6c29576..c7eda19 100644 --- a/config.yml +++ b/config.yml @@ -52,10 +52,15 @@ embed: button: enable: true # Enable or disable buttons in messages. row1: - - label: "Panel" + - label: "Panel" # Label for the first button. url: "https://panel.example.com" # URL for the first button. -# - label: "Dashboard" # Uncomment to add a second button. -# url: "https://dash.example.com" # URL for the second button. +# - label: "Dashboard" # Remove "#" at the start of the line to use this button +# url: "https://dash.example.com" # Remove "#" at the start of the line to use this button +# row2: # Remove "#" at the start of the line to use this row +# - label: "Backup Panel" +# url: "https://panel2.example.com" +# - label: "Backup Dashboard" +# url: "https://dash2.example.com" # Status Message Configuration # For details on using custom emojis, visit: https://github.com/HirziDevs/PteroStats#using-custom-emoji diff --git a/index.js b/index.js index dc92355..8250a8f 100644 --- a/index.js +++ b/index.js @@ -191,17 +191,20 @@ async function createMessage({ cache, panel, nodes, servers, users }) { const components = [] - if (config.button.enable && config.button.row1?.length > 0) { - components.push( - new ActionRowBuilder().addComponents( - config.button.row1.map(button => - new ButtonBuilder() - .setLabel(button.label) - .setURL(button.url) - .setStyle(ButtonStyle.Link) - ) - ) - ) + if (config.button.enable) { + for (const row of ["row1", "row2", "row3", "row4", "row5"]) { + if (config.button[row] && config.button[row].length > 0 && config.button[row].label && config.button[row].url) + components.push( + new ActionRowBuilder().addComponents( + config.button[row].slice(0, 5).map(button => + new ButtonBuilder() + .setLabel(button.label) + .setURL(button.url) + .setStyle(ButtonStyle.Link) + ) + ) + ); + } } try {