diff options
-rw-r--r-- | SmallYTChannelBotSubmissions.py | 38 | ||||
-rw-r--r-- | SmallYTChannelDatabase.db | bin | 3139584 -> 3553280 bytes | |||
-rw-r--r-- | readme.md.save | 11 |
3 files changed, 30 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: diff --git a/SmallYTChannelDatabase.db b/SmallYTChannelDatabase.db Binary files differindex 91a0c08..94fdd8a 100644 --- a/SmallYTChannelDatabase.db +++ b/SmallYTChannelDatabase.db diff --git a/readme.md.save b/readme.md.save new file mode 100644 index 0000000..cf9f28a --- /dev/null +++ b/readme.md.save @@ -0,0 +1,11 @@ +#/u/SmallYTChannelBot Source Code + +- database.py is for interfacing with the SQLite database + +- I chose SQLite instead of MySQL so it's easy to backup + +- I backup here every so often, but it is likely to be out of date. +If I die and someone needs to take over the source code, you'll have to +write a script that reads everyone's flairs in the subreddit. + +- ytapi.py is for getting information about videos using the YouTube API |