Fix post comment count logic not activating.

Also standardize parameter list order for comment games.
master
Snakes 2022-12-09 00:55:18 -05:00
parent 07eb8bdebc
commit 0d580b8b4f
Signed by: Snakes
GPG Key ID: E745A82778055C7E
4 changed files with 14 additions and 11 deletions

View File

@ -166,7 +166,7 @@ def execute_snappy(post:Submission, v:User):
g.db.add(c)
check_slots_command(v, snappy, c)
check_slots_command(c, v, snappy)
snappy.comment_count += 1
snappy.pay_account('coins', 1)
@ -530,12 +530,8 @@ def process_poll_options(target:Union[Submission, Comment],
)
db.add(option)
def execute_wordle(post_target:post_target_type, c:Comment, body:str, rts:bool):
def execute_wordle(c:Comment, body:str):
if not FEATURES['WORDLE']: return
if not "!wordle" in body: return
answer = random.choice(WORDLE_LIST)
c.wordle_result = f'_active_{answer}'
if not c.wordle_result and not rts:
post_target.comment_count += 1
g.db.add(post_target)

View File

@ -120,7 +120,7 @@ def shuffle(stuff):
return stuff
def check_slots_command(v:User, u:User, c:Comment):
def check_slots_command(c:Comment, v:User, u:User):
if not FEATURES['GAMBLING']: return
body = c.body.lower()

View File

@ -10,7 +10,7 @@ standard_min = 12
standard_max = 100
lotterizer_rate = 33
def check_for_treasure(in_text, from_comment):
def check_for_treasure(from_comment, in_text):
user = from_comment.author
if not FEATURES['GAMBLING']: return

View File

@ -326,9 +326,16 @@ def comment(v:User):
c.voted = 1
check_for_treasure(body, c)
execute_wordle(post_target or parent_user, c, body, rts)
check_slots_command(v, v, c)
check_for_treasure(c, body)
execute_wordle(c, body)
check_slots_command(c, v, v)
# Increment post count iff not self-reply and not a spammy comment game
# Essentially a measure to make comment counts reflect "real" content
if (posting_to_submission and not rts
and not c.wordle_result and not c.slots_result):
post_target.comment_count += 1
g.db.add(post_target)
if c.level > 5:
n = g.db.query(Notification).filter_by(