forked from rDrama/rDrama
mentions - try consolidating regex
parent
6bef780e6c
commit
48dd721feb
|
@ -134,7 +134,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False):
|
|||
if word in text:
|
||||
notify_users.add(id)
|
||||
|
||||
names = set(m.group(1) for m in mention_alerts_regex.finditer(text))
|
||||
names = set(m.group(1) for m in mention_regex.finditer(text))
|
||||
|
||||
user_ids = get_users(names, ids_only=True, graceful=True)
|
||||
notify_users.update(user_ids)
|
||||
|
@ -149,7 +149,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False):
|
|||
if FEATURES['PING_GROUPS']:
|
||||
cost = 0
|
||||
|
||||
for i in group_mention_alerts_regex.finditer(text):
|
||||
for i in group_mention_regex.finditer(text):
|
||||
if oldtext and i.group(1) in oldtext:
|
||||
continue
|
||||
|
||||
|
|
|
@ -9,10 +9,7 @@ valid_username_chars = 'a-zA-Z0-9_\-'
|
|||
valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A)
|
||||
|
||||
mention_regex = re.compile('(^|\s|>)@([a-zA-Z0-9_\-]{1,30})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A)
|
||||
mention_alerts_regex = re.compile('@([a-zA-Z0-9_\-]{1,30})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A)
|
||||
|
||||
group_mention_regex = re.compile('(^|\s|>)!([a-z0-9_\-]{3,25})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A|re.I)
|
||||
group_mention_alerts_regex = re.compile('!([a-z0-9_\-]{3,25})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A|re.I)
|
||||
group_mention_regex = re.compile('!([a-z0-9_\-]{3,25})(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A|re.I)
|
||||
|
||||
everyone_regex = re.compile('(^|\s|>)!(everyone)(?!([^<]*<\/(code|pre|a)>|[^`]*`))', flags=re.A)
|
||||
|
||||
|
|
Loading…
Reference in New Issue