VHTG is a command-line application written in Go that reads text messages from the standard input or a Docker container with the Valheim server, matches them using regular expressions, and sends formatted messages to a specified Telegram chat using the Telegram Bot API.
- Automatically process Valheim server logs
- Support for reading logs from standard input or a Docker container
- Send formatted messages to a specified Telegram chat
- Test mode for outputting formatted messages without sending them to Telegram
- Go 1.18 or higher
- A Telegram bot token (you can create a new bot by talking to the BotFather)
- A Telegram chat ID to send messages to (you can use a personal chat, group chat, or channel)
Clone the repository and navigate to the project directory:
git clone https://github.com/ffix/vhtg.git
cd vhtg
Use the provided Makefile to build the application for your platform:
make vhtg # For your current platform
make all # For all supported platforms
- Set the
TELEGRAM_BOT_TOKEN
,TELEGRAM_CHAT_ID
, andSERVER_PASS
environment variables:
export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
export TELEGRAM_CHAT_ID="your-telegram-chat-id"
export SERVER_PASS="your-server-password"
- In standard mode, pipe the application from the Valheim server:
./valheim-server | ./vhtg
- To enable test mode and only output the formatted message to the standard output without sending it to Telegram, add the
--test
flag:
./valheim-server | ./vhtg --test
- To integrate with Docker and poll the logs internally, add the
--docker
flag:
./vhtg --docker
The VHTG application is primarily configured using environment variables. These include:
TELEGRAM_BOT_TOKEN
: Your Telegram bot tokenTELEGRAM_CHAT_ID
: The Telegram chat ID to send messages toSERVER_PASS
: Your Valheim server password
To run the application inside a Docker container, you can use the following Docker Compose configuration:
services:
vhtg:
build:
context: vhtg
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
env_file:
- "env.valheim"
restart: always
stop_grace_period: 2m
Contributions to the VHTG project are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository
- Create a new branch for your changes (
git checkout -b my-feature
) - Commit your changes (
git commit -am 'Add my feature'
) - Push the changes to the branch (
git push origin my-feature
) - Create a new pull request
Please make sure to follow the project's coding standards and include tests for any new features or bug fixes.
If you encounter any issues or need help using the VHTG application, please:
- Check the project's documentation and README for any relevant information
- Search the project's issue tracker for any similar issues
- If you cannot find a solution, create a new issue with a clear description of the problem, steps to reproduce it, and any relevant logs or error messages
We will do our best to address your concerns and provide assistance.
This project is licensed under the MIT License.