Add fallback mechanism for background selection in autoBackgroundCommand
| @@ -333,6 +333,14 @@ async function autoBackgroundCommand() { | ||
| 333 | 333 | const bestMatch = fuse.search(reply, { limit: 1 }); |
| 334 | 334 | |
| 335 | 335 | 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 | + | |
| 336 | 344 | toastr.warning('No match found. Please try again.'); |
| 337 | 345 | return ''; |
| 338 | 346 | } |