Source Code for CatBot.
- Requires at least JDK 15. You can download the latest openjdk (set JAVA_HOME variable during install)
- Clone the repository
- Open the root folder (Catbot) as a project in IntelliJ
- You may need to set the project SDK (File > Project Structure > Project SDK > Add SDK > JDK > location of the jdk)
- Run
gradlew build
to install dependencies and build the project - To run the bot you can either run
gradlew run
or open themain.kt
file in IntelliJ and click play.
The src/resources/.env
file is used for configuration (bot token, api url, etc.). I
Only placeholders are kept otherwise local changes should not be committed.
You can make sure manually, or use some git commands:
# Ignore local changes to an existing file
git update-index --skip-worktree path/to/file
# check ignored files (need git bash or other terminal with 'grep' enabled)
git ls-files -v | grep ^S
# Stop ignoring local changes (e.g. to edit the placeholders in config file)
git update-index --no-skip-worktree path/to/file
Most of the bot data is server from the associated REST API (see https://github.com/ricochhet/CatBotServer).
It needs to be running at localhost:8080.
Quick steps for running using docker
# create shared network
docker network create catbot-net
# run api container
cd ../CatbotServer/
docker build . --tag catbot-api --file python-api/Dockerfile
docker run -d -p 8080:8080 -v "./databases:/app/databases" --network catbot-net --name catbotapi --restart unless-stopped catbot-api
# run bot container - update config.json with real token and api url (http://catbotapi:8080/api/)
cd ../CatBot/
docker build . --tag catbot --file ./Dockerfile
docker run -d --network catbot-net -it --name catbot --restart unless-stopped catbot
Suggestions and pull requests are very appreciated, just keep in mind to follow the project architecture to keep it consistent.
MIT