if (messageText === "/combatcheck") {
// Prompt for additional input
// Define a function to display the dialog and return the input
async function getAdditionalInput() {
return new Promise((resolve) => {
// Unique identifier for the input
const uniqueId = `additional-input-${new Date().getTime()}`;
let dialog = new Dialog({
title: "Additional Input",
content: `<p>Enter additional flags/commands:</p><input type='text' id='${uniqueId}'/>`,
buttons: {
ok: {
icon: "<i class='fas fa-check'></i>",
label: "Submit",
callback: (html) => resolve(html.find(`#${uniqueId}`).val())
},
cancel: {
icon: "<i class='fas fa-times'></i>",
label: "Cancel",
callback: () => resolve(null)
}
},
default: "ok",
close: () => resolve(null)
});
// Render the dialog
dialog.render(true);
});
}
const additionalInput = await getAdditionalInput();
const verboseMode = additionalInput.includes("verbose");
if (verboseMode) {
console.log(`Verbose mode enabled!`);
}
// Keep doing stuff down here...
if (messageText === "/combatcheck") {
// Prompt for additional input
// Define a function to display the dialog and return the input
async function getAdditionalInput() {
return new Promise((resolve) => {
// Unique identifier for the input
const uniqueId = `additional-input-${new Date().getTime()}`;
let dialog = new Dialog({
title: "Additional Input",
content: `<p>Enter additional flags/commands:</p><input type='text' id='${uniqueId}'/>`,
buttons: {
ok: {
icon: "<i class='fas fa-check'></i>",
label: "Submit",
callback: (html) => resolve(html.find(`#${uniqueId}`).val())
},
cancel: {
icon: "<i class='fas fa-times'></i>",
label: "Cancel",
callback: () => resolve(null)
}
},
default: "ok",
close: () => resolve(null)
});
// Render the dialog
dialog.render(true);
});
}
const additionalInput = await getAdditionalInput();
const verboseMode = additionalInput.includes("verbose");
if (verboseMode) {
console.log(`Verbose mode enabled!`);
}
// Keep doing stuff down here...