-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7296f74
commit 300611b
Showing
1 changed file
with
56 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,79 @@ | ||
# 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=<token> | ||
CRAFTY_TOKEN=<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. | ||
- Statistics (players and stuff) *\*maybe?\**. | ||
- *suggestions are welcome!* | ||
|
||
#### LICENSE. | ||
Read it! (pls read if you want to do anything with it!!) (License tab!!!!!!) | ||
Check License tab. |