MCPcopy Index your code
hub / github.com/defer-panic/news-feed-bot

github.com/defer-panic/news-feed-bot @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
99 symbols 247 edges 24 files 16 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

News Feed Bot

Bot for Telegram that gets and posts news to a channel.

Features

  • Fetching articles from RSS feeds
  • Article summaries powered by GPT-3.5
  • Admin commands for managing sources

Configuration

Environment variables

  • NFB_TELEGRAM_BOT_TOKEN — token for Telegram Bot API
  • NFB_TELEGRAM_CHANNEL_ID — ID of the channel to post to, can be obtained via @JsonDumpBot
  • NFB_DATABASE_DSN — PostgreSQL connection string
  • NFB_FETCH_INTERVAL — the interval of checking for new articles, default 10m
  • NFB_NOTIFICATION_INTERVAL — the interval of delivering new articles to Telegram channel, default 1m
  • NFB_FILTER_KEYWORDS — comma separated list of words to skip articles containing these words
  • NFB_OPENAI_KEY — token for OpenAI API
  • NFB_OPENAI_PROMPT — prompt for GPT-3.5 Turbo to generate summary

HCL

News Feed Bot can be configured with HCL config file. The service is looking for config file in following locations:

  • ./config.hcl
  • ./config.local.hcl
  • $HOME/.config/news-feed-bot/config.hcl

The names of parameters are the same except that there is no prefix and names are in lower case instead of upper case.

Nice to have features (backlog)

  • [ ] More types of resources — not only RSS
  • [x] Summary for the article
  • [ ] Dynamic source priority (based on 👍 and 👎 reactions) — currently blocked by Telegram Bot API
  • [ ] Article types: text, video, audio
  • [ ] De-duplication — filter articles with the same title and author
  • [ ] Low quality articles filter — need research
    • Ban by author?
    • Check article length — not working with audio/video posts, but it will be fixed after article type implementation

Extension points exported contracts — how you extend this code

ArticleStorage (Interface)
go:generate moq --out=mocks/mock_article_storage.go --pkg=mocks . ArticleStorage [2 implementers]
internal/fetcher/fetcher.go
SourceLister (Interface)
(no doc) [2 implementers]
internal/bot/view_cmd_listsources.go
ArticleProvider (Interface)
(no doc) [1 implementers]
internal/notifier/notifier.go
ViewFunc (FuncType)
(no doc)
internal/botkit/bot.go
SourcesProvider (Interface)
go:generate moq --out=mocks/mock_sources_provider.go --pkg=mocks . SourcesProvider [2 implementers]
internal/fetcher/fetcher.go
PrioritySetter (Interface)
(no doc) [1 implementers]
internal/bot/view_cmd_setpriority.go
Summarizer (Interface)
(no doc) [1 implementers]
internal/notifier/notifier.go
Source (Interface)
go:generate moq --out=mocks/mock_source.go --pkg=mocks . Source [2 implementers]
internal/fetcher/fetcher.go

Core symbols most depended-on inside this repo

Get
called by 15
internal/config/config.go
RegisterCmdView
called by 5
internal/botkit/bot.go
EscapeForMarkdown
called by 5
internal/botkit/markup/markdown.go
Fetch
called by 5
internal/fetcher/fetcher.go
Add
called by 5
internal/bot/view_cmd_addsource.go
AdminsOnly
called by 5
internal/bot/middleware/admins_only.go
Run
called by 3
internal/botkit/bot.go
Name
called by 3
internal/fetcher/fetcher.go

Shape

Method 47
Function 23
Struct 18
Interface 10
FuncType 1

Languages

Go100%

Modules by API surface

internal/fetcher/fetcher.go14 symbols
internal/notifier/notifier.go12 symbols
internal/storage/source.go8 symbols
internal/fetcher/mocks/mock_source.go7 symbols
internal/storage/article.go6 symbols
internal/source/rss.go6 symbols
internal/botkit/bot.go6 symbols
internal/bot/view_cmd_setpriority.go4 symbols
internal/bot/view_cmd_getsource.go4 symbols
internal/bot/view_cmd_addsource.go4 symbols
internal/summary/openai.go3 symbols
internal/model/model.go3 symbols

Datastores touched

news_feed_botDatabase · 1 repos

For agents

$ claude mcp add news-feed-bot \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact