https://github.com/kapitanov/habrabot
RSS Telegram bot for Habr.com
https://github.com/kapitanov/habrabot
habr habrahabr telegram telegram-channel
Last synced: 5 months ago
JSON representation
RSS Telegram bot for Habr.com
- Host: GitHub
- URL: https://github.com/kapitanov/habrabot
- Owner: kapitanov
- License: mit
- Created: 2019-05-05T16:08:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-01T18:46:38.000Z (about 2 years ago)
- Last Synced: 2025-08-09T21:43:06.858Z (11 months ago)
- Topics: habr, habrahabr, telegram, telegram-channel
- Language: Go
- Size: 140 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Habrabot



A telegram bot that publishes items from an RSS feed into a Telegram channel.
Written for [Habr.com](https://habr.com/) but can be used for any RSS feed.
## How to run
First, you would need to register a bot for Telegram using [`@BotFather`](https://t.me/BotFather).
See [here](https://core.telegram.org/bots/api#authorizing-your-bot) for more details.
Then, create a Telegram channel to post messages into.
Note that you may use the same bot for multiple channels.
The, you should add your bot to the channel as an administrator.
Finally, create a `.env` file:
```shell
TELEGRAM_TOKEN=my-telegram-bot-token
TELEGRAM_CHANNEL=@MyAwesomeChannel
RSS_FEED=https://habr.com/ru/rss/all/
```
Here:
* `TELEGRAM_TOKEN` is the token you obtained from `@BotFather`, e.g. `1234567890:AABBCCdde-ffGGHHiiJJkkLLmmNNooPPqqRR`.
* `TELEGRAM_CHANNEL` is the name of the channel you created, e.g. `@MyAwesomeChannel`.
* `RSS_FEED` is an URL of the RSS feed you want to publish, e.g. `https://habr.com/ru/rss/all/`.
See `example.env` for more details.
> If you want to save a copy of each RSS feed item into a locac directory,
> add the following variable:
>
> ```shell
> CC_PATH=/data/cc/
> ```
Now, you may create a `docker-compose.yaml` file that will instruct Docker how to run the bot:
```yaml
version: '3'
services:
habrabot:
image: ghcr.io/kapitanov/habrabot:latest
restart: always
env_file: ./.env
environment:
BOLTDB_PATH: "/data/boltdb.dat"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "1"
volumes:
- ./data/:/data
```
At this point, you should have the following files in your working directory:
```shell
$ ls -1a
docker-compose.yaml
.env
```
Now, you may run the bot using the following command:
```shell
docker compose up -d
```
## License
[MIT](LICENSE)