Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // CurrentConfig is what Knowbody currently sees as the config // Think "State" but for the config CurrentConfig Config // State is... the current state. State CurrentState )
Functions ¶
func DownloadFile ¶
DownloadFile downloads files. Pretty simple.
func ReadConfig ¶
func ReadConfig()
ReadConfig will attempt to download the master config from GitHub. It then reads the current conf.yaml file on the file system and updates all the internal data structures
func ReadState ¶
func ReadState()
ReadState looks reads /tmp/knowbody.lock and pushes it into the State variable
func WriteState ¶
func WriteState()
WriteState takes the state and dumps it to /tmp/knowbody.lock We like keeping track of state. This allows Knowbody to crash and recover without issue. Because we're lazy goddammit.
Types ¶
type Config ¶
type Config struct {
Streams []ContentStream `yaml:"streams"`
SlackToken string `yaml:"slackToken"`
}
Config holds all info to run Knowbody
type ContentState ¶
type ContentState struct {
Stream ContentStream `yaml:"stream"`
RSSId string `yaml:"rssId"`
RSSTime time.Time `yaml:"rssTime"`
}
ContentState tracks the current state of a specific ContentStream
type ContentStream ¶
type ContentStream struct {
Name string `yaml:"name"` // name of the stream. preferably unique.
Source string `yaml:"source"` // rss feed (https://twitrss.me/twitter_user_to_rss/?user=jeefy or https://danielmiessler.com/blog/rss-feed-youtube-channel/)
Type string `yaml:"type"`
Channel string `yaml:"channel"` // slack channel in the workspace
Exclude string `yaml:"exclude"` // regex of content to exclude from this source cannot be set with include.
Include string `yaml:"include"` // regex of content to include from this source. cannot be set with exclude.
Spoiler bool `yaml:"spoiler"` // boolean to indicate if it should post in a thread instead of in channel.
// contains filtered or unexported fields
}
ContentStream is a mapping of rss-feed to slack channel
func (*ContentStream) Process ¶
func (stream *ContentStream) Process(c chan Message)
Process will attempt to read and handle a specific ContentStream's RSS feed
type CurrentState ¶
type CurrentState struct {
Streams map[string]ContentState `yaml:"streams"`
Channels map[string]string `yaml:"channels"`
LastRun time.Time `yaml:"lastRun"`
// contains filtered or unexported fields
}
CurrentState tracks the overall running state of Knowbody