Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
doc: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Wittano committed Apr 29, 2024
1 parent 4d1a1a9 commit 6007048
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ assets
# Web files
*.mp3
*.mp4
*.yml

# Nix
result
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prod:
test:
go test -race ./bot/...

install: prod
install: prod test
mkdir -p $(DEST_DIR)
cp -r assets $(DEST_DIR)
cp $(OUTPUT_DIR)/komputer $(DEST_DIR)
Expand All @@ -30,4 +30,4 @@ endif
clean:
ifneq ("$(wildcard $(OUTPUT_DIR))", "")
rm -r build
endif
endif
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,35 @@

Discord bot behave as like "komputer". One of character in Star Track parody series created by Dem3000

# Installation
## Manual installation
Build project and installa with this simple command:
```sh
sudo make install
```
Bot installs in /opt/komputer directory
## For NixOS
You can use flake to install bot as NixOS module:

```nix
# Installa in flake
inputs = {
komputer.url = "github:Wittano/komputer";
};
# Activate bot in NixOS
komputer = {
enable = true;
token = "<YOUR_DISCORD_TOKEN>";
applicationID = "<YOUR_APPLICATION_ID>";
guildID = "<YOUR_DISCORD_SERVER_ID>";
};
```

# Configuration

Preferred method to deploy for instance of bot is creating docker container using prepared Dockerfile image.
If you don't want to use docker, you can use `make install` to build and install program. It'll install
If you don't want to use docker, you can use `sudo make install` to build and install program. It'll install
in `/opt/komputer` directory.

## Environment variable
Expand All @@ -16,6 +41,5 @@ Bot is configurable via a few environment variables:
- APPLICATION_ID= Your bot application id (required)
- SERVER_GUID= Your server ID, where bot will register commands (required)
- MONGODB_URI= URI to connect MongoDB database (required)
- MONGODB_DB_NAME= Name of main collection for komputer bot (required)
- RAPID_API_KEY= API key for RapidAPIs. In project is use: HumorAP (optional)
- LOG_FILE = Localization of your log file (optional). If you don't use this variable, logs will print on STDOUT

9 changes: 9 additions & 0 deletions nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ in
Your token never shouldn't be publish on any public git repository e.g. Github or Gitlab
'';
};
mongodbURI = mkOption {
type = types.str;
description = "Connection URI to your instance of mongodb";
};
};
};

Expand All @@ -48,6 +52,10 @@ in
assertion = cfg.applicationID != "";
message = "Option komputer.applicationID is empty";
}
{
assertion = cfg.mongodb != "";
message = "Option komputer.mongodbURI is empty";
}
];

systemd.services.komputer = {
Expand All @@ -57,6 +65,7 @@ in
DISCORD_BOT_TOKEN = cfg.token;
APPLICATION_ID = cfg.applicationID;
SERVER_GUID = cfg.guildID;
MONGODB_URI = cfg.mongodbURI;
};
script = "${cfg.package}/bin/komputer";
};
Expand Down

0 comments on commit 6007048

Please sign in to comment.