aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-09-06 01:40:49 +0200
committerGravatar Numerlor <[email protected]>2021-09-06 01:40:49 +0200
commitf3634f9dbcb6c7cc6952f7d9e40879518c4e6eb1 (patch)
tree528c322bcf64a3b80f3419d9a08d524d84a79e40
parentRemove TagNameConverter (diff)
Return 0 if search string has no a-z characters
-rw-r--r--bot/exts/info/tags.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py
index 0fc6e99d0..3d222933a 100644
--- a/bot/exts/info/tags.py
+++ b/bot/exts/info/tags.py
@@ -109,6 +109,9 @@ class Tag:
def _fuzzy_search(search: str, target: str) -> float:
"""A simple scoring algorithm based on how many letters are found / total, with order in mind."""
_search = REGEX_NON_ALPHABET.sub("", search.lower())
+ if not _search:
+ return 0
+
_targets = iter(REGEX_NON_ALPHABET.split(target.lower()))
current = 0