From 6eff7abe49c82a0bc4047e9a1d7de34825f2abac Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 13 May 2023 01:29:34 +0300 Subject: [PATCH] replace "bots" with "BOT_IDs" --- files/helpers/alerts.py | 8 ++++---- files/helpers/config/const.py | 2 +- files/helpers/sanitize.py | 2 +- files/routes/comments.py | 4 ++-- files/routes/users.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 1bc91d9b23..7be66d7254 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -28,7 +28,7 @@ def create_comment(text_html): def send_repeatable_notification(uid, text): - if uid in bots: return + if uid in BOT_IDs: return text_html = sanitize(text, blackjack="notification") @@ -52,7 +52,7 @@ def send_repeatable_notification(uid, text): def send_notification(uid, text): - if uid in bots: return + if uid in BOT_IDs: return cid = notif_comment(text) add_notif(cid, uid, text) @@ -106,7 +106,7 @@ def notif_comment2(p): def add_notif(cid, uid, text, pushnotif_url=''): - if uid in bots: return + if uid in BOT_IDs: return existing = g.db.query(Notification.user_id).filter_by(comment_id=cid, user_id=uid).one_or_none() if not existing: @@ -182,7 +182,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False): - return notify_users - bots - {v.id, 0} - v.all_twoway_blocks + return notify_users - BOT_IDs - {v.id, 0} - v.all_twoway_blocks def push_notif(uids, title, body, url_or_comment): diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index b92400e5fa..6b5fb084f1 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -924,7 +924,7 @@ else: # localhost or testing environment implied HOUSES = ("None","Furry","Femboy","Vampire","Racist") if FEATURES['HOUSES'] else ("None") -bots = {AUTOJANNY_ID, SNAPPY_ID, LONGPOSTBOT_ID, ZOZBOT_ID} +BOT_IDs = {AUTOJANNY_ID, SNAPPY_ID, LONGPOSTBOT_ID, ZOZBOT_ID} COLORS = {'ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58','8cdbe6', DEFAULT_COLOR} diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index b6438e30a1..83d6aabb1d 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -151,7 +151,7 @@ def create_comment_duplicated(text_html): def send_repeatable_notification_duplicated(uid, text): - if uid in bots: return + if uid in BOT_IDs: return text_html = sanitize(text) diff --git a/files/routes/comments.py b/files/routes/comments.py index cec6e94d05..86a72ab4e1 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -342,7 +342,7 @@ def comment(v:User): if parent_user.id != v.id and notify_op: notify_users.add(parent_user.id) - for x in notify_users-bots: + for x in notify_users-BOT_IDs: n = Notification(comment_id=c.id, user_id=x) g.db.add(n) @@ -641,7 +641,7 @@ def edit_comment(cid, v): if notify_users == 'everyone': alert_everyone(c.id) else: - for x in notify_users-bots: + for x in notify_users-BOT_IDs: notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).one_or_none() if not notif: n = Notification(comment_id=c.id, user_id=x) diff --git a/files/routes/users.py b/files/routes/users.py index a58b541c58..764ba2ebe6 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -570,7 +570,7 @@ def message2(v:User, username:str): execute_under_siege(v, c, c.body_html, 'message') c.top_comment_id = c.id - if user.id not in bots: + if user.id not in BOT_IDs: notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user.id).one_or_none() if not notif: notif = Notification(comment_id=c.id, user_id=user.id) @@ -648,7 +648,7 @@ def messagereply(v:User): execute_blackjack(v, c, c.body_html, 'message') execute_under_siege(v, c, c.body_html, 'message') - if user_id and user_id not in {v.id, MODMAIL_ID} | bots: + if user_id and user_id not in {v.id, MODMAIL_ID} | BOT_IDs: notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user_id).one_or_none() if not notif: notif = Notification(comment_id=c.id, user_id=user_id)