Add fallback mechanism for background selection in autoBackgroundCommand

540d93592b46df0a3e8759610affcdf9d9591f10

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +8 -0Ignore whitespace
public/scripts/backgrounds.js+8 -0
@@ -333,6 +333,14 @@ async function autoBackgroundCommand() {
333333 const bestMatch = fuse.search(reply, { limit: 1 });
334334
335335 if (bestMatch.length == 0) {
336+ for (const option of options) {
337+ if (String(reply).toLowerCase().includes(option.text.toLowerCase())) {
338+ console.debug('Fallback choosing background:', option);
339+ option.element.click();
340+ return '';
341+ }
342+ }
343+
336344 toastr.warning('No match found. Please try again.');
337345 return '';
338346 }