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 E2C7D8061E; Thu, 25 Aug 2022 16:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1661443809; bh=eScEBDwiVdetw22QxA3EmpvD9Nq+DIS02X9toocbTSk=; h=From:To:Cc:Subject:Date:From; b=qk6v3em1vSO3mb16MltB6m+0E4XyC73fsvtVWRmksuTOx2ONTTHgSsPEjke6LexWl dbhVadwpjE01KgrS69L9ngWh7tWT0dHXE6bXnLukTSUxLNSyrInX1zX0eUSJH4Xysm GBC7v6Vu0sQxXguYXwUxff3d1am3Rxhb7XGLHd/3SFElpwLHXNaOmwbSHPOCh5mbqK nY0Bqzm57m3erP05jrLXdj0+0IoiDDa/2thWj05+lAjKMLf4XeBVVrHf29BNyKmqxn x5Y5jlw/XN2dL9IHsNin8LgTPYlijg4PMsIJTh3u4LUmEuZ9BUWrrpGwu1yRJXRlRX obSSXr5zNI9HQ== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , GNU/Weeb Mailing List , Alviro Iskandar Setiawan Subject: [PATCH v1 0/3] New Discord bot and full refactor scripts Date: Thu, 25 Aug 2022 23:09:50 +0700 Message-Id: <20220825160953.1458-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 night, 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. 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/atom/__init__.py | 1 + daemon/{scraper => atom}/scraper.py | 12 +- daemon/{scraper => atom}/utils.py | 87 +++++++--- daemon/dc.py | 48 ++++++ daemon/discord.env.example | 8 + daemon/dscord/config.py.example | 9 ++ daemon/dscord/database/__init__.py | 1 + daemon/dscord/database/core.py | 19 +++ daemon/dscord/database/methods/__init__.py | 10 ++ .../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/execute_me.sql | 64 ++++++++ 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 + .../db.py => dscord/mailer/database.py} | 96 +++++------- daemon/dscord/mailer/listener.py | 148 ++++++++++++++++++ daemon/dscord/requirements.txt | 8 + daemon/{ => dscord}/storage/.gitignore | 0 daemon/{.env.example => telegram.env.example} | 0 daemon/telegram/__init__.py | 0 daemon/{ => telegram}/config.py.example | 0 daemon/telegram/database/__init__.py | 1 + daemon/telegram/database/core.py | 19 +++ daemon/telegram/database/methods/__init__.py | 10 ++ .../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 | 58 +++++++ .../methods/getter/get_telegram_reply.py | 29 ++++ .../database/methods/insertion/__init__.py | 12 ++ .../database/methods/insertion/insert_atom.py | 20 +++ .../methods/insertion/insert_broadcast.py | 49 ++++++ .../methods/insertion/insert_email.py | 20 +++ .../methods/insertion/insert_telegram.py | 14 ++ daemon/{ => telegram}/db.sql | 0 .../{scraper => telegram/mailer}/__init__.py | 5 +- .../bot.py => telegram/mailer/listener.py} | 61 ++++---- daemon/{ => telegram}/packages/__init__.py | 0 daemon/{ => telegram}/packages/client.py | 16 +- daemon/{ => telegram}/packages/decorator.py | 0 .../packages/plugins/callbacks/del_atom.py | 6 +- .../packages/plugins/callbacks/del_chat.py | 6 +- .../packages/plugins/commands/debugger.py | 2 +- .../packages/plugins/commands/manage_atom.py | 8 +- .../plugins/commands/manage_broadcast.py | 8 +- .../packages/plugins/commands/scrape.py | 10 +- daemon/{ => telegram}/requirements.txt | 0 daemon/telegram/storage/.gitignore | 2 + daemon/{run.py => tg.py} | 20 +-- 82 files changed, 1718 insertions(+), 160 deletions(-) create mode 100644 daemon/atom/__init__.py 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/execute_me.sql 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 rename daemon/{scraper/db.py => dscord/mailer/database.py} (63%) create mode 100644 daemon/dscord/mailer/listener.py create mode 100644 daemon/dscord/requirements.txt rename daemon/{ => dscord}/storage/.gitignore (100%) rename daemon/{.env.example => telegram.env.example} (100%) create mode 100644 daemon/telegram/__init__.py 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 rename daemon/{ => telegram}/db.sql (100%) rename daemon/{scraper => telegram/mailer}/__init__.py (68%) rename daemon/{scraper/bot.py => telegram/mailer/listener.py} (66%) rename daemon/{ => telegram}/packages/__init__.py (100%) rename daemon/{ => telegram}/packages/client.py (84%) rename daemon/{ => telegram}/packages/decorator.py (100%) rename daemon/{ => telegram}/packages/plugins/callbacks/del_atom.py (88%) rename daemon/{ => telegram}/packages/plugins/callbacks/del_chat.py (90%) rename daemon/{ => telegram}/packages/plugins/commands/debugger.py (97%) rename daemon/{ => telegram}/packages/plugins/commands/manage_atom.py (91%) rename daemon/{ => telegram}/packages/plugins/commands/manage_broadcast.py (92%) rename daemon/{ => telegram}/packages/plugins/commands/scrape.py (86%) rename daemon/{ => telegram}/requirements.txt (100%) create mode 100644 daemon/telegram/storage/.gitignore rename daemon/{run.py => tg.py} (75%) base-commit: 2582d7e5225d47a01f606808fc71e5e6aa7cb153 -- Muhammad Rizki