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.217]) by gnuweeb.org (Postfix) with ESMTPSA id D536D7E257; Mon, 3 Oct 2022 23:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664841193; bh=Z1ShNjsjGD+jFEv8SiiQuXlzqlKyF0U5iclQVNAH1EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FaxAx9G/k8g5qsIGZLbJSvvpADwp992x6Qrw1zhWHsuiN8Rb7W3YEnL8bAl04aUJN d0l4tmxRsjYGFGFjoVXFp6VY23pWH2bMr9A1FyBhuF+fM+A4qWm5fLrN40w0YpUuas w1yNtNFikfgCF3Aym87oQNNNoF08eyvjM+ZtNkJm9//ndEKtDsd5lX7sJ1/ZJ1c//y coTU2yeAxFiv/j01QuY2JDdVWgnxC7uYzl88jt7gBAezRoIdPIW3jDGx35dUNnaNFu u4nSLIeDJ1E40io335tVqsP+c2x1aI6WyxdHU2HvnaM9UvdSkhWMlisx/sU3Tjjo73 LN5cTT6x8SLkA== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 10/28] discord: Add delete_broadcast() in deletion directory Date: Tue, 4 Oct 2022 06:52:11 +0700 Message-Id: <20221003235230.1824-11-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221003235230.1824-1-kiizuha@gnuweeb.org> References: <20221003235230.1824-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add delete_broadcast() for delete the specific Discord channel broadcast. Signed-off-by: Muhammad Rizki --- .../dscord/database/methods/deletion/__init__.py | 2 ++ .../database/methods/deletion/delete_broadcast.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 daemon/dscord/database/methods/deletion/delete_broadcast.py diff --git a/daemon/dscord/database/methods/deletion/__init__.py b/daemon/dscord/database/methods/deletion/__init__.py index 988bbee..e8a4466 100644 --- a/daemon/dscord/database/methods/deletion/__init__.py +++ b/daemon/dscord/database/methods/deletion/__init__.py @@ -5,8 +5,10 @@ from .delete_atom import DeleteAtom +from .delete_broadcast import DeleteBroadcast class Deletion( DeleteAtom, + DeleteBroadcast ): pass diff --git a/daemon/dscord/database/methods/deletion/delete_broadcast.py b/daemon/dscord/database/methods/deletion/delete_broadcast.py new file mode 100644 index 0000000..6c8ef83 --- /dev/null +++ b/daemon/dscord/database/methods/deletion/delete_broadcast.py @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + + +class DeleteBroadcast: + + def delete_broadcast(self, channel_id: int): + q = """ + DELETE FROM dc_broadcasts + WHERE channel_id = %(channel_id)s + """ + self.cur.execute(q, {"channel_id": channel_id}) + return self.cur.rowcount > 0 -- Muhammad Rizki