From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.94]) by gnuweeb.org (Postfix) with ESMTPSA id D6AD4806D7; Fri, 29 Jul 2022 01:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1659058927; bh=fPYZkesjgGFvbVnhARmoBycd2FZR9iSgBNtjBWWbuKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TwVC51LlpHWFzw5II3eiYd3kp2K1YBIzUIJAgPUOQMsleJ7j2nG6i6s7/UbCSZDda Bpu4N6tAFG9unydm1j3yfqPesWj9AueH93i5CkXujNIW/krKCrJlW6VVQgdi9xdaQ8 VVgwBzfgjmpSFm7PsUA41EnQCbwOq2ZdEsxiwFR7YpvqhF8WYtK3jCI2urnrq3Po7N RL9xi6cRr4KsWvnEz4mpoSUHwDw8HVsSBRDAnQr9NcYurrNSdGyPo7CrGmeRQUy+78 IX7JZszEijkSGfbGrLyJPJcgylvjRgPqnANIF4wSxEIJZV04+dlkthA4A3oyrlhqkc ep0KqSLQ0KVrw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , GNU/Weeb Mailing List , Alviro Iskandar Setiawan Subject: [PATCH v3 14/18] Add delete_broadcast() in scraper/db.py Date: Fri, 29 Jul 2022 08:40:48 +0700 Message-Id: <20220729014052.1547-15-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220729014052.1547-1-kiizuha@gnuweeb.org> References: <20220729014052.1547-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add delete_broadcast() for delete a chat in the database from receiving email messages. Signed-off-by: Muhammad Rizki --- daemon/scraper/db.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/daemon/scraper/db.py b/daemon/scraper/db.py index a0f8d15..15b0f99 100644 --- a/daemon/scraper/db.py +++ b/daemon/scraper/db.py @@ -199,6 +199,15 @@ class Db(): return self.cur.lastrowid + def delete_broadcast(self, chat_id: int): + q = """ + DELETE FROM broadcast_chats + WHERE chat_id = %(chat_id)s + """ + self.cur.execute(q, {"chat_id": chat_id}) + return self.cur.rowcount > 0 + + def get_broadcast_chats(self): q = """ SELECT * -- Muhammad Rizki