public inbox for [email protected]
 help / color / mirror / Atom feed
From: Muhammad Rizki <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Muhammad Rizki <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH v2 00/28] The complete version of the Discord bot
Date: Tue,  4 Oct 2022 06:52:01 +0700	[thread overview]
Message-ID: <[email protected]> (raw)

Hi, sir

In this series, I create the complete version of the Discord bot.
This series contains slash commands, events, and basic commands for
syncing the slash commands to the global.

Features:
Add getter and deletion database methods.
Add a mail listener to get the new lore email message.
Add filters to only the lore admin who can use the atom.
Add broadcast manager slash commands.
Add a button UI to go direct to its lore email message.
And others.

Bugs:
This series contains fix a bug in the storage management on the
atom/utils.py, because I forgot to test the Telegram bot in the past.
Fix the empty temporary patch directory and patch directory deletion
after send patch files.

Small changes:
Rename some utility functions to make it simple and readable. Some
changes on the on_ready event give a tip message on what to do when the
bot first starts.

There are 28 patches in this series:
- Patch 1 is to add .gitignore file to ignore all patch directories
- Patch 2 is to add a platform parameter func for the storage management
- Patch 3 is to move the gen_temp() code when its necessary to call
- Patch 4 is to add get_atom_urls() to get the list of atom URLs in the DB
- Patch 5 is to add get_broadcast_chats() to get the list of Discord ch
- Patch 6 is to add get_email_id() to get the email ID of the PK emails
- Patch 7 is to add get_reply_id() to get the Discord message ID
- Patch 8 is to inherit Getter() to the DBMethods() class
- Patch 9 is to add delet_atom() to delete specific atom URL
- Patch 10 is to add delete_broadcast() to delete current Discord channel
- Patch 11 is to inherit Deletion() to the DBMethods() class
- Patch 12 is to inherit DBMethods() to the DB() class
- Patch 13 is to implement the created DB() class in the GWClient() class
- Patch 14 is to rename some utility functions
- Patch 15 is to add a FullMessageBtn() button URL class to go to the lore
- Patch 16 is to add a @filters.wait_on_limit() to handle the rate limit
- Patch 17 is to add send lore email message functions
- Patch 18 is to add a mail listener to get the new lore email message
- Patch 19 is to implement the mail Listener() class in the dc.py
- Patch 20 is to add a @filters.lore_admin() to filter only the lore admin
- Patch 21 is to add a `/atom list` slash command
- Patch 22 is to add a `/atom add` slash command
- Patch 23 is to add a `/atom delete` slash command
- Patch 24 is to add a channel_link() util function in the atom/utils.py
- Patch 25 is to add a `/broadcast list` slash command
- Patch 26 is to add a `/broadcast add` slash command
- Patch 27 is to add a `/broadcast delete` slash command
- Patch 28 is to add a tip message on the on_ready event

How to use:
1. Execute the db.sql file in the daemon directory,
2. Setup .env file, the example is there with suffix .example, this
   file name must remove the suffix name .example,
3. Set up the config.py in each bot directory, such as dscord and
   telegram. The example is there with suffix .example & the file name
   must remove suffix name .example,
4. Run `pip3 install -r requirements.txt` in each bot directory,
5. STORAGE_DIR env value must `storage` to make it work fine,
6. Run the bot by `python3 dc.py` or `python3 tg.py`.

Both tested and works fine. But, this PATCH series just only for Discord
bot first. Then, I will fix the same issue for the Telegram bot, thanks.

## Changelog

v1 -> v2
- Add .gitignore in the Discord's storage directory
- Fix the empty patch directory
- Fix the patch directory removal after send patch files, see commit 18/28

