Project Status
NPM Versions
Social Media and Donations
yarn create djsbot
# or for reusability
yarn global add create-djsbot
create-djsbot mybot
npx create-djsbot mybot
# or for reusability
npm install --global create-djsbot
create-djsbot mybot
- copy over the template
- install dependencies via yarn or npm
- initialize local git repo
Before documenting anything else I just want to put out here that I'll maintain this project in terms of (security) issues, major updates are less likely to come quickly if at all. This is because these templates are based on the Commando framework whilst I have moved to the Klasa framework myself for my own bot. That said however this generator is still a great way to get started with any bot regardless of framework you end up using.
- Easy to use CLI
- ESLint for linting
- Utilizes the DiscordJS-Commando framework
- Optional support for TypeScript
- (TypeScript only) Interactive reloading script for single files for hot-reloading
Create DJSBot - Easily bootstrap your bot!
Usage:
create-djsbot
create-djsbot --help
create-djsbot --name mybot
Options:
--help Show help [boolean]
--version Show version number [boolean]
--interactive [default: true]
--name What is the name of your bot project?
--description What is the description for this bot?
--author Who is the author of the bot? (GitHub username)
--license What license do you want the bot to have? [choices: "MIT", "GPL-3.0-or-later", "Apache-2.0", "Unlicense", "MPL-2.0"]
--repo Do you have an URL for the Git repository for the bot?
--gitinit Should a the repo be initialized with "git init"?
--manager Do you want to use Yarn or NPM? [choices: "npm", "yarn"]
--template Do you want to use JavaScript or TypeScript? [choices: "javascript", "typescript"]
--prefix What is the bot prefix you want to set as default?
--ownerid What is your Discord userID that will be registered as the bot owner?
--token And lastly, do you already have a token the bot will use?
If the template fails to run the npm install
or yarn install
, please follow these instructions before getting support:
- Windows:
- run
npm i windows-build-tools --production --vs2015 --add-python-to-PATH --global
in an administrative CMD or Powershell
- run
- MacOS:
- Install the XCode Selects tools:
xcode-select --install
- Install Brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install the XCode Selects tools:
- Linux Debian / Ubuntu:
- Install build-essential:
sudo apt-get install -y build-essential
- Install build-essential:
- Other OS / distro's:
- Please google how to install build essentials such as GCC and Make
A few notes should be shared about the TypeScript template that are important to note
-
It uses forks of Discord.JS and Discord.JS-Commando that are based on the "master" branch so please refer to the "master" documentation. The reason for this is that Commando has added a lot of extra TypeScript support since it's latest stable release and when using the "master" branch for Discord.JS-Commando then the master branch for Discord.JS should also be used. I (Favna) manage these forks and ensure they are always stable before publishing any updates as I use them in my own bot
-
In TypeScript you should to use ES6 imports/exports rather than CommonJS
module.exports
andrequire
as it's far more efficient, adds a lot of cool features such as default exports, named exports and advanced imports and it's far easier to write and remember. -
You should not use
ts-node
to run your bot unless during development. It is very slow and inefficient for production environments. -
Therefore always compile your bot to JavaScript using
npm run build
oryarn build
-
And do not remove anything from the
build
,prebuild
,postbuild
,copyfiles
orreplace
scripts. Doing so will either cause your bot to not build properly at all, or cause inefficiencies in the long term. Adding to it is perfectly fine however! -
The TypeScript config allows you to use aliases for easier accessing the
commands
andutils
folders. For example if you need to log something you canimport log from '@utils/winston'
(which imports thewinston.ts
file atsrc/utils/winston.ts
, no matter how many subfolders deep you are) then use this aslog.info()
. -
When getting support anywhere always specify that you are writing TypeScript to get the best support.
-
You can always join my server for support as well.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Copyright © 2018-2019, Favware. Released under the MIT License.
-
The DiscordJS team for the DiscordJS Library and Commando Framework
-
Travis Fischer for the project create-react-library which inspired me to make this