forked from rDrama/rDrama
fix snappy pinging
parent
a1a11781ac
commit
ce38cc0f72
|
@ -55,13 +55,11 @@ def execute_snappy(post, v):
|
||||||
if post.sub and g.db.query(Exile.user_id).filter_by(user_id=SNAPPY_ID, sub=post.sub).one_or_none():
|
if post.sub and g.db.query(Exile.user_id).filter_by(user_id=SNAPPY_ID, sub=post.sub).one_or_none():
|
||||||
return
|
return
|
||||||
|
|
||||||
group_members = []
|
|
||||||
|
|
||||||
ghost = post.ghost
|
ghost = post.ghost
|
||||||
|
|
||||||
snappy = get_account(SNAPPY_ID)
|
snappy = get_account(SNAPPY_ID)
|
||||||
|
|
||||||
ping_cost = None
|
ping_cost = 0
|
||||||
|
|
||||||
post_ping_group_count = len(list(group_mention_regex.finditer(post.body)))
|
post_ping_group_count = len(list(group_mention_regex.finditer(post.body)))
|
||||||
|
|
||||||
|
@ -206,12 +204,10 @@ def execute_snappy(post, v):
|
||||||
app_id=None,
|
app_id=None,
|
||||||
body=body,
|
body=body,
|
||||||
body_html=body_html,
|
body_html=body_html,
|
||||||
ghost=ghost
|
ghost=ghost,
|
||||||
|
ping_cost=ping_cost,
|
||||||
)
|
)
|
||||||
|
|
||||||
if ping_cost:
|
|
||||||
c.ping_cost += ping_cost
|
|
||||||
|
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
|
|
||||||
check_slots_command(c, v, snappy)
|
check_slots_command(c, v, snappy)
|
||||||
|
@ -242,10 +238,11 @@ def execute_snappy(post, v):
|
||||||
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
for x in group_members:
|
if c.ping_cost:
|
||||||
n = Notification(comment_id=c.id, user_id=x)
|
for x in group.member_ids:
|
||||||
g.db.add(n)
|
n = Notification(comment_id=c.id, user_id=x)
|
||||||
push_notif({x}, f'New mention of you by @Snappy', c.body, c)
|
g.db.add(n)
|
||||||
|
push_notif({x}, f'New mention of you by @Snappy', c.body, c)
|
||||||
|
|
||||||
c.top_comment_id = c.id
|
c.top_comment_id = c.id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue