diff --git a/module.json b/module.json
index 51f9790..fc17512 100644
--- a/module.json
+++ b/module.json
@@ -2,7 +2,7 @@
"id": "duality-roller",
"title": "Daggerheart Duality Dice Roller",
"description": "Adds a button next to the chat dice/controls that triggers the /dr command for the Foundryborne Daggerheart system.",
- "version": "0.1.5",
+ "version": "0.1.6",
"compatibility": {
"minimum": "13",
"verified": "13"
@@ -16,5 +16,5 @@
"languages": [],
"url": "https://github.com/cptn-cosmo/DualityDiceRoller",
"manifest": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/latest/download/module.json",
- "download": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/download/0.1.5/duality-roller.zip"
+ "download": "https://github.com/cptn-cosmo/DualityDiceRoller/releases/download/0.1.6/duality-roller.zip"
}
diff --git a/scripts/dr-button.js b/scripts/dr-button.js
index ccd5c22..099b14a 100644
--- a/scripts/dr-button.js
+++ b/scripts/dr-button.js
@@ -15,28 +15,31 @@ Hooks.on("renderChatPopout", (_app, _html) => addDRButton());
function addDRButton() {
try {
- const container = document.createElement("div");
- container.className = "dr-quick-button-container";
-
- // Build button
- const btn = document.createElement("button");
- btn.type = "button";
- btn.className = "ui-control icon fas-solid dr-quick-button";
- btn.title = "Duality Dice Roll";
- btn.setAttribute("aria-label", "Duality Dice Roll");
-
- // Inline SVG (or use icon.src = "modules/dr-quick-button/icons/dr.svg"; if external)
- btn.innerHTML = `
- `;
- btn.addEventListener("click", async () => {
- await runDRCommand();
- });
-
- container.appendChild(btn);
-
- // Find all roll-privacy divs and append the button
+ // Find all roll-privacy divs and append one button per container, avoiding duplicates
const rollPrivacyDivs = document.querySelectorAll("#roll-privacy");
- rollPrivacyDivs.forEach(div => div.appendChild(container));
+ rollPrivacyDivs.forEach(div => {
+ // If this container already has our button, skip adding another
+ if (div.querySelector(".dr-quick-button-container")) return;
+
+ const container = document.createElement("div");
+ container.className = "dr-quick-button-container";
+
+ // Build button
+ const btn = document.createElement("button");
+ btn.type = "button";
+ btn.className = "ui-control icon fas-solid dr-quick-button";
+ btn.title = "Duality Dice Roll";
+ btn.setAttribute("aria-label", "Duality Dice Roll");
+
+ // Inline SVG (or use icon.src = "modules/dr-quick-button/icons/dr.svg"; if external)
+ btn.innerHTML = `
`;
+ btn.addEventListener("click", async () => {
+ await runDRCommand();
+ });
+
+ container.appendChild(btn);
+ div.appendChild(container);
+ });
} catch (err) {
console.error("DR Quick Button | addDRButton error:", err);