Add fallback mechanism for background selection in autoBackgroundCommand

This commit is contained in:
Cohee
2024-12-24 22:15:33 +02:00
parent 7adc6d38e2
commit 540d93592b

View File

@@ -333,6 +333,14 @@ async function autoBackgroundCommand() {
const bestMatch = fuse.search(reply, { limit: 1 }); const bestMatch = fuse.search(reply, { limit: 1 });
if (bestMatch.length == 0) { if (bestMatch.length == 0) {
for (const option of options) {
if (String(reply).toLowerCase().includes(option.text.toLowerCase())) {
console.debug('Fallback choosing background:', option);
option.element.click();
return '';
}
}
toastr.warning('No match found. Please try again.'); toastr.warning('No match found. Please try again.');
return ''; return '';
} }