1
0
Fork 0
llama-bot/CONTRIBUTING.md

3.3 KiB

Contribution guide

Table of contents

Purpose

There are several goals this guide aims to achieve:

  • Help new contributors get started
  • Prevent information fragmentation as people work on different parts of the software
  • Streamline the development workflow
  • Make things work in the project owner's absence
  • Minimize intervention and back-and-forth communication (e.g. The contributor didn't format their code properly)

Assumptions

All contributors are assumed to be familiar with the following:

  • git (and by extension github and developer collaboration)
  • node.js and its ecosystem (npm packages, yarn, etc.)
  • javascript and typescript
  • code formatting

Getting started

Development environment

Contributors are free to use whatever IDE they want but the usage of vscode is highly recommended.

Format markdown file(s) with prettier formatter

Required knowledge

Bot

Web Interface

Documentation

Commit message

The commit message should be a clear and concise description of what the commit does. The first line should be no more than 50 characters and the rest no more than 72.

Creating / updating a command

Use the CustomCommand defined in src/custom/CustomCommand.ts instead of importing from @sapphire/framework.

Help message

  • consistent usage information

Structure

  • one export per command

    • functions should be static whenever possible
  • Keep the messageRun function clean (ideally less than 50 lines).

  • Separate regular imports from type imports.

  • Separate the embedded message building process to a separate function.

    This also makes testing easier

  • jsdoc comments should...

    • not include argument and return types.

      They should be included in the function instead.

    • not include a dash (-) in the @returns tag.

    Do this:

    /**
     * This function does something.
     *
     * - Here's some extra information
     *
     * @param argument - This is an argument.
     * @returns some string.
     */
    function someFunction(argument: string): string {
    	const someString = "some string"
    
    	return someString
    }
    

    Not this:

    /**
     * This function does something.
     *
     * - Here's some extra information
     *
     * @param {string} argument - This is an argument.
     * @returns {string}  - some string.
     */
    function someFunction(argument) {
    	const someString = "some string"
    
    	return someString
    }