GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
From: Muhammad Rizki <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Muhammad Rizki <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>
Subject: [RFC PATCH v1 0/5] Refactor some Telegram bot source code
Date: Tue,  6 Sep 2022 18:19:24 +0700	[thread overview]
Message-ID: <[email protected]> (raw)

Afternoon sir,
I just want to ask if this series okay to review or not?
These series is still undone, just to make sure that this series is
okay to review so that I can continue to the Discord bot.

There are 5 patches in this series:
- Patch 1 is to move Telegram bot SC, bcz there will a Discord bot
- Patch 2 is to refactor bot database to split between insert, del, get
- Patch 3 is to rename some functions to make it understandable
- Patch 4 is jsut remove some unecessary files
- Patch 5 is to refactor many files like atoms, scraper, etc

Patch 5 contains:
- Rename some functions in utils
- Rename file name in telegram such as scraper => mailer
- Move class Mutexes to utility file
- Rename the Mutexes attribute send_to_tg => lock
- Changes affected codes during this refactor

How to use:
1. Execute db.sql in daemon directory
2. Set value for environments for telegram bot, you can see the example
   in the telegram.env.example, this env file name must telegram.env
3. Set config.py in the telegram/config.py
4. Install all requirements package by executing
   `python3 -m pip install requirements.txt` in the telegram directory
5. Run the telegram bot by executing `python3 tg.py` in daemon directory

Tested and works fine, thanks.

Muhammad Rizki (5):
  [telegram] Move the Telegram bot source code
  [telegram] Refactor Telegram bot database method
  [telegram] Renaming some functions in scraper/bot.py
  [telegram] Remove unecessary files
  Refactor many files

 .gitignore                                    |   4 +-
 daemon/atom/__init__.py                       |   7 +
 daemon/{scraper => atom}/scraper.py           |  12 +-
 daemon/{scraper => atom}/utils.py             |  87 +++++--
 daemon/db.sql                                 |  18 +-
 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 ++
 .../{scraper => telegram/mailer}/__init__.py  |   4 +-
 .../bot.py => telegram/mailer/listener.py}    |  48 ++--
 daemon/{ => telegram}/packages/__init__.py    |   0
 daemon/{ => telegram}/packages/client.py      |  12 +-
 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      |   0
 daemon/{run.py => tg.py}                      |  24 +-
 38 files changed, 541 insertions(+), 324 deletions(-)
 create mode 100644 daemon/atom/__init__.py
 rename daemon/{scraper => atom}/scraper.py (79%)
 rename daemon/{scraper => atom}/utils.py (72%)
 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
 rename daemon/{scraper => telegram/mailer}/__init__.py (68%)
 rename daemon/{scraper/bot.py => telegram/mailer/listener.py} (69%)
 rename daemon/{ => telegram}/packages/__init__.py (100%)
 rename daemon/{ => telegram}/packages/client.py (88%)
 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%)
 rename daemon/{ => telegram}/storage/.gitignore (100%)
 rename daemon/{run.py => tg.py} (68%)


base-commit: 2582d7e5225d47a01f606808fc71e5e6aa7cb153
-- 
Muhammad Rizki


             reply	other threads:[~2022-09-06 11:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 11:19 Muhammad Rizki [this message]
2022-09-06 11:19 ` [RFC PATCH v1 1/5] [telegram] Move the Telegram bot source code Muhammad Rizki
2022-09-06 11:19 ` [RFC PATCH v1 2/5] [telegram] Refactor Telegram bot database method Muhammad Rizki
2022-09-06 11:19 ` [RFC PATCH v1 3/5] [telegram] Renaming some functions in scraper/bot.py Muhammad Rizki
2022-09-06 16:11   ` Ammar Faizi
2022-09-06 11:19 ` [RFC PATCH v1 4/5] [telegram] Remove unecessary files Muhammad Rizki
2022-09-06 16:02   ` Ammar Faizi
2022-09-06 16:46     ` Muhammad Rizki
2022-09-06 16:53       ` Ammar Faizi
2022-09-06 11:19 ` [RFC PATCH v1 5/5] Refactor many files Muhammad Rizki
2022-09-06 16:04   ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox