Bot.ts
  • Introduction
  • Installation
  • Configuration
  • Migrate to v9
  • Troubleshooting
  • Command line
    • CLI Overview
    • Docker
    • Build
    • Start
    • Format
    • Lint
    • Test
    • Update
    • Readme
    • Final
  • Usage
    • Command
    • Listener
    • Button
    • Namespace
    • Cron
    • Logger
    • Paginator
    • Database
    • Caching
    • Custom types
  • Native commands
    • Eval
    • Help
    • Database
    • Terminal
    • Turn
    • Info
  • Command examples
    • Prefix
  • Utilities
    • Texts
    • Paths and URLs
    • Dates and durations
    • Special events
    • Other
  • Deployment
    • Production
    • Development
  • Contributing
    • Regulations
    • Coding Style
  • Annexes
    • Discord Support
Powered by GitBook
On this page
  • Naming Conventions
  • Spacing and Indentation
  • Line Length
  • Comments
  • Imports
  • Example
  • CLI

Was this helpful?

  1. Contributing

Coding Style

This document outlines the coding standards and best practices for the bot.ts project. Following these guidelines ensures consistency and maintainability across the codebase.

Naming Conventions

  • Use camelCase for variable and function names.

  • Use PascalCase for class and interface names.

  • Use SNAKE_CASE for environment variables and file names.

Spacing and Indentation

  • Use 2 spaces for indentation.

Line Length

  • Limit lines to a maximum of 80 characters.

Comments

  • Only use // for one-line comments.

  • Use /* */ for JSDoc-style comments.

Imports

  • Organize imports in "letter-count" order. (from shortest to longest)

  • Avoid using relative imports.

  • Use only the imports aliased in package.json for local imports.

  • Use import type for types-only imports.

  • Group imports by type: local imports first, followed by first-party libraries.

  • Keep imports sorted alphabetically within each group.

  • Remove unused imports.

  • Use destructuring for commonly used imports.

  • Use * as for every imports of file if too many imports are present in the file.

Example

import { Command } from "#core/command"
import { SlashCommand } from "#core/slash"
import { getSystemMessage, rootPath } from "#core/util"

import { EmbedBuilder } from "discord.js"

// or if you have too many imports

import * as all from "#all"
import discord from "discord.js"

CLI

  • Only use the CLI to generate the native bot.ts components.

PreviousRegulations

Last updated 5 months ago

Was this helpful?