aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2019-03-26 18:07:13 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2019-03-26 18:07:13 +0000
commit0d7713123b305123cc9974d4e6efb672b8400772 (patch)
tree00c73e193e8e4f5b609fc81c753c1452a77194a0
parentaf72cc0fab15ac670391e7c7075717e31cd56884 (diff)
downloadSmallYTChannelBot-0d7713123b305123cc9974d4e6efb672b8400772.tar.gz
SmallYTChannelBot-0d7713123b305123cc9974d4e6efb672b8400772.zip
re-added lambda removal feature
-rw-r--r--SmallYTChannelBotSubmissions.py38
-rw-r--r--SmallYTChannelDatabase.dbbin3139584 -> 3553280 bytes
-rw-r--r--readme.md.save11
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
index 91a0c08..94fdd8a 100644
--- a/SmallYTChannelDatabase.db
+++ b/SmallYTChannelDatabase.db
Binary files differ
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