add default value to unnamed args

This commit is contained in:
LenAnderson 2024-06-18 21:51:08 -04:00
parent eb02ca95f9
commit 05c24f6d31
1 changed files with 41 additions and 29 deletions

View File

@ -298,6 +298,8 @@ export class SlashCommand {
for (const arg of unnamedArguments) { for (const arg of unnamedArguments) {
const listItem = document.createElement('li'); { const listItem = document.createElement('li'); {
listItem.classList.add('argumentItem'); listItem.classList.add('argumentItem');
const argSpec = document.createElement('div'); {
argSpec.classList.add('argumentSpec');
const argItem = document.createElement('div'); { const argItem = document.createElement('div'); {
argItem.classList.add('argument'); argItem.classList.add('argument');
argItem.classList.add('unnamedArgument'); argItem.classList.add('unnamedArgument');
@ -331,7 +333,17 @@ export class SlashCommand {
argItem.append(types); argItem.append(types);
} }
} }
listItem.append(argItem); argSpec.append(argItem);
}
if (arg.defaultValue !== null) {
const argDefault = document.createElement('div'); {
argDefault.classList.add('argument-default');
argDefault.title = 'default value';
argDefault.textContent = arg.defaultValue.toString();
argSpec.append(argDefault);
}
}
listItem.append(argSpec);
} }
const desc = document.createElement('div'); { const desc = document.createElement('div'); {
desc.classList.add('argument-description'); desc.classList.add('argument-description');