From 300611b4c287bfab25ae98032612536cd8dfcbfc Mon Sep 17 00:00:00 2001 From: Coosanta Date: Sat, 6 Jul 2024 18:00:22 +1000 Subject: [PATCH] Finishing Touches for 1.0 release --- README.md | 76 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index dda5125..db36a5d 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,74 @@ -# A Discord Bot to interact with [Crafty Controller](https://craftycontrol.com/) +# Crafty Controller Discord Bot. + +> A Discord Bot to interact with and control [Crafty Controller](https://craftycontrol.com/) through commands in chat So far all it does is start *one* server. -## How to use -It is assumed you have already made a bot and got its token. Also, you need to have made an API key for Crafty Controller, make sure the user that the key is based off has perms to the server. +### How to use +A basic knowledge of command line is assumed. 1. Install Nodejs and import the repository, then run the command in the repository folder: ```bash npm install ``` -2. Create a file called `.env`, this is where all the secret stuff is stored. - Inside `.env` put you secret stuff in this format: - ```env - DISCORD_TOKEN= - CRAFTY_TOKEN= - CRAFTY_SERVER_URL=https://localhost:8000/ # This URL is assuming you host it on the local machine with the default port (make sure to include the "/" at the end!) - CRAFTY_SERVER_ID=7010d5b8-cb49-4334-9d99-6f0ef860a672 # Example ID - ``` - -3. Run the bot using command +2. Run the bot using command ```bash - node src/bot.js + node . ``` -#### Commands -`>start` - Starts the server +### Configuration File +Here is the default configuration file: +```json +{ + "bot": { + "token": "BOT_TOKEN" + }, + "crafty": { + "api_token": "CRAFTY_TOKEN", + "server_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + "url": "https://localhost:8000/" + }, + "commands": { + "slash": { + "enabled": true + }, + "text": { + "enabled": false, + "prefix": "!" + } + } +} +``` + + +`bot.token` - The discord bot's token. Learn how to get one [here](https://www.youtube.com/watch?v=GvK-ZigEV4Q) + + +`crafty:` + + `api_token` - The api token for [crafty controller user](https://docs.craftycontrol.com/pages/user-guide/user-role-config/#adding-a-role), make sure it has the COMMANDS permission and access to the server. + + `server_id` - The [uuid](https://en.wikipedia.org/wiki/Universally_unique_identifier) of the server. You can find it in the link to the server near the end. + + `url` - The url to access the controller + + +`commmands:` + + `slash.enabled` - Whether slash commands are enabled, recommended `true` + + `text.enabled` and `text.prefix` - Whether text commands are enabled, for example, if prefix if set to `!`, help command would be `!help` + +### Commands +`/start` - Starts the preconfigured server -## Other stuff -*I am learning JavaScript so if you find any errors or bad practice any help is appreciated.* +### Other stuff +*I am still learning JavaScript so if you find any errors or bad practice any help is appreciated.* #### Future Features: - ~~Turn server off after period of time.~~ :white_check_mark: -- Config file. +- ~~Config file.~~ :white_check_mark: - Turn server off with a command (configurable). - Handling multiple servers. - Channel binds for different servers. @@ -40,4 +76,4 @@ It is assumed you have already made a bot and got its token. Also, you need to h - *suggestions are welcome!* #### LICENSE. -Read it! (pls read if you want to do anything with it!!) (License tab!!!!!!) +Check License tab.