Don't allow duplicate registrations
| @@ -50,8 +50,8 @@ export class MacrosParser { | ||
| 50 | 50 | * @returns {IterableIterator<CustomMacro>} |
| 51 | 51 | */ |
| 52 | 52 | static [Symbol.iterator] = function* () { |
| 53 | 53 | for (const macro of thisMacrosParser.#macros.valueskeys()) { |
| 54 | 54 | yield { key: macro, description: thisMacrosParser.#descriptions.get(macro) }; |
| 55 | 55 | } |
| 56 | 56 | }; |
| 57 | 57 | |
| @@ -23,6 +23,7 @@ import { SlashCommandDebugController } from './SlashCommandDebugController.js'; | ||
| 23 | 23 | import { commonEnumProviders } from './SlashCommandCommonEnumsProvider.js'; |
| 24 | 24 | import { SlashCommandBreak } from './SlashCommandBreak.js'; |
| 25 | 25 | import { MacrosParser } from '../macros.js'; |
| 26 | +import { t } from '../i18n.js'; | |
| 26 | 27 | |
| 27 | 28 | /** @typedef {import('./SlashCommand.js').NamedArgumentsCapture} NamedArgumentsCapture */ |
| 28 | 29 | /** @typedef {import('./SlashCommand.js').NamedArguments} NamedArguments */ |
| @@ -496,7 +497,8 @@ export class SlashCommandParser { | ||
| 496 | 497 | (li.querySelector('tt').remove(),li.innerHTML), |
| 497 | 498 | )); |
| 498 | 499 | for (const macro of MacrosParser) { |
| 499 | - options.push(new MacroAutoCompleteOption(macro.name, `{{${macro.name}}}`, macro.description || 'No description provided')); | |
| 500 | + if (options.find(it => it.name === macro.key)) continue; | |
| 501 | + options.push(new MacroAutoCompleteOption(macro.key, `{{${macro.key}}}`, macro.description || t`No description provided`)); | |
| 500 | 502 | } |
| 501 | 503 | const result = new AutoCompleteNameResult( |
| 502 | 504 | macro.name, |