M README.md => README.md +1 -2
@@ 5,10 5,9 @@ library.
### Installing
-Use go get to download the repository into your Go work environment.
-
```
go get github.com/bwmarrin/discordgo
+go get github.com/SlyMarbo/rss
```
### Usage
M main.go => main.go +5 -0
@@ 8,6 8,7 @@ import (
"os/signal"
"syscall"
"github.com/bwmarrin/discordgo"
+ "bitbucket.org/henesy/glenda/x/mux"
)
const Version = "v0.1.0-alpha"
@@ 74,6 75,10 @@ func main() {
os.Exit(1)
}
+ go mux.Listener()
+
+ Session.UpdateStatus(0, "with #cat-v")
+
// Wait for a CTRL-C
log.Printf(`Now running. Press CTRL-C to exit.`)
sc := make(chan os.Signal, 1)
A x/mux/commits.go => x/mux/commits.go +45 -0
@@ 0,0 1,45 @@
+package mux
+
+import (
+ "github.com/bwmarrin/discordgo"
+ "github.com/SlyMarbo/rss"
+ "fmt"
+ "time"
+)
+
+/* internal functions */
+
+// Listen on the rss feed
+func Listener() {
+ feed, err := rss.Fetch("http://code.9front.org/hg/plan9front/rss-log")
+ if err != nil {
+ fmt.Println("Error in reading RSS feed, see: x/mux/commits.go")
+ fmt.Printf("%s\n\n", err)
+ }
+
+ time.Sleep(1000 * time.Second)
+
+ err = feed.Update()
+ if err != nil {
+ fmt.Println("Error in updating RSS feed, see: x/mux/commits.go")
+ fmt.Printf("%s\n\n", err)
+ }
+}
+
+// Load JSON Configuration File (move me?)
+
+
+/* Commands for Mux */
+
+// Print last commit or
+func (m *Mux) Commits(ds *discordgo.Session, dm *discordgo.Message, ctx *Context) {
+ resp := "```\n"
+
+
+
+ resp += "```\n"
+
+ ds.ChannelMessageSend(dm.ChannelID, resp)
+
+ return
+}
M x/mux/fortunes.go => x/mux/fortunes.go +0 -1
@@ 45,4 45,3 @@ func (m *Mux) Fortunes(ds *discordgo.Session, dm *discordgo.Message, ctx *Contex
return
}
-