Default item macro is overriding my custom item macro

I'm trying to create and assign an item macro to the hotbar. It's mostly working, but has one unexpected behaviour that I cannot figure out.

Whenever I drag an item to the hotbar, it creates the macro successfully in the Macros Directory, however a "Display [item name]" macro is also created and that's assigned to the hotbar instead. I'm fairly sure this is the default Foundry item macro and it's overriding my hotbar assignment, as it's stil created and assigned when I comment out my createItemMacro function.

Is there any way to disable the "Display [item name]" macro from being created for my items?

Thanks in advance 🙂

My createItemMacro function, for reference:

async function createAvariceItemMacro(data, slot) {
  // First, determine if this is a valid owned item.
  if (data.type !== "Item") return;
  if (!data.uuid.includes('Actor.') && !data.uuid.includes('Token.')) {
    return ui.notifications.warn("You can only create macro buttons for owned Items");
  }
  // If it is, retrieve it based on the uuid.
  const item = await Item.fromDropData(data);

  // Create the macro command using the uuid.
  const command = `game.cryptsofavarice.rollItemMacro("${item.name}");`;
  let macro = game.macros.find(m => (m.name === item.name) && (m.command === command));
  if (!macro) {
    macro = await Macro.create({
      name: item.name,
      type: "script",
      img: item.img,
      command: command,
      flags: { "cryptsofavarice.itemMacro": true }
    });
  }
  game.user.assignHotbarMacro(macro, slot);
  return false;
}
Was this page helpful?