general purpose discord bot
NOTE: node.js and npm or a similar package manager (pnpm, yarn) are required to run the bot.
Search online for help.
Open project directory and run npm i
Create an auth.json file in the project directory with the contents:
{
"token":"YOUR_BOT_TOKEN_HERE",
"owner:"Your discord id",
"admins":[
"list of discord user ids"
],
"dev"{
"token":"token for development version of bot"
}
}
token is private and should NOT BE SHARED or COMMITTED to a code repository.
"admins" is a list of ids of Discord users who can run commands to control or kill the bot. These is NOT the same as the Admins of Servers where your bot is active. Bot admins will have access to any commands that require admin privilege.
"dev" is an optional object to use a Different Discord bot for debugging/development. When running in dev mode, this alternate bot will run instead of the primary bot (Which may remain in use. )
auth.json should NOT be pushed to any public repository.
Create a file called config.json in the project directory with the following options:
{
"pluginsdir": "./plugins/",
"savedir": "./savedata",
"cmdprefix": "!",
"dev": {
"cmdprefix": ">",
"savedir": "./devdata"
}
}
pluginsdir - the directory of bot plugins. Cannot be changed without also changing tsconfig.json include paths.
savedir - directory where bot save files will be kept.
cmdprefix - prefix text that triggers bot commands. e.g. ! in !help
dev - Separate cmdprefix and savedir options for a bot running in development mode.
Run npm build or pnpm build from the command line.
The bot will be compiled to the dist/ folder and can be run from that directory.
AFTER auth.json and config.json have been configured, the bot can be run in a number of ways:
-
npm run start( ornpm run dev) (pnpm,yarnpackage managers can also be used. ) -
Open a command terminal and run node archbot.js A path to node.js must be in your command path for this to work.
Linux/Unix Run script:
- archrun - bash script to run bot in background process.
Windows Run script:
- archrun.bat - Double click the script to run the bot.