Simplified some code

This commit is contained in:
BordedDev 2025-06-01 20:56:24 +02:00
parent f7e1708039
commit 157493b0f4
No known key found for this signature in database
GPG Key ID: C5F495EAE56673BF

View File

@ -45,17 +45,18 @@ class ChatInputComponent extends HTMLElement {
}
resolveAutoComplete() {
let count = 0;
let value = null;
Object.keys(this.allAutoCompletions).forEach((key) => {
if (key.startsWith(this.value.split(" ")[0])) {
count++;
for (const key of Object.keys(this.allAutoCompletions)) {
if (key.startsWith(this.value.split(" ", 1)[0])) {
if (value) {
return null;
}
value = key;
}
});
if (count == 1) return value;
return null;
}
return value;
}
isActive() {