Ignore empty string

This commit is contained in:
Egor Guslyancev 2023-12-18 09:57:19 -03:00
parent 569c2aa752
commit ed47cc1d76
GPG Key ID: D7E709AA465A55F9
1 changed files with 6 additions and 3 deletions

9
bot.py
View File

@ -135,9 +135,12 @@ def find_uids(forum: int, s: str) -> list | None:
people = db.read(str(forum) + ".people")
if people is None:
return None
if s[0] == "@":
s = s[1:]
f = [i for i in people.keys() if len([j for j in people[i].values() if s in j]) > 0]
if len(s) > 0:
if s[0] == "@":
s = s[1:]
f = [i for i in people.keys() if len([j for j in people[i].values() if s in j]) > 0]
else:
f = list(people.keys())
if len(f) == 0:
return None
return f