master
Aevann 2024-03-08 07:09:33 +02:00
parent 29d324c42b
commit d3332da8ff
2 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@ valid_username_regex = re.compile("^[\w-]{3,25}$", flags=re.A)
valid_username_patron_regex = re.compile("^[\w-]{1,25}$", flags=re.A) valid_username_patron_regex = re.compile("^[\w-]{1,25}$", flags=re.A)
mention_regex = re.compile('(?<![:/\w])@([\w-]{1,30})' + NOT_IN_CODE_OR_LINKS, flags=re.A) mention_regex = re.compile('(?<![:/\w])@([\w-]{1,30})' + NOT_IN_CODE_OR_LINKS, flags=re.A)
dm_adding_regex = re.compile('+@[\w-]{1,30}' + NOT_IN_CODE_OR_LINKS, flags=re.A)
group_mention_regex = re.compile('(?<![:/\w])!([\w-]{3,25})' + NOT_IN_CODE_OR_LINKS, flags=re.A|re.I) group_mention_regex = re.compile('(?<![:/\w])!([\w-]{3,25})' + NOT_IN_CODE_OR_LINKS, flags=re.A|re.I)
everyone_regex = re.compile('(^|\s|>)!(everyone)' + NOT_IN_CODE_OR_LINKS, flags=re.A) everyone_regex = re.compile('(^|\s|>)!(everyone)' + NOT_IN_CODE_OR_LINKS, flags=re.A)

View File

@ -322,8 +322,8 @@ def messagereply(v):
execute_blackjack(v, c, c.body_html, 'chat') execute_blackjack(v, c, c.body_html, 'chat')
execute_under_siege(v, c, c.body_html, 'chat') execute_under_siege(v, c, c.body_html, 'chat')
if mention_regex.fullmatch(c.body): if dm_adding_regex.fullmatch(c.body):
uid = get_user(c.body[1:], attributes=[User.id]).id uid = get_user(c.body[2:], attributes=[User.id]).id
if uid not in parent.group_dm_ids: if uid not in parent.group_dm_ids:
parent.group_dm_ids.append(uid) parent.group_dm_ids.append(uid)
g.db.add(parent) g.db.add(parent)