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.100]) by gnuweeb.org (Postfix) with ESMTPSA id C083280D90; Sun, 11 Sep 2022 10:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1662892452; bh=1t6HiJBUnUSzJPF2uyOQa+bO7lTqmCSl7AROql7XvlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JlgDQAZSGbpYeAYoAURMb3/BOFG/TIBpp6U9P1bSS9jX5wMasy210Wc6NixNASPBM FkJd1bidgCdg3x0HafOGaJq8Nmt4nUT4i5DixQQEMdkNQ2xfKaWGDkTsdEeRV4vVvq 9KoCa4W8rkh/EKzNFdYqm4UrArn/WnkOqdoO8jo1/5b0/fMmcNC/MehX0K+eI8hUc/ WMiZblutol/X3AICohKjvBD71Wn8pSW0BEymOw7m2wDJr+2IRAVMt3hgDWCpb0CT0l dNKKLz5LRCF3x1D+teJ5KJXMbQSS8SlhXo5U8eA9zt57X3jIH+QTzM4NOS+TxRVngC u6/7DrjjNQcFw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [RFC PATCH v1 13/17] [discord] Add initial Discord bot database instance Date: Sun, 11 Sep 2022 17:33:19 +0700 Message-Id: <20220911103323.1949-14-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20220911103323.1949-1-kiizuha@gnuweeb.org> References: <20220911103323.1949-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Just adding Discord bot database instance Signed-off-by: Muhammad Rizki --- daemon/dscord/database/__init__.py | 6 ++++++ daemon/dscord/database/core.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 daemon/dscord/database/__init__.py create mode 100644 daemon/dscord/database/core.py diff --git a/daemon/dscord/database/__init__.py b/daemon/dscord/database/__init__.py new file mode 100644 index 0000000..c720e19 --- /dev/null +++ b/daemon/dscord/database/__init__.py @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# + +from .core import DB diff --git a/daemon/dscord/database/core.py b/daemon/dscord/database/core.py new file mode 100644 index 0000000..1a25388 --- /dev/null +++ b/daemon/dscord/database/core.py @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2022 Muhammad Rizki +# Copyright (C) 2022 Ammar Faizi +# + + +class DB: + def __init__(self, conn): + self.conn = conn + self.conn.autocommit = True + self.cur = self.conn.cursor(buffered=True) + + + def __del__(self): + self.cur.close() + self.conn.close() -- Muhammad Rizki