From 2ea9ba2433df6b66cb04ebc5985ffbc26d9742b5 Mon Sep 17 00:00:00 2001 From: Noelle Wang <73260931+No767@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:53:48 -0800 Subject: [PATCH] Expand docs to clarify unknown details (#22) * Add missing dev guide reference * Add a brief user guide * Add and improve on dev guide docs * Move contributing into `.github` * Update content of README.md and docs/index.rst --- .github/CONTRIBUTING.md | 4 + CONTRIBUTING.md | 3 - README.md | 6 +- docs/_static/assets/trunk-workflow.svg | 657 +++++++++++++++++++++++++ docs/dev-guide/contributing.rst | 113 +++++ docs/dev-guide/faq.rst | 12 +- docs/dev-guide/index.rst | 1 + docs/dev-guide/intro.rst | 22 +- docs/index.rst | 19 +- docs/user-guide/features.rst | 57 +++ docs/user-guide/index.rst | 10 + 11 files changed, 886 insertions(+), 18 deletions(-) create mode 100644 .github/CONTRIBUTING.md delete mode 100644 CONTRIBUTING.md create mode 100644 docs/_static/assets/trunk-workflow.svg create mode 100644 docs/dev-guide/contributing.rst create mode 100644 docs/user-guide/features.rst create mode 100644 docs/user-guide/index.rst diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..4a3d6ea --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,4 @@ +# Contributing + +Thank you for your interest in contributing to this project! +The rest of the document can be found [here](https://rodhaj.readthedocs.io/en/latest/dev-guide/contributing.html). \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index bdf4df9..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,3 +0,0 @@ -# Contributing - -This document has been moved to RTD. Please refer to the [developer guide](https://rodhaj.readthedocs.io/en/latest/index.html) instead. diff --git a/README.md b/README.md index 95ba686..fb9520f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Rodhaj +[![CodeQL](https://github.com/transprogrammer/rodhaj/actions/workflows/codeql.yml/badge.svg)](https://github.com/transprogrammer/rodhaj/actions/workflows/codeql.yml) [![Lint](https://github.com/transprogrammer/rodhaj/actions/workflows/lint.yml/badge.svg)](https://github.com/transprogrammer/rodhaj/actions/workflows/lint.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=transprogrammer_rodhaj&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=transprogrammer_rodhaj) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=transprogrammer_rodhaj&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=transprogrammer_rodhaj) + A improved, modern version of ModMail for Transprogrammer > [!IMPORTANT] @@ -18,11 +20,11 @@ sends a direct message to the bot, Rodhaj will create a new ticket (which is a f internally for staff to view. From there, each ticket is tied with a member and DMs from Rodhaj will be processed and sent to their respective tickets. To ensure that staff will be able to respond, each active staff is randomly assigned -to a particular ticket. This ensures that tickets are evenly distributed among staff. Staff are free to swap and work on multiple tickets as needed. Once a ticket is closed, the staff will be automatically unassigned from the ticket, and a new DM to Rodhaj will prompt the user to create a new ticket. +to a particular ticket. This ensures that tickets are evenly distributed among staff. Staff are free to swap and work on multiple tickets as needed. Once a ticket is closed, the staff will be automatically unassigned from the ticket, and a new DM to Rodhaj will prompt the user to create a new ticket. It's designed to be a replacement to ModMail. ## Contributing Contributions to Rodhaj are always welcomed. These could be as small as changing documentation to adding new features. If you are interested to start -the process, please consult the [developer guide](CONTRIBUTING.md) before +the process, please consult the [contributing guidelines](.github/CONTRIBUTING.md) before you get started. diff --git a/docs/_static/assets/trunk-workflow.svg b/docs/_static/assets/trunk-workflow.svg new file mode 100644 index 0000000..c00a864 --- /dev/null +++ b/docs/_static/assets/trunk-workflow.svg @@ -0,0 +1,657 @@ + + + + + Diagram 1 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/dev-guide/contributing.rst b/docs/dev-guide/contributing.rst new file mode 100644 index 0000000..02f269d --- /dev/null +++ b/docs/dev-guide/contributing.rst @@ -0,0 +1,113 @@ +============ +Contributing +============ + +Thank you for your interest in contributing to this project! + +The following is a set of guidelines for contributing to this project. +These are just guidelines, not rules. + +Ways You Can Contribute +======================= + +The ways you can contribute are not only limited to code changes, but so much more. +Some of the ways you can contribute are: + +- Reporting a bug +- Discussing the current state and future of the project +- Submitting a fix +- Proposing new features +- Improving or editing documentation + +Note that if you plan on proposing new features, please first discuss them with the project owners on the issues page. + +Writing Good Bug Reports +======================== + +Please be aware of the following when you submit a bug report: + +1. Ask on the server first (this is preferred). If you are unsure about an issue, please contact the dev lead (Noelle) for clarification. +2. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed. +3. When filing a bug about exceptions or tracebacks, please include the complete traceback. Without the complete traceback the issue might be unsolvable and you will be asked to provide more information. + +If a bug report is not clear enough, or missing these information, then more than likely +it'll take longer to fix the bug, or it'll be closed. More than likely clarification will +be asked in order to aid in this process. + +Submitting Code +=============== + +Submitting code is done through pull requests. Please ensure that the pull request +focuses on a single aspect and doesn't leave the scope of that aspect. You'll have to +keep in mind about the following guidelines when submitting code. + +Programming Style +----------------- + +In order to keep the code unified, `Black `_, `AutoFlake `_, and +`Isort `_ are used to format code to a consistent style. +In addition, linters such as `Pyright `_ and `Ruff `_ are +used to ensure that code quality is kept to its standards and properly type hinted. The formatters are ran automatically within a pre-commit +hook, which is ran before every commit. If you wish to run the pre-commit hook manually, you can run the following command: + +.. code-block:: bash + + pre-commit run --all-files + +.. note:: + + This project does follow the guidelines of `PEP-8 `_ strictly. Please ensure that + your code is in accordance with PEP-8. + +Static Code Analyzers +--------------------- + +In addition to the tools mentioned, `SonarCloud `_ is also used to analyze the codebase. +If there is a issue raised by SonarCloud, please fix it. If you are unsure about the issue, +please contact the dev lead (Noelle) for clarification. + +Pull Request Details +-------------------- + +Source Control Branching Model +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. figure:: /_static/assets/trunk-workflow.svg + :alt: Trunk Based Development Workflow + :align: center + +The model used for source control branching is `trunk-based `_. +The ``main`` branch is known to contain working code, and thus cannot be touched directly. + +.. _Branch Naming Convention: + +Branch Naming Convention +^^^^^^^^^^^^^^^^^^^^^^^^ + +When you create a branch, please use the following naming convention: + +.. code-block:: + + / + + +```` is your name (you can use your GitHub name) and ```` is a concise one to three word description of the branch. +For example, if a pull request has the name ``noelle/docs``, this indicates that the branch is created and owned by Noelle, +and the purpose of the branch is to update documentation. + +Pull Request Checklist +^^^^^^^^^^^^^^^^^^^^^^ + +When you create a pull request, please ensure that the following is done: + +1. Ensure that you have forked the repository and created a branch from ``main`` with the correct naming conventions as mentioned :ref:`above `. +2. Make sure that you have noted the changes in the ``changelog.md`` file. +3. Your code is properly formatted and linted (and all workflows are passing). + +Git Commit Guidelines +--------------------- + +1. Use present tense and imperative mood when writing commit messages. For example, ``Add new feature`` instead of ``Added new feature``. +2. Reference issues or pull requests outside of the first line. + a. Please use the shorthand ``#123`` and not the full URL. +3. Commits that need to skip the CI workflows must be prefixed with ``[skip ci]``. \ No newline at end of file diff --git a/docs/dev-guide/faq.rst b/docs/dev-guide/faq.rst index eadde6f..87df6b6 100644 --- a/docs/dev-guide/faq.rst +++ b/docs/dev-guide/faq.rst @@ -1,5 +1,6 @@ +=== FAQ ---- +=== This is a list of frequently asked questions. If you have a question that is not answered here, @@ -10,8 +11,8 @@ Slash Commands Questions regarding slash commands and how they operate in ``discord.py``. -Where are the slash commands? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Where Are The Slash Commands? +----------------------------- Unlike other frameworks, discord.py **does not** automatically sync slash commands for you (as slash commands need to be synced to Discord and are handled by them). @@ -28,3 +29,8 @@ such as the following: To see details information on why the practice of automatically syncing commands is bad, see `this gist `_ for more. + +.. note:: + + If you do not understand what is syncing, + please read the `syncing guide `_. \ No newline at end of file diff --git a/docs/dev-guide/index.rst b/docs/dev-guide/index.rst index 8be7cfe..494be33 100644 --- a/docs/dev-guide/index.rst +++ b/docs/dev-guide/index.rst @@ -8,4 +8,5 @@ Rodhaj offers a developer guide so future developers can easily get started with :maxdepth: 2 intro + contributing faq diff --git a/docs/dev-guide/intro.rst b/docs/dev-guide/intro.rst index df67401..9312b49 100644 --- a/docs/dev-guide/intro.rst +++ b/docs/dev-guide/intro.rst @@ -5,7 +5,7 @@ Introduction This is the documentation for Rodhaj, the modern ModMail bot for the transprogrammer server. Software Requirements ---------------------- +===================== Before you get started, please ensure you have the following installed: @@ -36,12 +36,13 @@ For a debian-based system, you can install them with the following command: Windows support should work but is not tested. Setup ------ +===== **Rodhaj only supports Python 3.9 or higher** .. important:: Ensure that you are in the root of the repo throughout this process + and have the database running 1. Fork and clone the repo @@ -71,8 +72,8 @@ Setup poetry run python bot/launcher.py Database -^^^^^^^^ - +-------- + The following SQL queries can be used to create the user and database: .. code-block:: sql @@ -86,9 +87,12 @@ The following SQL queries can be used to create the user and database: the PostgreSQL server. If you decide not to use Docker, you will need to manually create the database as shown below -Basic Concepts --------------- +Using Docker +^^^^^^^^^^^^ + +If you decide to use Docker to run the local PostgreSQL server, then a +pre-built Docker Compose file is provided. Simply run the following: + +.. code-block:: bash -Rodhaj works by implementing commands, which -are used staff. And Rodhaj takes care of assigning threads, creating tickets, etc. -More will be provided in-depth in other parts of the documentation. + docker compose -f docker-compose-dev.yml up -d \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 8e2ebd3..d2e03e9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,6 +11,7 @@ Rodhaj :hidden: :caption: Guides + user-guide/index dev-guide/index A improved, modern version of ModMail for the Transprogrammer community. @@ -20,6 +21,15 @@ but with a completely new, improved codebase and features. It works just like Re where users can send messages to the bot and the bot will relay it to the server's staff team. This allows for a process of communicating from user to staff to be streamlined, and securely done. +Features +-------- + +Rodhaj offers these features in addition to ones found on ModMail: + +- Advanced tags system +- Automatic ticket assignment (with manual override) +- Modern touch using forum channels, webhooks, and best practices +- Customizable settings What's Different? ----------------- @@ -34,4 +44,11 @@ Thus, **this bot has no invite**. Contributing ------------ -If you would like to contribute to Rodhaj, please read the guides below. +If you would like to contribute to Rodhaj, please read the guide below. + +- :doc:`dev-guide/index` + +Next Steps +----------- + +- Learn about Rodhaj's features in the :doc:`user-guide/features` guide. \ No newline at end of file diff --git a/docs/user-guide/features.rst b/docs/user-guide/features.rst new file mode 100644 index 0000000..df9c0a6 --- /dev/null +++ b/docs/user-guide/features.rst @@ -0,0 +1,57 @@ +============ +Features +============ + +This document describes the features of Rodhaj and an general description on them. + +User Features +============= + +These are the publicly available features that an user can use. + +Closing +------- + +Naturally as communications come to an end, users cannot simply leave the ticket stale. +In order to close a ticket, it is recommended to use the ``?close`` command. +The ticket will be marked as closed to the user and subsequently closed on the ticket pool. +Once closed, a ticket cannot be reopened. If a staff uses the ``?close`` command, +the active ticket will be closed and the user will be notified of the closure. + +Note that there is no plans to support timed closures, as it is a design feature fudmentally flawed for this type of command. + +Administrative Features +======================= + +Replying +-------- + +In order to reply to a thread, use the ``?reply`` command. This will send a message to the user within an active ticket. +Without executing this command, all messages will be seen as internal in the ticket. Images attachments, emojis, and stickers +are supported. + +.. note:: + + Unlike ModMail, **none** of the messages sent with the ``?reply`` command, internally in the ticket, or by the user to staff + will be logged. This is to ensure that the privacy of the user is respected. Staff can always look back at an closed ticket + within the ticket channel if they need to refer to a particular message. + +Tags +---- + +To aid with frequent responses, tags can be used. Tags do not have an owner associated, thus they can be used and edited by any staff member. +Tags can be used by using the ``?tag `` command, where ```` represents the name of the tag that should be used. +By default, they are sent directly to the user who is in the ticket, but can be sent internally by using the ``--ns`` flag. + + +Ticket Assignee +--------------- + +As tickets are created, they are assigned to a staff member. This is done to ensure that the ticket is not left unattended. +The ticket assignee is randomly selected from the staff members who are online. If no staff members are online, then there will not be a ticket assignee. +In order to manually assign a ticket, the ``?assign`` command can be used. This will assign the ticket to the staff member who executed the command. + +When the ticket is created, the staff is notified in a channel that logs events related to tickets. This is done to ensure that the staff is aware of the ticket +and can act accordingly. + + diff --git a/docs/user-guide/index.rst b/docs/user-guide/index.rst new file mode 100644 index 0000000..031992a --- /dev/null +++ b/docs/user-guide/index.rst @@ -0,0 +1,10 @@ +================ +User Guide +================ + +This document represents the user guide for Rodhaj + +.. toctree:: + :maxdepth: 2 + + features \ No newline at end of file