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 7AD4F7E328; Fri, 29 Jul 2022 01:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1659058895; bh=f4DyV6TYE3JDkWYN57PfsOOQkL8wtBCqSA6RIuCO/q4=; h=From:To:Cc:Subject:Date:From; b=sFM3i2oPvrbXNX0ajdhcpbZsFeduxAFic5/23UH6bKX2C3DiM3hHhYkhi+RcLuDLz vz1RM8K8s9SydCPeGoo5N41uw1lj7DD0jB3EXX3iEmwsIrBW1Ew+6e3cbmQsff1OkI KgZ58G68PkvXJDtACeJLTik0x9ad+v4Ff31qnKq1kRKKzE7B1fyv3QtFNd+WT3EWs4 gz92UAZK1dtAvElN8jaL7W+G8SJhChk4MqVTXV3EQQ2UGrk4ANEW/d3Q+lM2YIMl1A RUCCIy+/M78TiJNOWLyvcyeF2QTu4npTX/0huYs2QiOx3Xc9rjG43QDFcDfQDb3vmW l5O4R2rkLfMFg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , GNU/Weeb Mailing List , Alviro Iskandar Setiawan Subject: [PATCH v3 00/18] New feature to handle atom URLs and broadcast Date: Fri, 29 Jul 2022 08:40:34 +0700 Message-Id: <20220729014052.1547-1-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Morning sir, This is v3 revision of new feature to handle atom URLs and broadcast In this series I combine the atom URLs and broadcast SQL tables to db.sql and remove the atom_broadcast.sql. Also, I change the atom_urls data type of `type` field to VARCHAR(255). This series contains a new feature to handle the atom URLs and broadcast chats, such as add atom, add chat, del_atom and del_chat, with this feature, we do not manual manage them again, just using the bot commands and it will update in database. There are 18 patches in this series: - Patch 1 is to Add new table for atom URLs and broadcast chats - Patch 2 is to add get atom URLs and get broadcast chats - Patch 3 is to fix MySQL InternalError when query the atom and chats - Patch 4 is to create /add_atom bot command to atom URL to database - Patch 5 is to add some utility functions to handle code in /add_atom - Patch 6 is to refactor db class to easily access over DaemonClient - Patch 7 is to add insert_atom() in scraper/db.py to insert atom URLs - Patch 8 is to rename admin.py to debugger. - Patch 9 is to add delete_atom() in scraper/db.py for /del_atom command - Patch 10 is to add button_numbers() in utility file to create btn nums - Patch 11 is to split files between bot commands and bot CallbackQuery - Patch 12 is to add del_atom for CallbackQuery to handle delete atom - Patch 13 is to add insert_broadcast() in scraper/db.py to insert chats - Patch 14 is to add delete_broadcast() in scraper/db.py to delete chats - Patch 15 is to create /add_bc bot command to add chat to the database - Patch 16 is to add create_chat_link() in utility file for chat link - Patch 17 is to add /del_bc bot command to remove chat in the database - Patch 18 is to add del_chat in bot CallbackQuery to handle delete chat Already tested and it works fine, please give it a test too if there is a bug or unexpected errors, thanks. ## Changelog v2 -> v3 - Combine the atom_urls and broadcast_chats tables in db.py - Remove atom_broadcast.sql - Change atom_urls data type of `type` field to VARCHAR(255) v1 -> v2 - Improve delete_broadcast() source code in scraper/db.py - Fix typehints to int for chat_id param in scraper/db.py Signed-off-by: Muhammad Rizki --- Muhammad Rizki (18): Add new table for atom URLs and broadcast chats in db.sql Add ATOM_URLS and BROADCAST_CHAT methods Fix MySQL InternalError: Unread result found Create /add_atom command Add utility functions for /add_atom Refactor database methods Add insert_atom() in scraper/db.py Rename admin.py to debugger.py Add delete_atom() function in scraper/db.py Add utility function buton_numbers() Move bot commands related files to packages/plugins/commands/ Add del_atom callback query Add insert_broadcast() in scraper/db.py Add delete_broadcast() in scraper/db.py Create /add_bc bot command Add create_chat_link() function Add /del_bc bot command Add del_chat callback query .gitignore | 4 + daemon/db.sql | 25 +++++ daemon/packages/client.py | 4 +- daemon/packages/plugins/callbacks/del_atom.py | 31 +++++ daemon/packages/plugins/callbacks/del_chat.py | 36 ++++++ .../{admin.py => commands/debugger.py} | 0 .../packages/plugins/commands/manage_atom.py | 50 +++++++++ .../plugins/commands/manage_broadcast.py | 66 +++++++++++ .../packages/plugins/{ => commands}/scrape.py | 0 daemon/run.py | 16 +-- daemon/scraper/bot.py | 22 +--- daemon/scraper/db.py | 106 +++++++++++++++++- daemon/scraper/utils.py | 45 ++++++++ 13 files changed, 379 insertions(+), 26 deletions(-) create mode 100644 daemon/packages/plugins/callbacks/del_atom.py create mode 100644 daemon/packages/plugins/callbacks/del_chat.py rename daemon/packages/plugins/{admin.py => commands/debugger.py} (100%) create mode 100644 daemon/packages/plugins/commands/manage_atom.py create mode 100644 daemon/packages/plugins/commands/manage_broadcast.py rename daemon/packages/plugins/{ => commands}/scrape.py (100%) base-commit: f8c5aef0aa85e1262c90f818638d255c3c38373f -- Muhammad Rizki