aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2024-05-29 11:37:38 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2024-05-29 11:37:38 +0000
commitf848558ff6faedf3cf2553c4c1dddfbc3b86f8ed (patch)
treebe6fc841d91cab209fc3fc04a9078c5a6a3673f2
parentea15aa7f5de27495e8246a584be610f72d6ecc8d (diff)
downloadSmallYTChannelBot-f848558ff6faedf3cf2553c4c1dddfbc3b86f8ed.tar.gz
SmallYTChannelBot-f848558ff6faedf3cf2553c4c1dddfbc3b86f8ed.zip
Made the lambda cost a variable parameter
-rwxr-xr-xexampleconfig.json3
-rwxr-xr-xsubreddit.py12
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)