From dec4c4fcd76bcb157821c2f383a77ef7f12ada31 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 30 Aug 2024 22:29:03 -0400 Subject: added rss functionality to milla, watchlists now allow you to give them a color so they can actually show you what they matched, bunch of other changes --- types.go | 58 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 18 deletions(-) (limited to 'types.go') diff --git a/types.go b/types.go index 85f820d..2206eb2 100644 --- a/types.go +++ b/types.go @@ -5,6 +5,7 @@ import ( "time" "github.com/jackc/pgx/v5/pgxpool" + "github.com/mmcdole/gofeed" lua "github.com/yuin/gopher-lua" ) @@ -43,6 +44,11 @@ type LuaCommand struct { FuncName string } +type RssFile struct { + RssFile string `toml:"rssFile"` + Channel string `toml:"channel"` +} + type TomlConfig struct { IrcServer string `toml:"ircServer"` IrcNick string `toml:"ircNick"` @@ -70,29 +76,31 @@ type TomlConfig struct { WebIRCGateway string `toml:"webIRCGateway"` WebIRCHostname string `toml:"webIRCHostname"` WebIRCAddress string `toml:"webIRCAddress"` + RSSFile string `toml:"rssFile"` Plugins []string `toml:"plugins"` CustomCommands map[string]CustomCommand `toml:"customCommands"` WatchLists map[string]WatchList `toml:"watchList"` LuaStates map[string]LuaLstates LuaCommands map[string]LuaCommand - Temp float64 `toml:"temp"` - RequestTimeout int `toml:"requestTimeout"` - MillaReconnectDelay int `toml:"millaReconnectDelay"` - IrcPort int `toml:"ircPort"` - KeepAlive int `toml:"keepAlive"` - MemoryLimit int `toml:"memoryLimit"` - PingDelay int `toml:"pingDelay"` - PingTimeout int `toml:"pingTimeout"` - TopP float32 `toml:"topP"` - TopK int32 `toml:"topK"` - EnableSasl bool `toml:"enableSasl"` - SkipTLSVerify bool `toml:"skipTLSVerify"` - UseTLS bool `toml:"useTLS"` - DisableSTSFallback bool `toml:"disableSTSFallback"` - AllowFlood bool `toml:"allowFlood"` - Debug bool `toml:"debug"` - Out bool `toml:"out"` - AdminOnly bool `toml:"adminOnly"` + Rss map[string]RssFile `toml:"rss"` + Temp float64 `toml:"temp"` + RequestTimeout int `toml:"requestTimeout"` + MillaReconnectDelay int `toml:"millaReconnectDelay"` + IrcPort int `toml:"ircPort"` + KeepAlive int `toml:"keepAlive"` + MemoryLimit int `toml:"memoryLimit"` + PingDelay int `toml:"pingDelay"` + PingTimeout int `toml:"pingTimeout"` + TopP float32 `toml:"topP"` + TopK int32 `toml:"topK"` + EnableSasl bool `toml:"enableSasl"` + SkipTLSVerify bool `toml:"skipTLSVerify"` + UseTLS bool `toml:"useTLS"` + DisableSTSFallback bool `toml:"disableSTSFallback"` + AllowFlood bool `toml:"allowFlood"` + Debug bool `toml:"debug"` + Out bool `toml:"out"` + AdminOnly bool `toml:"adminOnly"` pool *pgxpool.Pool Admins []string `toml:"admins"` IrcChannels []string `toml:"ircChannels"` @@ -169,3 +177,17 @@ type MemoryElement struct { Role string `json:"role"` Content string `json:"content"` } + +type FeedConfig struct { + Name string `json:"name"` + URL string `json:"url"` + UserAgent string `json:"userAgent"` + Proxy string `json:"proxy"` + Timeout int `json:"timeout"` + FeedParser *gofeed.Parser +} + +type RSSConfig struct { + Feeds []FeedConfig `json:"feeds"` + Period int `json:"period"` +} -- cgit v1.2.3