diff options
author | jwanek <eddie.atten.ea29@gmail.com> | 2020-05-26 20:00:40 +0100 |
---|---|---|
committer | jwanek <eddie.atten.ea29@gmail.com> | 2020-05-26 20:00:40 +0100 |
commit | 564e1cc3e4b3994d7d1c52c9fe596124a3ee5ff6 (patch) | |
tree | d3a59c3489c484b520e3e228456d50ca24019669 /database.py | |
parent | af3ef25426dc118d1c528e20b787f7180bd2bcef (diff) | |
download | SmallYTChannelBot-564e1cc3e4b3994d7d1c52c9fe596124a3ee5ff6.tar.gz SmallYTChannelBot-564e1cc3e4b3994d7d1c52c9fe596124a3ee5ff6.zip |
added adding timestamp
Diffstat (limited to 'database.py')
-rwxr-xr-x | database.py | 6 |
1 files changed, 3 insertions, 3 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() |