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 AE68D7E257; Mon, 3 Oct 2022 23:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1664841181; bh=qQyfAmG4mcnsnVWePp71iiiREPQU0pCqxW3Hmn3XPro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oh/zZkwwzBj237mr+hbwLGtKu7GlJigLqQbHNqSJFd4HFHgoUVEiYqPswTnAZ1Uu2 v0WHCzxZ8BKf8C889/OsuAkG9pRvLosk+p/7EmIr5gNCf+f8kdmfOl3j9fTBJ2P1XN j1zKw7HDUIrMsb3TYaJfm1+Y2fdSvJg89klTn7TR8AvpkOQscQ4OLNyX6zRi6CCNqW Z4880DjO8jYwYaiGnWwxCz/lCGAeuxJ5x4X1JD0Qsz9qMOcH/pZ6Ag+gLPqp+wjBFf 7BbwkxxBtNOkO6HY4OR+atIMQfPB0uRdmAwqOapc3rH+xvy0sfk4i/+GecaVAs3gcd Xt/0Hc04kDXhw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 05/28] discord: Add get_broadcast_chats() to get the list of broadcast chats Date: Tue, 4 Oct 2022 06:52:06 +0700 Message-Id: <20221003235230.1824-6-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 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