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.177]) by gnuweeb.org (Postfix) with ESMTPSA id A489E80FC1; Sat, 1 Oct 2022 13:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664629462; bh=qQyfAmG4mcnsnVWePp71iiiREPQU0pCqxW3Hmn3XPro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ePbqirWp4/hfVgBehYVum5IinsFtMhCl11csSuKsHCamf2RM8dA5MSSEFhNvISzKE kgRDMBvkPZsSsMns6SZD7FkDqih4gNhv/wirbqwwmhTRT051rVNmxszffJ58KWtl0l kBe9aZo6TqOY2IFd3DhJVxAQgDIp0FNOPHllO5Kc2jAaKd4cmC3YZKuDd1M1Lbidd9 JZ48LWF5woTt6tyOOgJi+cYbffNKxXczxDPjCT//rSnCBoqMwTD/IE2u//RbI0upWW iXmh3o7Cra5Q5VVFfbT/XFjCOFQXLcl5lq4e3IQbG4D6o3K/Ulj5unI9r7q4AYhaVC 58NMlkYe9f+QQ== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 03/26] discord: Add get_broadcast_chats() to get the list of broadcast chats Date: Sat, 1 Oct 2022 20:03:31 +0700 Message-Id: <20221001130355.784-4-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221001130355.784-1-kiizuha@gnuweeb.org> References: <20221001130355.784-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Add get_broadcast_chats() to get the list of broadcast chats. Useful for display and manage them. Signed-off-by: Muhammad Rizki --- .../database/methods/getter/__init__.py | 4 +++- .../methods/getter/get_broadcast_chats.py | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 daemon/dscord/database/methods/getter/get_broadcast_chats.py diff --git a/daemon/dscord/database/methods/getter/__init__.py b/daemon/dscord/database/methods/getter/__init__.py index 3670448..2f4bec7 100644 --- a/daemon/dscord/database/methods/getter/__init__.py +++ b/daemon/dscord/database/methods/getter/__init__.py @@ -5,8 +5,10 @@ from .get_atom_urls import GetAtomURL +from .get_broadcast_chats import GetBroadcastChats class Getter( - GetAtomURL + GetAtomURL, + GetBroadcastChats ): pass diff --git a/daemon/dscord/database/methods/getter/get_broadcast_chats.py b/daemon/dscord/database/methods/getter/get_broadcast_chats.py new file mode 100644 index 0000000..979912b --- /dev/null +++ b/daemon/dscord/database/methods/getter/get_broadcast_chats.py @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + + +class GetBroadcastChats: + + def get_broadcast_chats(self): + ''' + Get broadcast chats that are currently + listening for new email. + - Return list of chat object: `List[Object]` + ''' + q = """ + SELECT * + FROM dc_broadcasts + """ + self.cur.execute(q) + + return self.cur.fetchall() -- Muhammad Rizki