prevent repeated mentions when the mentioner changes their name

master
Aevann 2023-08-16 00:35:43 +03:00
parent fa222922b9
commit 16cf545aa0
1 changed files with 8 additions and 0 deletions

View File

@ -126,6 +126,10 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None, followers_pi
return set()
text = text.lower()
if oldtext:
oldtext = oldtext.lower()
notify_users = set()
for word, id in NOTIFIED_USERS.items():
@ -134,6 +138,10 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None, followers_pi
names = set(m.group(1) for m in mention_regex.finditer(text))
if oldtext:
oldnames = set(m.group(1) for m in mention_regex.finditer(oldtext))
names = names - oldnames
user_ids = get_users(names, ids_only=True, graceful=True)
notify_users.update(user_ids)