From f848558ff6faedf3cf2553c4c1dddfbc3b86f8ed Mon Sep 17 00:00:00 2001 From: jwansek Date: Wed, 29 May 2024 11:37:38 +0000 Subject: Made the lambda cost a variable parameter --- exampleconfig.json | 3 ++- subreddit.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/exampleconfig.json b/exampleconfig.json index 0e517df..0ad4134 100755 --- a/exampleconfig.json +++ b/exampleconfig.json @@ -32,5 +32,6 @@ "passwd": "xxxxxxxxxxxxxxxx", "database": "SmallYTChannel" }, - "min_comment_len": 120 + "min_comment_len": 120, + "lambda_cost": 2 } diff --git a/subreddit.py b/subreddit.py index f600d6f..9fe4088 100755 --- a/subreddit.py +++ b/subreddit.py @@ -189,17 +189,17 @@ def handle_submission(submission, reddit): else: text = "Your post is a discussion, meta or collab post so it costs 0λ." else: - if score < 3: + if score < CONFIG["lambda_cost"]: text = """Thank you for submitting to /r/SmallYTChannel. Unfortunally, you submission has been removed since you do not have enough λ. You need - 3λ to post. You currently have %iλ. For more information, read the [FAQ.](https://www.reddit.com/user/SmallYTChannelBot/comments/a4u7qj/smallytchannelbot_faq/)""" % score + %iλ to post. You currently have %iλ. For more information, read the [FAQ.](https://www.reddit.com/user/SmallYTChannelBot/comments/a4u7qj/smallytchannelbot_faq/)""" % score submission.mod.remove() - display("/u/%s had their submission removed for insufficient lambda." % submission.author, concerning=submission.permalink) + display("/u/%s had their submission removed for insufficient lambda." % (CONFIG["lambda_cost"], submission.author), concerning=submission.permalink) else: - text = """Thank you for submitting to /r/SmallYTChannel. You have spent 3λ to submit here, making your current balance %iλ. + text = """Thank you for submitting to /r/SmallYTChannel. You have spent %iλ to submit here, making your current balance %iλ. /u/%s, please comment `!givelambda` to the most helpful advice you are given. - For more information, read the [FAQ.](https://www.reddit.com/user/SmallYTChannelBot/comments/a4u7qj/smallytchannelbot_faq/)""" % (score - 3, str(submission.author)) + For more information, read the [FAQ.](https://www.reddit.com/user/SmallYTChannelBot/comments/a4u7qj/smallytchannelbot_faq/)""" % (CONFIG["lambda_cost"], score - CONFIG["lambda_cost"], str(submission.author)) with database.Database() as db: - db.change_lambda(str(submission.author), -3) + db.change_lambda(str(submission.author), -CONFIG["lambda_cost"]) try: ytid = ytapi.get_videoId_from_url(submission.url) -- cgit v1.2.3