feat(informer): 🚸 make entity search case insensitive
This commit is contained in:
parent
69b1ab0b0b
commit
3379f75ab9
|
@ -116,12 +116,12 @@ function item(
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
|
||||||
function entity(name) {
|
function entity(name = bot.nearestEntity()) {
|
||||||
const entity = typeof name === "string" ? bot.nearestEntity((entity) => {
|
const entity = typeof name === "string" ? (name = name.toLowerCase()) && bot.nearestEntity((entity) => {
|
||||||
const ename = entity.name || entity.username
|
const enames = [entity.username?.toLowerCase(), entity.name, entity.displayName?.toLowerCase()]
|
||||||
return name && ename ? ename == name : true
|
return enames.includes(name)
|
||||||
}) : entity
|
}) : name
|
||||||
console.log(entity)
|
console.log("info entity:", entity)
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
quiet || bot.chat("no entity")
|
quiet || bot.chat("no entity")
|
||||||
return entity
|
return entity
|
||||||
|
|
Loading…
Reference in New Issue
Block a user