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.254]) by gnuweeb.org (Postfix) with ESMTPSA id CCA037E3B9; Sat, 27 Aug 2022 03:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1661569375; bh=KjOWZSXZ6GEZ6FGnxaYPjSDkSSzSsfABq8JklNNXoUM=; h=From:To:Cc:Subject:Date:From; b=iuMSSIGEXQFPgQ2WmSOsWYTyysDwPpmSytC5yrUTOn1JZSX3OKqQdPk74Hp9SIZ+3 rb6GE0MdIEjv3o8Fx+DHbyaEc9YeFQPW06UAoZzYfSLMP9WoeFFqatjf4zvkwA90hn xoahomjESdvv2LD50HHDrlLM0WiN1kT1UPquMrCuDVTzY9sgibuM57ynNBDPm/Dg67 abuEX+6HbsU7gSUwx5a0Kbgke5trQ5T2A84Ue9lUCGHYg+49VGyDu+atlBDheRpZHe J/WmLL2gvdLXaB59Ur3lq15i8cOpU6OS0GXWoOvxYinHURS4vdT5WP1hhrN+iU5+B4 vOV8xXDqtdnPg== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , GNU/Weeb Mailing List , Alviro Iskandar Setiawan Subject: [PATCH v2 0/3] New Discord bot and full refactor scripts Date: Sat, 27 Aug 2022 10:02:33 +0700 Message-Id: <20220827030236.1094-1-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Good morning, sir In this series I created a Discord bot, the functionality and features still the same with the Telegram bot, this series contains full refactor both Discord and Telegram bot scripts which is more cleaner. Refactors: Moving the atom related files outside the bot scripts which is can be reusable with each other bot scripts. Moving the database related files and create a directory for themselves, this method is more clean so it's more easier to develop and maintain. Mass refactor for Telegram and Discord bot scripts. Combine the SQL file for Discord and Telegram bot, so we don't have to make a new database. There are 3 patches in this series: 1. Patch 1 is moving the Telegram bot for splitting between Discord bot. 2. Patch 2 is to release the Discord bot. 3. Patch 3 is to mass refactor like atom, Telegram bot, and Discord bot. Both bot scripts are tested and works fine, please give it a test too if there is any unexpted errors, bugs, and results, thanks. Muhammad Rizki (3): Move the Telegram bot source code First release Discord bot Full refactor bot scripts .gitignore | 7 +- daemon/{scraper => atom}/__init__.py | 4 +- daemon/{scraper => atom}/scraper.py | 12 +- daemon/{scraper => atom}/utils.py | 87 +++++-- daemon/db.sql | 75 +++++- daemon/dc.py | 48 ++++ daemon/discord.env.example | 8 + daemon/dscord/config.py.example | 9 + daemon/dscord/database/__init__.py | 6 + daemon/dscord/database/core.py | 19 ++ daemon/dscord/database/methods/__init__.py | 16 ++ .../database/methods/deletion/__init__.py | 8 + .../database/methods/deletion/delet_atom.py | 12 + .../methods/deletion/delete_broadcast.py | 12 + .../database/methods/getter/__init__.py | 12 + .../database/methods/getter/get_atom_urls.py | 18 ++ .../methods/getter/get_broadcast_chats.py | 18 ++ .../database/methods/getter/get_email_id.py | 56 +++++ .../database/methods/getter/get_reply.py | 29 +++ .../database/methods/insertion/__init__.py | 12 + .../database/methods/insertion/insert_atom.py | 20 ++ .../methods/insertion/insert_broadcast.py | 42 ++++ .../methods/insertion/insert_discord.py | 14 ++ .../methods/insertion/insert_email.py | 20 ++ daemon/dscord/gnuweeb/__init__.py | 6 + daemon/dscord/gnuweeb/client.py | 108 +++++++++ daemon/dscord/gnuweeb/filters.py | 67 ++++++ daemon/dscord/gnuweeb/models/__init__.py | 6 + daemon/dscord/gnuweeb/models/ui/__init__.py | 6 + .../gnuweeb/models/ui/buttons/__init__.py | 6 + .../models/ui/buttons/full_message_btn.py | 21 ++ daemon/dscord/gnuweeb/plugins/__init__.py | 20 ++ .../plugins/basic_commands/__init__.py | 13 ++ .../plugins/basic_commands/debugger.py | 20 ++ .../gnuweeb/plugins/basic_commands/sync_it.py | 20 ++ .../dscord/gnuweeb/plugins/events/__init__.py | 13 ++ .../dscord/gnuweeb/plugins/events/on_error.py | 17 ++ .../dscord/gnuweeb/plugins/events/on_ready.py | 24 ++ .../plugins/slash_commands/__init__.py | 15 ++ .../plugins/slash_commands/get_lore_mail.py | 47 ++++ .../plugins/slash_commands/manage_atom.py | 81 +++++++ .../slash_commands/manage_broadcast.py | 83 +++++++ daemon/dscord/gnuweeb/utils.py | 52 +++++ daemon/dscord/mailer/__init__.py | 6 + daemon/dscord/mailer/listener.py | 148 ++++++++++++ daemon/dscord/requirements.txt | 8 + daemon/{ => dscord}/storage/.gitignore | 0 daemon/packages/__init__.py | 1 - daemon/scraper/db.py | 217 ------------------ daemon/{.env.example => telegram.env.example} | 0 daemon/{ => telegram}/config.py.example | 0 daemon/telegram/database/__init__.py | 7 + daemon/telegram/database/core.py | 20 ++ daemon/telegram/database/methods/__init__.py | 17 ++ .../database/methods/deletion/__init__.py | 14 ++ .../database/methods/deletion/delet_atom.py | 15 ++ .../methods/deletion/delete_broadcast.py | 15 ++ .../database/methods/getter/__init__.py | 18 ++ .../database/methods/getter/get_atom_urls.py | 21 ++ .../methods/getter/get_broadcast_chats.py | 21 ++ .../database/methods/getter/get_email_id.py | 62 +++++ .../methods/getter/get_telegram_reply.py | 33 +++ .../database/methods/insertion/__init__.py | 18 ++ .../database/methods/insertion/insert_atom.py | 27 +++ .../methods/insertion/insert_broadcast.py | 56 +++++ .../methods/insertion/insert_email.py | 27 +++ .../methods/insertion/insert_telegram.py | 21 ++ daemon/telegram/mailer/__init__.py | 8 + .../bot.py => telegram/mailer/listener.py} | 63 +++-- daemon/telegram/packages/__init__.py | 6 + daemon/{ => telegram}/packages/client.py | 18 +- daemon/{ => telegram}/packages/decorator.py | 6 +- .../packages/plugins/callbacks/del_atom.py | 8 +- .../packages/plugins/callbacks/del_chat.py | 8 +- .../packages/plugins/commands/debugger.py | 4 +- .../packages/plugins/commands/manage_atom.py | 10 +- .../plugins/commands/manage_broadcast.py | 10 +- .../packages/plugins/commands/scrape.py | 12 +- daemon/{ => telegram}/requirements.txt | 0 daemon/telegram/storage/.gitignore | 2 + daemon/{run.py => tg.py} | 22 +- 81 files changed, 1793 insertions(+), 345 deletions(-) rename daemon/{scraper => atom}/__init__.py (54%) rename daemon/{scraper => atom}/scraper.py (79%) rename daemon/{scraper => atom}/utils.py (72%) create mode 100644 daemon/dc.py create mode 100644 daemon/discord.env.example create mode 100644 daemon/dscord/config.py.example create mode 100644 daemon/dscord/database/__init__.py create mode 100644 daemon/dscord/database/core.py create mode 100644 daemon/dscord/database/methods/__init__.py create mode 100644 daemon/dscord/database/methods/deletion/__init__.py create mode 100644 daemon/dscord/database/methods/deletion/delet_atom.py create mode 100644 daemon/dscord/database/methods/deletion/delete_broadcast.py create mode 100644 daemon/dscord/database/methods/getter/__init__.py create mode 100644 daemon/dscord/database/methods/getter/get_atom_urls.py create mode 100644 daemon/dscord/database/methods/getter/get_broadcast_chats.py create mode 100644 daemon/dscord/database/methods/getter/get_email_id.py create mode 100644 daemon/dscord/database/methods/getter/get_reply.py create mode 100644 daemon/dscord/database/methods/insertion/__init__.py create mode 100644 daemon/dscord/database/methods/insertion/insert_atom.py create mode 100644 daemon/dscord/database/methods/insertion/insert_broadcast.py create mode 100644 daemon/dscord/database/methods/insertion/insert_discord.py create mode 100644 daemon/dscord/database/methods/insertion/insert_email.py create mode 100644 daemon/dscord/gnuweeb/__init__.py create mode 100644 daemon/dscord/gnuweeb/client.py create mode 100644 daemon/dscord/gnuweeb/filters.py create mode 100644 daemon/dscord/gnuweeb/models/__init__.py create mode 100644 daemon/dscord/gnuweeb/models/ui/__init__.py create mode 100644 daemon/dscord/gnuweeb/models/ui/buttons/__init__.py create mode 100644 daemon/dscord/gnuweeb/models/ui/buttons/full_message_btn.py create mode 100644 daemon/dscord/gnuweeb/plugins/__init__.py create mode 100644 daemon/dscord/gnuweeb/plugins/basic_commands/__init__.py create mode 100644 daemon/dscord/gnuweeb/plugins/basic_commands/debugger.py create mode 100644 daemon/dscord/gnuweeb/plugins/basic_commands/sync_it.py create mode 100644 daemon/dscord/gnuweeb/plugins/events/__init__.py create mode 100644 daemon/dscord/gnuweeb/plugins/events/on_error.py create mode 100644 daemon/dscord/gnuweeb/plugins/events/on_ready.py create mode 100644 daemon/dscord/gnuweeb/plugins/slash_commands/__init__.py create mode 100644 daemon/dscord/gnuweeb/plugins/slash_commands/get_lore_mail.py create mode 100644 daemon/dscord/gnuweeb/plugins/slash_commands/manage_atom.py create mode 100644 daemon/dscord/gnuweeb/plugins/slash_commands/manage_broadcast.py create mode 100644 daemon/dscord/gnuweeb/utils.py create mode 100644 daemon/dscord/mailer/__init__.py create mode 100644 daemon/dscord/mailer/listener.py create mode 100644 daemon/dscord/requirements.txt rename daemon/{ => dscord}/storage/.gitignore (100%) delete mode 100644 daemon/packages/__init__.py delete mode 100644 daemon/scraper/db.py rename daemon/{.env.example => telegram.env.example} (100%) rename daemon/{ => telegram}/config.py.example (100%) create mode 100644 daemon/telegram/database/__init__.py create mode 100644 daemon/telegram/database/core.py create mode 100644 daemon/telegram/database/methods/__init__.py create mode 100644 daemon/telegram/database/methods/deletion/__init__.py create mode 100644 daemon/telegram/database/methods/deletion/delet_atom.py create mode 100644 daemon/telegram/database/methods/deletion/delete_broadcast.py create mode 100644 daemon/telegram/database/methods/getter/__init__.py create mode 100644 daemon/telegram/database/methods/getter/get_atom_urls.py create mode 100644 daemon/telegram/database/methods/getter/get_broadcast_chats.py create mode 100644 daemon/telegram/database/methods/getter/get_email_id.py create mode 100644 daemon/telegram/database/methods/getter/get_telegram_reply.py create mode 100644 daemon/telegram/database/methods/insertion/__init__.py create mode 100644 daemon/telegram/database/methods/insertion/insert_atom.py create mode 100644 daemon/telegram/database/methods/insertion/insert_broadcast.py create mode 100644 daemon/telegram/database/methods/insertion/insert_email.py create mode 100644 daemon/telegram/database/methods/insertion/insert_telegram.py create mode 100644 daemon/telegram/mailer/__init__.py rename daemon/{scraper/bot.py => telegram/mailer/listener.py} (64%) create mode 100644 daemon/telegram/packages/__init__.py rename daemon/{ => telegram}/packages/client.py (80%) rename daemon/{ => telegram}/packages/decorator.py (88%) rename daemon/{ => telegram}/packages/plugins/callbacks/del_atom.py (80%) rename daemon/{ => telegram}/packages/plugins/callbacks/del_chat.py (85%) rename daemon/{ => telegram}/packages/plugins/commands/debugger.py (91%) rename daemon/{ => telegram}/packages/plugins/commands/manage_atom.py (86%) rename daemon/{ => telegram}/packages/plugins/commands/manage_broadcast.py (89%) rename daemon/{ => telegram}/packages/plugins/commands/scrape.py (82%) rename daemon/{ => telegram}/requirements.txt (100%) create mode 100644 daemon/telegram/storage/.gitignore rename daemon/{run.py => tg.py} (69%) base-commit: 2582d7e5225d47a01f606808fc71e5e6aa7cb153 -- Muhammad Rizki