mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-10 09:18:06 +01:00
fix: search algorithm in tagsUtils
This commit is contained in:
parent
ae620b2ebb
commit
f69c0b97f1
1 changed files with 3 additions and 3 deletions
|
@ -14,7 +14,7 @@ for (const [key, value] of Object.entries(tags)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getTag = (name: string) => {
|
export const getTag = (name: string) => {
|
||||||
const tag = tagCache.get(name) || tagCache.find(tag => tag.keywords.includes(name));
|
const tag = tagCache.get(name) || tagCache.find(tag => tag.keywords.some(k => k.includes(name)));
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ export const findTags = (name: string) => {
|
||||||
if (tag)
|
if (tag)
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
name,
|
name: tag.keywords[0],
|
||||||
value: name
|
value: tag.keywords[0],
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
else return findTags(null);
|
else return findTags(null);
|
||||||
|
|
Loading…
Reference in a new issue