Compare commits
2 Commits
253e4def43
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b045b53519 | |||
| dc2bae0da6 |
+2
-1
@@ -53,8 +53,9 @@ class Database:
|
||||
quote = msg.text.strip().split("\n\n")
|
||||
text = quote[0].strip()
|
||||
author = "" if len(quote) == 1 else quote[1].strip()
|
||||
timestamp = msg.forward_origin.date if msg.forward_origin else msg.date
|
||||
with self.conn.cursor() as cursor:
|
||||
cursor.execute("INSERT INTO quotes(text, author, creator_id) VALUES(%s, NULLIF(%s, ''), (SELECT id FROM users WHERE telegram_id=%s)) RETURNING id", (quote[0].strip(), author, msg.from_user.id))
|
||||
cursor.execute("INSERT INTO quotes(text, author, creator_id, datetime) VALUES(%s, NULLIF(%s, ''), (SELECT id FROM users WHERE telegram_id=%s), to_timestamp(%s)::timestamptz) RETURNING id", (quote[0].strip(), author, msg.from_user.id, timestamp))
|
||||
return cursor.fetchone()[0]
|
||||
|
||||
def quotes_count(self):
|
||||
|
||||
@@ -26,10 +26,10 @@ function datetimeToLocalISO(datetime) {
|
||||
|
||||
function escapedString(str) {
|
||||
return str
|
||||
.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace("\n", "<br>");
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll("\n", "<br>");
|
||||
}
|
||||
|
||||
function formToJSON(form) {
|
||||
|
||||
Reference in New Issue
Block a user