skylight

package
v0.0.0-...-363e00c Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleFeed

func HandleFeed(f *FeedConfig)

run this as a goroutine forever

func Run

func Run(c Config)

func SendToWebhook

func SendToWebhook(webhookURL string, item *FeedNews) error

SendToWebhook sends an embedded message to a discord webhook

func StateHandler

func StateHandler(stateFilepath string)

helper function to get a state filepath and updates the state struct (global variable)

Types

type Config

type Config struct {
	LogLevel  string `hcl:"log_level"`
	StateFile string `hcl:"state_file"`

	Feeds []FeedConfig `hcl:"feed,block"`
}

type FeedConfig

type FeedConfig struct {
	Timestamp       time.Time
	Name            string `hcl:"name,label"`
	Url             string `hcl:"url"`
	WebhookURL      string `hcl:"webhook_url"`
	Interval        uint   `hcl:"interval"`
	MaxItems        int    `hcl:"max_items"`
	IgnoreOlderThen uint   `hcl:"ignore_items_older_than"` // in hours
}

type FeedNews

type FeedNews struct {
	*rss.Item
	FeedName string
}

Jump to

Keyboard shortcuts

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