habrabot

command module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 1 Imported by: 0

README

Habrabot

GitHub Workflow Status Latest release License

A telegram bot that publishes items from an RSS feed into a Telegram channel.

Written for 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. See here 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:

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:

CC_PATH=/data/cc/

Now, you may create a docker-compose.yaml file that will instruct Docker how to run the bot:

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:

$ ls -1a
docker-compose.yaml
.env

Now, you may run the bot using the following command:

docker compose up -d

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
internal
db
rss

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL