M TODO => TODO +1 -0
@@ 1,4 1,5 @@
Features
+** Rework feed handling (don't cache feed in cfg? might be static not able to expand)
* g!sum acid(1)
* Support for acid(1) in g!man
* Search man blocks other than 9front's
M main.go => main.go +1 -1
@@ 78,7 78,7 @@ func main() {
// Init Mux daemons
// Problem child Listener is
- go mux.Listener()
+// go mux.Listener()
// go mux.CommMux()
// go CommMux()
M x/mux/commits.go => x/mux/commits.go +9 -5
@@ 14,9 14,9 @@ import (
// Listen on the rss feed
func Listener() {
for {
- for p, feed := range Config.Feeds {
- fmt.Print("Updating feed: ", feed.Title, "\n")
- err := feed.Update()
+ for p, _ := range Config.Feeds {
+ fmt.Print("Updating feed: ", Config.Feeds[p].Title, "\n")
+ err := Config.Feeds[p].Update()
if err != nil {
fmt.Println("Error in updating RSS feed, see: x/mux/commits.go")
@@ 24,9 24,9 @@ func Listener() {
} else {
Notify(p)
}
- time.Sleep(10 * time.Minute)
+ time.Sleep(1 * time.Minute)
}
- time.Sleep(10 * time.Minute)
+ time.Sleep(1 * time.Minute)
}
}
@@ 43,6 43,7 @@ func Notify(id int) {
resp += "\n"
// Loop through subbed chans and post notification message
+ fmt.Println("Looping through subs to notify...")
for _, v := range Config.Subs {
if v.SubID == id {
Session.ChannelMessageSend(v.ChanID, resp)
@@ 50,6 51,9 @@ func Notify(id int) {
time.Sleep(10 * time.Millisecond)
}
}
+ fmt.Println("No new notifys for ", Config.Feeds[id].UpdateURL)
+ fmt.Println(Config.Feeds[id].Items[0])
+ fmt.Println(Config.Feeds[id].Items[len(Config.Feeds[id].Items)-1])
}
M x/mux/config.go => x/mux/config.go +1 -0
@@ 27,6 27,7 @@ type Configuration struct {
func (c *Configuration) Init(s *discordgo.Session) {
c.Read()
Session = s
+ go Listener()
}
// Writes current config