Categorygithub.com/tetafro/feed-bot
modulepackage
0.0.0-20240911183050-892a1ebc6e71
Repository: https://github.com/tetafro/feed-bot.git
Documentation: pkg.go.dev

# README

Feed bot

Codecov Go Report CI

Telegram bot that reads RSS feeds and sends them to users.

Build and run

Create a bot and get Telegram API token from the bot called @botfather.

Copy and populate config

cp config.example.yaml config.yaml

Start

make build run

Deploy

Normally deploy is done by Github actions.

Manual deploy

SSH_SERVER=10.0.0.1:22 \
SSH_USER=user \
make deploy

Encrypted config

Encrypt

echo "password" > .vault_pass.txt
ansible-vault encrypt --output config.yaml.vault config.yaml

Edit

EDITOR='code --wait' \
ansible-vault edit config.yaml.vault

# Functions

NewBot creates new bot.
NewFileStorage creates new file storage.
NewRSSFeed returns new RSS feed.
NewTelegramNotifier creates a new telegram client.
ReadConfig returns configuration populated from the config file.

# Structs

Bot fetches new items from data feeds, and sends it to all clients.
Config represents application configuration.
FileStorage is a storage that uses plain text file for storing data.
Item is a single fetched item.
RSSFeed reads data from RSS feed.
TelegramNotifier uses Telegram API to sends notifications as Telegram messages to a channel.

# Interfaces

API describes interface for working with remote API.
Feed is a source of data.
Notifier describes how clients are notified about new items.
Storage describes persistent datastorage.