content

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadImage added in v0.3.0

func DownloadImage(imageURL string) (string, error)

DownloadImage downloads an image URL to a temp file and returns the local path. Returns ("", nil) if imageURL is empty. Caller is responsible for deleting the file.

func FetchAndEngage added in v0.5.0

func FetchAndEngage(a Article, groqAPIKey string) string

FetchAndEngage fetches the article content and uses Groq to write an engaging tweet with a hook, key insight, and opinion. Falls back to FormatHeadline if the API key is empty or the request fails.

func Format

func Format(a Article) string

Format builds a tweet string from an Article with link included, guaranteed <= 280 chars. Kept for backwards compatibility; prefer FormatHeadline + a link reply for better reach.

func FormatHeadline added in v0.4.0

func FormatHeadline(a Article) string

Use this for the main tweet; post the link as a reply to avoid reach suppression.

func GenerateMemeImage added in v0.3.0

func GenerateMemeImage(username, password, text0, text1 string) (string, error)

GenerateMemeImage creates a meme image for the given post text. Priority: Pollinations.ai (AI-generated) → memegen.link → Imgflip

func GenerateMemeImageWithGroq added in v0.6.0

func GenerateMemeImageWithGroq(groqAPIKey, username, password, text0, text1 string) (string, error)

GenerateMemeImageWithGroq creates an image using Pollinations (with Groq prompt generation), falling back to memegen.link then Imgflip.

func GenerateMemePost added in v0.3.0

func GenerateMemePost(apiKey, headline string) (string, string, error)

GenerateMemePost generates an AI-powered tweet using Groq. Returns the post text and the format name used. headline is optional — used for reaction/news_reaction formats.

func GeneratePollinationsImage added in v0.6.0

func GeneratePollinationsImage(groqAPIKey, tweetText string) (string, error)

GeneratePollinationsImage generates a contextually relevant AI image from a tweet text. It first uses Groq to craft a good image prompt, then hits Pollinations.ai to generate it. Returns a local temp file path. No API key or credits required.

func GenerateSelfComment added in v0.6.0

func GenerateSelfComment(apiKey, postText string) string

GenerateSelfComment generates a short follow-up comment to post on your own tweet. This seeds the reply chain and boosts engagement velocity.

func GenerateThread added in v0.4.0

func GenerateThread(apiKey, topic string) ([]string, error)

GenerateThread generates a 5–8 tweet thread using Groq. topic is optional — if empty, Groq picks a relevant dev/tech topic. Returns a slice of tweet strings, each <= 280 chars.

func IsTextOnlyFormat added in v0.6.0

func IsTextOnlyFormat(name string) bool

Types

type Article

type Article struct {
	FeedName  string
	Category  string
	Title     string
	Link      string
	ImageURL  string
	Published time.Time
}

Article is a fetched news item ready to be tweeted

func Poll

func Poll(seen *SeenStore, maxAge time.Duration, feedsFile, category string) ([]Article, error)

Poll fetches all feeds concurrently and returns unseen articles newer than maxAge, sorted newest first. feedsFile is the path to the JSON feeds file. category filters by category when non-empty.

type RSSFeed

type RSSFeed struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Category string `json:"category"`
}

RSSFeed represents a single feed source from rss_feeds.json

func LoadFeeds

func LoadFeeds(path string) ([]RSSFeed, error)

LoadFeeds reads and parses a feeds JSON file

type SeenStore

type SeenStore struct {
	// contains filtered or unexported fields
}

SeenStore persists seen article hashes across restarts to prevent duplicates

func NewSeenStore

func NewSeenStore(path string) *SeenStore

func (*SeenStore) Add

func (s *SeenStore) Add(link string)

func (*SeenStore) Has

func (s *SeenStore) Has(link string) bool

Jump to

Keyboard shortcuts

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