/tscord

🤖 A fully-featured discord bot template written in Typescript, intended to provide a framework that's easy to use, extend and modify

Primary LanguageTypeScriptMIT LicenseMIT

🌟 What is TSCord

TSCord is a fully-featured discord bot template written in Typescript, intended to provide a framework that's easy to use, extend and modify.

It uses discord.ts and discord.js v14 under the hood to simplify the development of discord bots.

This template was created to give developers a starting point for new Discord bots, so that much of the initial setup can be avoided and developers can instead focus on meaningful bot features. Developers can simply copy this repo, follow the setup instructions, and have a working bot with many boilerplate features already included!

📜 Features

Talking about features, here are some of the core features of the template:

  • Advanced handlers for:
    • Interactions (slash, context menu, button, modal, select menu, etc)
    • Simple message commands
    • Discord events listeners
  • Guards functions, acting like middlewares on handlers with some built-ins:
    • Rate limiter
    • Maintenance mode
    • Disabling command
    • Guild only command (no DMs)
    • NSFW only command
    • Message's content match using regex
  • Internal API to interact with the bot from external services, with built-in useful endpoints
  • Multiple databases support out-of-the-box using Mikro-ORM
  • Migrations system to keep a safe database
  • Custom events handlers
  • Advanced error handler
  • Fully-typed localization (i18n)
  • Local store to manage global state through the app
  • Advanced logger with log files and discord channels support
  • Scheduler for cron jobs
  • Built-in rich statistics system
  • Automatic static assets upload to imgur
  • WebSocket server with decorators driven events system

This template is also developper friendly and follow strict design patterns to ease its maintenance:

  • Written in Typescript
  • Built around the Dependency Injection and Singleton patterns
  • Use of battle-tested libraries under the hood (discord.ts and discord.js)
  • Built-in debugging setup for VSCode
  • Support for running with the PM2 process manger
  • Support for running with Docker
  • CI/CD integration with Github Actions

and many more!

📚 Documentation

Check the official documentation (WIP) to get started and understand how to use this template.

You can also find useful documentations at:

🌐 Roadmap

Click here to access the milestone roadmap

Or expand here to see the old roadmap

Discord

  • Custom events
    • guildAdminRemove
    • guildAdminAdd
    • simpleCommandCreate
  • Events
    • ready
    • interactionCreate
    • guildCreate
    • guildDelete
    • messageCreate
  • Guards implementations
    • user is bot
    • nsfw
    • cooldown
    • maintenance
    • dm
    • enabled
    • match
    • permissions
  • Activities
  • Guards fallback message
  • discord.js implementation
  • discord.ts implementation

Data

  • Other databases support
    • MySQL
    • MariaDB
    • PosgreSQL
  • Automatic backup
  • Automatic assets upload and association
  • Users/Guilds sync with database
    • Register last interaction of a user with the bot
  • SQLite database
  • ORM (w/ mikro-orm)
  • EAV pattern implementation for single data types
  • State store system (no database)
  • Built-in entities
    • User
    • Guild
    • Stats

Utilities

  • Errors handling
  • Stats
  • Localization
  • Logger
    • log to discord channel
  • Cron tasks

Built-in commands

  • General
    • invite
    • help
    • stats
    • ping (with latency)
  • Admin
    • prefix
  • Owner
    • eval
    • maintenance

DevOps

  • CI/CD
  • PM2
  • Docker
  • .env.example
  • Debugging config for VSCode
  • .devcontainer (Codespaces config)
  • Unit tests (not relevant atm)

Other

  • Documentation using docusaurus
  • Comment code
  • Readme (exemple)
  • Issues templates (exemple)
  • Code of conduct
  • JSDoc
  • ESlint / Prettier

Bonus

  • Beautify discord channels logs
  • info command
  • Online dashboard for stats viuzalisation, monitoring, etc (using Next.js and @discordx/koa)
  • Extensions
  • Convert the template as an npx auto generated boilerplate (using plop)
  • Multiple database server instances connections
  • Database backups automatic upload to MEGA
  • Add support for NoSQL databases (mongo)
  • Clustering + Sharding (example)
  • Integrations with bot lists (e.g: top.gg)
  • Pimp console logs (chalk)
  • CLI to generates (also using plop) :
    • Entities (maybe a simple wrapper of mikro-orm CLI)
    • Commands
    • Guards
    • Events

📑 License

MIT License

Copyright (c) barthofu