Documentation
¶
Overview ¶
Package rssbot implements a Service capable of reading Atom/RSS feeds.
Index ¶
Constants ¶
View Source
const ServiceType = "rssbot"
ServiceType of the RSS Bot service
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct { types.DefaultService // Feeds is a map of feed URL to configuration options for this feed. Feeds map[string]struct { // Optional. The time to wait between polls. If this is less than minPollingIntervalSeconds, it is ignored. PollIntervalMins int `json:"poll_interval_mins"` // The list of rooms to send feed updates into. This cannot be empty. Rooms []string `json:"rooms"` // True if rss bot is unable to poll this feed. This is populated by Go-NEB. Use /getService to // retrieve this value. IsFailing bool `json:"is_failing"` // The time of the last successful poll. This is populated by Go-NEB. Use /getService to retrieve // this value. FeedUpdatedTimestampSecs int64 `json:"last_updated_ts_secs"` // Internal field. When we should poll again. NextPollTimestampSecs int64 // Internal field. The most recently seen GUIDs. Sized to the number of items in the feed. RecentGUIDs []string } `json:"feeds"` }
Service contains the Config fields for this service.
Example request:
{ feeds: { "http://rss.cnn.com/rss/edition.rss": { poll_interval_mins: 60, rooms: ["!cBrPbzWazCtlkMNQSF:localhost"] }, "https://www.wired.com/feed/": { rooms: ["!qmElAGdFYCHoCJuaNt:localhost"] } } }
func (*Service) OnPoll ¶
OnPoll rechecks RSS feeds which are due to be polled.
In order for a feed to be polled, the current time must be greater than NextPollTimestampSecs. In order for an item on a feed to be sent to Matrix, the item's GUID must not exist in RecentGUIDs. The GUID for an item is created according to the following rules:
- If there is a GUID field, use it.
- Else if there is a Link field, use it as the GUID.
- Else if there is a Title field, use it as the GUID.
Returns a timestamp representing when this Service should have OnPoll called again.
func (*Service) PostRegister ¶
PostRegister deletes this service if there are no feeds remaining.
Click to show internal directories.
Click to hide internal directories.