From f500e68dce46d8bf1e5a269cdf472ee503a9471b Mon Sep 17 00:00:00 2001 From: maaa Date: Mon, 10 Jul 2023 01:06:36 +0200 Subject: [PATCH] new stuff --- deletecomment | 16 ++++++++++++++++ main | 1 + 2 files changed, 17 insertions(+) create mode 100644 deletecomment diff --git a/deletecomment b/deletecomment new file mode 100644 index 0000000..7f3ec94 --- /dev/null +++ b/deletecomment @@ -0,0 +1,16 @@ +#!/usr/bin/python3 +import sqlite3 +import os + +commentid = input("Insert ID: ") + +def get_db_connection(): + conn = sqlite3.connect("database.db") + conn.row_factory = sqlite3.Row + return conn + +conn = get_db_connection() +conn.execute("DELETE FROM comments WHERE id = ?", (commentid)) +conn.commit() +conn.close() +print("Success!") \ No newline at end of file diff --git a/main b/main index 1be83c1..983db38 100644 --- a/main +++ b/main @@ -210,6 +210,7 @@ def apifrontpage(): for comment in get_comments(post["id"]): commentthing = { "title": comment["textstr"], + "id": comment["id"], "created": comment["created"], "creator": { "id": comment["creator"],