57 lines
1.6 KiB
Markdown
57 lines
1.6 KiB
Markdown
|
# Setup
|
||
|
## Install the dependencies
|
||
|
### Using `docker-compose`
|
||
|
|
||
|
It is **recommended** to use Docker Compose to run the bot while
|
||
|
developing, as all necessary dependencies are handled for you. After
|
||
|
installation and ensuring the `docker-compose` command works, you need to:
|
||
|
|
||
|
1. Create a data directory and config file by following the
|
||
|
[docker setup instructions](docker#setup).
|
||
|
|
||
|
2. Create a docker volume pointing to that directory:
|
||
|
|
||
|
```
|
||
|
docker volume create \
|
||
|
--opt type=none \
|
||
|
--opt o=bind \
|
||
|
--opt device="/path/to/data/dir" data_volume
|
||
|
```
|
||
|
|
||
|
Run `docker/start-dev.sh` to start the bot.
|
||
|
|
||
|
**Note:** If you are trying to connect to a Synapse instance running on the
|
||
|
host, you need to allow the IP address of the docker container to connect. This
|
||
|
is controlled by `bind_addresses` in the `listeners` section of Synapse's
|
||
|
config. If present, either add the docker internal IP address to the list, or
|
||
|
remove the option altogether to allow all addresses.
|
||
|
|
||
|
## Configuration
|
||
|
|
||
|
Copy the sample configuration file to a new `config.yaml` file.
|
||
|
|
||
|
```
|
||
|
cp sample.config.yaml config.yaml
|
||
|
```
|
||
|
|
||
|
Edit the config file. The `matrix` section must be modified at least.
|
||
|
|
||
|
## Testing the bot works
|
||
|
|
||
|
Invite the bot to a room and it should accept the invite and join.
|
||
|
|
||
|
By default nio-template comes with an `echo` command. Let's test this now.
|
||
|
After the bot has successfully joined the room, try sending the following
|
||
|
in a message:
|
||
|
|
||
|
```
|
||
|
!c echo I am a bot!
|
||
|
```
|
||
|
|
||
|
The message should be repeated back to you by the bot.
|
||
|
|
||
|
## Going forwards
|
||
|
|
||
|
Congratulations! Your bot is up and running. Now you can modify the code,
|
||
|
re-run the bot and see how it behaves. Have fun!
|