Skip to content

Latest commit

 

History

History
71 lines (49 loc) · 2.98 KB

README.md

File metadata and controls

71 lines (49 loc) · 2.98 KB

Discord Lonely Bot

Link to add to your server here.

Table Of Contents

  1. Example usages
  2. Setup
  3. Extra Information

Example Usages

Command name Example
help help command example
counter counter command example
meta meta command example
profile profile command example
steamid steamid command example

Setup

Set up the environment variables by copying over the text in .env.example to .env and fill out the missing variables.

Environment variable Value
BOT_TOKEN Discord bot token
BOT_URI Mongodb connection uri
TEST_SERVER_ID Server id of the test server

The reason a test server is required, is because global slash commands can take up to an hour to register across all guilds, whereas guild specific commands update immediately making it useful for testing.


Ensure that you have node and npm installed, and run

# Install dependencies
npm install

# Set up husky git hooks
npm run prepare

# Run the bot
npm run dev

Extra Information

Tech Stack

Language

TypeScript is used for the bot for better code checking, and documentation. You can find the classes in the src/types folder, and interfaces for things such as the database, or OpenDota API in the src/types/interfaces folder.

Npm scripts

Script Purpose
build Compiles the code into dist folder
format Automatically formats the code using prettier
lint Runs eslint on all TypeScript files, and fixes them if possible
prepare Installs husky scripts for git hooks
start Compiles the code and starts the bot
dev Runs the TypeScript code using ts-node
test Run tests inside test folder

Cool Facts

  • The bot is named lonely bot after Lone Druid a Dota 2 hero who I spam too much.
  • Heroku runs whatever code is on the master branch, and reloads the bot after an update, so try to reduce the number of commits to master, as each reload results in a short downtime.