diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2019-03-26 18:07:13 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2019-03-26 18:07:13 +0000 |
commit | 0d7713123b305123cc9974d4e6efb672b8400772 (patch) | |
tree | 00c73e193e8e4f5b609fc81c753c1452a77194a0 /SmallYTChannelBotSubmissions.py | |
parent | af72cc0fab15ac670391e7c7075717e31cd56884 (diff) | |
download | SmallYTChannelBot-0d7713123b305123cc9974d4e6efb672b8400772.tar.gz SmallYTChannelBot-0d7713123b305123cc9974d4e6efb672b8400772.zip |
re-added lambda removal feature
Diffstat (limited to 'SmallYTChannelBotSubmissions.py')
-rw-r--r-- | SmallYTChannelBotSubmissions.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/SmallYTChannelBotSubmissions.py b/SmallYTChannelBotSubmissions.py index 68a6d02..270401c 100644 --- a/SmallYTChannelBotSubmissions.py +++ b/SmallYTChannelBotSubmissions.py @@ -203,25 +203,25 @@ def main(): 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 `!takelambda [user] [how much to remove {integer}] [reason]`" - # reply = comment.reply(text + tail) - # reply.mod.distinguish() - # continue - - # 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 `!takelambda [user] [how much to remove {integer}] [reason]`" + reply = comment.reply(text + tail) + reply.mod.distinguish() + continue + + update_users_flair(comment.parent()) + reply = comment.reply(text + tail) + reply.mod.distinguish() for submission in submission_stream: |