Muhammad Rizki (28):
  discord: Add .gitignore in the Discord's storage directory
  Fix the storage management after the refactor was happened
  Fix the empty temporary patch directory on atom/utils.py
  discord: Add get_atom_urls() to get the list of atom URLs
  discord: Add get_broadcast_chats() to get the list of broadcast chats
  discord: Add get_email_id() in getter directory
  discord: Add get_reply_id() in getter directory
  discord: Inherit Getter() class to the DBMethods() class
  discord: Add delete_atom() in deletion directory
  discord: Add delete_broadcast() in deletion directory
  discord: Inherit the Deletion() class to the DBMethods() class
  discord: Inherit the DBMethods() class to the DB() class
  discord: Use the created DB() class
  telegram: Rename some utility functions
  discord: Add a FullMessageBtn() class in models
  discord: Add filters.wait_on_limit() decorator
  discord: Add send lore email message functions
  discord: Add mail listener
  discord: Implement the mail Listener() class
  discord: Add @filters.lore_admin() decorator
  discord: Add a list of atom URL slash command
  discord: Add an add atom slash command
  discord: Add a delete atom slash command
  discord: Add channel_link() in the atom/utils.py
  discord: Add a list broadcast slash command
  discord: Add an add broadcast slash command
  discord: Add a delete broadcast slash command
  discord: Change the on_ready message

 daemon/atom/utils.py                          |  81 +++++++---
 daemon/dc.py                                  |  30 +++-
 daemon/dscord/database/core.py                |   5 +-
 daemon/dscord/database/methods/__init__.py    |   6 +-
 .../database/methods/deletion/__init__.py     |  14 ++
 .../database/methods/deletion/delete_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   |  60 +++++++
 .../database/methods/getter/get_reply.py      |  33 ++++
 daemon/dscord/gnuweeb/client.py               |  52 +++++-
 daemon/dscord/gnuweeb/filters.py              |  53 ++++++
 daemon/dscord/gnuweeb/models/__init__.py      |   6 +
 .../dscord/gnuweeb/models/full_message_btn.py |  12 ++
 daemon/dscord/gnuweeb/plugins/__init__.py     |   4 +-
 .../dscord/gnuweeb/plugins/events/on_ready.py |   7 +-
 .../plugins/slash_commands/__init__.py        |  13 ++
 .../plugins/slash_commands/manage_atom.py     |  81 ++++++++++
 .../slash_commands/manage_broadcast.py        |  84 ++++++++++
 daemon/dscord/mailer/__init__.py              |   7 +
 daemon/dscord/mailer/listener.py              | 153 ++++++++++++++++++
 daemon/dscord/storage/.gitignore              |   2 +
 daemon/telegram/mailer/listener.py            |   2 +-
 daemon/telegram/packages/client.py            |   6 +-
 26 files changed, 771 insertions(+), 30 deletions(-)
 create mode 100644 daemon/dscord/database/methods/deletion/__init__.py
 create mode 100644 daemon/dscord/database/methods/deletion/delete_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/gnuweeb/filters.py
 create mode 100644 daemon/dscord/gnuweeb/models/__init__.py
 create mode 100644 daemon/dscord/gnuweeb/models/full_message_btn.py
 create mode 100644 daemon/dscord/gnuweeb/plugins/slash_commands/__init__.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/mailer/__init__.py
 create mode 100644 daemon/dscord/mailer/listener.py
 create mode 100644 daemon/dscord/storage/.gitignore


base-commit: fdbccda0372a7869b7ac6b8c5b31ec1761b5e084
--
Muhammad Rizki

             reply	other threads:[~2022-10-03 23:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03 23:52 Muhammad Rizki [this message]
2022-10-03 23:52 ` [PATCH v2 01/28] discord: Add .gitignore in the Discord's storage directory Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 02/28] Fix the storage management after the refactor was happened Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 03/28] Fix the empty temporary patch directory on atom/utils.py Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 04/28] discord: Add get_atom_urls() to get the list of atom URLs Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 05/28] discord: Add get_broadcast_chats() to get the list of broadcast chats Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 06/28] discord: Add get_email_id() in getter directory Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 07/28] discord: Add get_reply_id() " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 08/28] discord: Inherit Getter() class to the DBMethods() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 09/28] discord: Add delete_atom() in deletion directory Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 10/28] discord: Add delete_broadcast() " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 11/28] discord: Inherit the Deletion() class to the DBMethods() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 12/28] discord: Inherit the DBMethods() class to the DB() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 13/28] discord: Use the created " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 14/28] telegram: Rename some utility functions Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 15/28] discord: Add a FullMessageBtn() class in models Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 16/28] discord: Add filters.wait_on_limit() decorator Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 17/28] discord: Add send lore email message functions Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 18/28] discord: Add mail listener Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 19/28] discord: Implement the mail Listener() class Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 20/28] discord: Add @filters.lore_admin() decorator Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 21/28] discord: Add a list of atom URL slash command Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 22/28] discord: Add an add atom " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 23/28] discord: Add a delete " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 24/28] discord: Add channel_link() in the atom/utils.py Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 25/28] discord: Add a list broadcast slash command Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 26/28] discord: Add an add " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 27/28] discord: Add a delete " Muhammad Rizki
2022-10-03 23:52 ` [PATCH v2 28/28] discord: Change the on_ready message Muhammad Rizki
2022-10-07 22:57 ` [PATCH v2 00/28] The complete version of the Discord bot 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