Skip to content

Latest commit

 

History

History
executable file
·
148 lines (111 loc) · 6.62 KB

File metadata and controls

executable file
·
148 lines (111 loc) · 6.62 KB

Contributing to the project

We want everybody to be able to contribute to our projects whatever your level or programming experiance is. Don't hesitate to ask for help on the Code Society's Discord server whatever the problem is.

How you can contribute?

You can contribute to this project in the follwing ways

Report a bug

  • Open an issue follwing the bug template.
  • Communicate directly with us on the Code Society's Discord server.
  • Fix the bug directly. To do so, follow add a changes.

Propose a new feature.

  • Open an issue follwing the feature request template.
  • Communicate directly with us on the Code Society's Discord server.

Add changes or Submitting a fix

Setting up the bot

Installing Grace is fairly simple. You can do it in three short step.

  1. Install Python and dependencies
  2. Set up your app and token
  3. Configuring the database

Install Python and dependencies

  1. The first step is pretty simple, install Python. You need to install Python 3.9 or higher.

  2. In the grace directory project, open a terminal (Linus/MacOS) or cmd (Windows) and execute pip install -e . (recommend for development) or pip install . to install all the dependencies needed in order to make the bot work. Wait until the process is finished.

Set up your app and token

First, if you didn't already do it, register your bot with Discord. Then, create a file called .env in the project directory. Open your new .env file and add DISCORD_TOKEN=<Your token> inside. (Replace by your discord token).

Do not share that file nor the information inside it to anyone.

Database

When Grace is started, a database configuration file will automatically be generated. SQLite is the default database used in development. If you wish to change it, you can follow the instruction below.

Changing database

In order for the bot to work, you need to connect it to a database. Supported databases are SQLite, MySQL/MariaDB, PostgresSQL, Oracle and Microsoft SQL Server. (Supported dialects)

To set up the connection to your database, create a new file in the config folder and call it database.cfg. You can have three database configurations, one for each environment (production, test and development). Each section is delimited by [database.<environment>].

The next step is to set up the adapter dialect + drivers (optional). The rest will depend on your database. Bellow, you'll find examples of common configuration.

You can also use config/database.template.cfg to help you set up your database.cfg.

SQLite

adapter = sqlite
database = grace.db

MySQL/MariaDB

adapter = mysql
user = grace
password = GraceHopper1234
host = localhost
port = 3306

PostgreSQL

adapter = postgresql+psycopg2
user = grace
password = GraceHopper1234
host = localhost
port = 5432

All those can be bypassed by directly passing an url.

To create the database, tables and add the default data, execute the following commands:

  • grace db create
  • grace db seed

Don't forget to specify the environment you are using with -e environment


Before adding your changes

  • Verify that there is no issue already created for the changes you want to bring. If there is and no one is assigned to the issue, assign it to yourself.
  • If there's no issue corresponding, create one. Don't forget to assign yourself the issue.

Adding your changes

Submit your PR

Once your PR is submited, we (the staff) will review it with you. The first thing you're going to want to do is a self review.

Review

We review every Pull Request. The purpose of reviews is to create the best code possible and ensure that the code is secured and respect the guidelines.

  • Reviews are always respectful, acknowledging that everyone did the best possible job with the knowledge they had at the time.
  • Reviews discuss content, not the person who created it.
  • Reviews are constructive and start conversation around feedback.

Self review

You should always review your own PR first.

How to self review my code?

  • Confirm that the changes meet the user experience and goals of the bot.
  • Ensure that your code is clean and follows Python's PEP-0008.
  • Verify your code for grammar and spelling mistakes (The code and the text must be in English).
  • Test your changes to ensure there's no bugs.

What to do after your PR is merged?

Congratulate yourself, you did it! The Code Society thank you for helping us improve our community.

Open a Pull Request

  • The name of the PR must be the same as the issue related to the PR.
  • The PR must be linked to the opened issue.
  • The PR must describe what change have been done.
    • Images or examples of the changes are more than welcome if necessary.

Code guidelines

  • The code must follow Python's PEP-0008.
  • The code must be consistent and use descriptive names.
  • The code must try to be the most modular as possible.

In case of doubt, don't hesitate to ask for help on the Discord server.


Additional information

  • All development has been tested on Linux. Running the bot on Windows could cause some issues or unexpected results.
  • Note that we reserve the right to close and/or refuse any issue (Don't worry we will indicate why).
  • Even after your PRs are merged, it may take some time to be applied on the server since the changes needs to be tested before entering in production.