diff options
-rw-r--r-- | SmallYTChannelBotSubmissions.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/SmallYTChannelBotSubmissions.py b/SmallYTChannelBotSubmissions.py index 38dd49a..fa8f209 100644 --- a/SmallYTChannelBotSubmissions.py +++ b/SmallYTChannelBotSubmissions.py @@ -125,7 +125,6 @@ def every_day(): db.update_stats() _update_tables(db.get_scores(), db.get_stats()) - def main(): tail = "\n\n\n ^/u/SmallYTChannelBot ^*made* ^*by* ^/u/jwnskanzkwk. ^*PM* ^*for* ^*bug* ^*reports.* ^*For* ^*more* ^*information,* ^*read* ^*the* ^[FAQ.](https://www.reddit.com/user/SmallYTChannelBot/comments/a4u7qj/smallytchannelbot_faq/)" @@ -196,6 +195,24 @@ def main(): update_users_flair(comment.parent()) reply = comment.reply(text + tail) reply.mod.distinguish() + + if comment.body[:11] == "!takelambda" and str(comment.author) in get_mods(): + try: + splitted = comment.body.split() + user = splitted[1].replace("/u/", "") + toremove = int(splitted[2]) + reason = " ".join(splitted[3:]) + + text = "/u/%s has had %iλ taken away from them for the reason '%s'. /u/%s now has %iλ" % (user, toremove, reason, user, db.get_lambda(user)[0] - toremove) + db.change_lambda(user, -toremove) + except Exception as e: + print("[ERROR while removing λ] %s" % e) + text = r"An error was encountered. Please use the syntax `!givelambda [user] [how much to remove {integer}] [reason]`" + + update_users_flair(comment) + reply = comment.reply(text + tail) + reply.mod.distinguish() + for submission in submission_stream: if submission is None: |