This commit is contained in:
Aevann1 2021-12-11 04:35:21 +02:00
parent 449c18dcf5
commit 1574901375

View file

@ -902,10 +902,11 @@ def submit_post(v):
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
bet_options = [] if v and v.admin_level > 1:
for i in re.finditer('\s*\$\$\$([^\$\n]+)\$\$\$\s*', body): bet_options = []
bet_options.append(i.group(1)) for i in re.finditer('\s*\$\$\$([^\$\n]+)\$\$\$\s*', body):
body = body.replace(i.group(0), "") bet_options.append(i.group(1))
body = body.replace(i.group(0), "")
options = [] options = []
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body): for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body):
@ -969,15 +970,16 @@ def submit_post(v):
g.db.add(new_post) g.db.add(new_post)
g.db.flush() g.db.flush()
for option in bet_options: if v and v.admin_level > 1:
bet_option = Comment(author_id=AUTOBETTER_ID, for option in bet_options:
parent_submission=new_post.id, bet_option = Comment(author_id=AUTOBETTER_ID,
level=1, parent_submission=new_post.id,
body_html=filter_emojis_only(option), level=1,
upvotes=0 body_html=filter_emojis_only(option),
) upvotes=0
)
g.db.add(bet_option) g.db.add(bet_option)
for option in options: for option in options:
c = Comment(author_id=AUTOPOLLER_ID, c = Comment(author_id=AUTOPOLLER_ID,