Skip to content

Latest commit

 

History

History
65 lines (55 loc) · 2.17 KB

README.md

File metadata and controls

65 lines (55 loc) · 2.17 KB

🤖basic_bot

A NodeJS discord bot that does what you need while allowing for your custom JS scripts.

Main use case image

Setup

  1. Clone the repo, run npm install to get dependencies
  2. run npm run start, this will create necessary json files
  3. Edit data.json and replace TOKEN_HERE with your discord bot token
  4. From here your bot should be ready to use! Run npm run start

Usage

Commands must always start with $

Default Commands

$help - lists available commands.
$help <command_name> - lists help message for command.
$add <command_name> <reply...> - adds new command.
$set <command_name> <reply...> - overrwrites existing command reply
$del - deletes command $<custom_command> - runs custom command.
$restart - restarts bot
$sethelp - sets help message for a custom command.

📋Scripts (advanced)

You can have commands that run your very own JS scripts. All scripts are stores within /scripts as .js files. To greet users with a random greeting, we can add the random_greeting.js script in data.json:

See the random greeting script

{
  ...
  "commands": {
    "greetme": {
      "name": "greetme",
      "script": "random_greeting.js"
    }
  },
  ...
}

To aid users, you can link it to the help function which will return your help_msg string:

"greetme": {
  "name": "greetme",
  "script": "random_greeting.js",
  "help_msg": "Responds to you with a random greeting :)"
}

If the user types help greetme
the bot will run the script and reply with something like @user123, Nice meeting you! Greet test

Normal commands without scripts will look something like this:

"test_command": {
  "name": "test_command",
  "response": "Hello World!",
  "help_msg": "this is a command used for testing."
}

Test command basic Help message test