aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdatabase.py6
-rwxr-xr-xsubreddit.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/database.py b/database.py
index 3a0a15c..ba2a83b 100755
--- a/database.py
+++ b/database.py
@@ -10,7 +10,7 @@ class Database:
self.cursor.execute("UPDATE users SET lambda = ((SELECT lambda FROM users WHERE user_name = ?) + ?) WHERE user_name = ?;", (user, changeby, user))
self.connection.commit()
- def give_lambda(self, user, link, op = None):
+ def give_lambda(self, user, link, timestamp = None, op = None):
def give(user, link = None):
#check if the user has an entry in the database
self.cursor.execute("SELECT userID FROM users WHERE user_name = ?;", (user, ))
@@ -21,12 +21,12 @@ class Database:
self.cursor.execute("INSERT INTO users (user_name, lambda) VALUES (?, 1);", (user, ))
self.connection.commit()
if link is not None:
- self.cursor.execute("INSERT INTO lambdas (userID, permalink) VALUES ((SELECT userID FROM users WHERE user_name = ?), ?);", (user, link))
+ self.cursor.execute("INSERT INTO lambdas (userID, permalink, created) VALUES ((SELECT userID FROM users WHERE user_name = ?), ?, ?);", (user, link, timestamp))
else:
#update their lambda and add to lambdas
self.change_lambda(user, 1)
if link is not None:
- self.cursor.execute("INSERT INTO lambdas (userID, permalink) VALUES (?, ?);", (id_, link))
+ self.cursor.execute("INSERT INTO lambdas (userID, permalink, created) VALUES (?, ?, ?);", (id_, link, timestamp))
self.connection.commit()
diff --git a/subreddit.py b/subreddit.py
index dbb2e1e..8a1755d 100755
--- a/subreddit.py
+++ b/subreddit.py
@@ -170,7 +170,7 @@ def handle_givelambda(comment):
text = "Please only give lambda to humans."
elif str(comment.author) in get_mods():
text = "The moderator /u/%s has given /u/%s 1λ. /u/%s now has %iλ." % (str(comment.author), parentauthour, parentauthour, db.get_lambda(parentauthour)[0] + 1)
- db.give_lambda(parentauthour, submission.permalink)
+ db.give_lambda(parentauthour, submission.permalink, timestamp = int(submission.created_utc))
display(text)
elif submission.link_flair_text in FREE_FLAIRS:
text = "You cannot give lambda in free posts anymore."
@@ -187,7 +187,7 @@ def handle_givelambda(comment):
# db.give_lambda(parentauthour, submission.permalink, op)
# display("The OP received lambda too!")
# else:
- db.give_lambda(parentauthour, submission.permalink)
+ db.give_lambda(parentauthour, submission.permalink, timestamp = int(submission.created_utc))
# update_users_flair_from_comment(comment)
update_users_flair_from_comment(comment.parent())