Discord bot based on Discord.js and TypeScript.
- Personal access token from GitHub for creating new releases
Start by creating a new Discord application:
- Sign-in to Discord
- Create an application
- Build a bot by going to
Bot > Add Bot - Once the bot is built, click the
Copybutton to store the token in your clipboard - Start the installation process and paste the token in your terminal when asked
Clone the repository and install dependencies:
$ git clone https://github.com/Phoenix2k/discbot.git
$ cd discbot
$ nvm use
$ npm installThis will ask you to give your bot a name of your choosing and to enter the token from your Discord app.
If you need to replace these later, you can run
npm run generate:envto regenerate the.envfile.
Source files are located in the src folder.
Start a local development instance:
$ npm run devThis will start a local instance at
http://localhost:3000. The server will restart automatically when you make changes to the source files and let you know of any errors while you develop.
Debugging mode:
$ npm run dev:debugThis is similar to dev, but will emit more log messages to give you a better understanding of what's going on behind the scenes.
Check for coding and styling errors:
$ npm run lint
Tests are found in the src folder. Look for files ending with .spec.ts.
Run tests:
$ npm test
Should your tests fail, you can try clearing the cache with npm run test:clear-cache and running the tests again.
This will also generate a coverage report, which you can browse by opening
coverage/lcov-report/index.htmlin your browser once it has been created.
Build for production:
$ npm run buildStart an instance:
$ npm startCreate a new release:
$ npm run releaseYou will need a personal access token from GitHub in order for the the script to be able to create a release on your behalf.
Follow the instructions and use common sense when choosing the version number.