Skip to content

Instantly share code, notes, and snippets.

@AmandaCameron
Created May 13, 2015 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmandaCameron/e320558f7a44b680831a to your computer and use it in GitHub Desktop.
Save AmandaCameron/e320558f7a44b680831a to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"github.com/drone/drone-plugin-go/plugin"
"github.com/thoj/go-ircevent"
)
func main() {
repo := plugin.Repo{}
build := plugin.Build{}
var params struct {
Nick string `json:"nick"`
Server string `json:"server"`
Channel string `json:"channel"`
}
plugin.Param("repo", &repo)
plugin.Param("build", &build)
plugin.Param("vargs", &params)
if err := plugin.Parse(); err != nil {
log.Fatal(err)
}
client := irc.IRC(params.Nick, params.Nick)
if client == nil {
log.Fatal("Failed to make IRC Client.")
}
err := client.Connect(params.Server)
if err != nil {
log.Fatal(err)
}
msg := fmt.Sprintf("[%s/%s] Build %d: %s", repo.Owner, repo.Name, build.Number, build.State)
client.AddCallback("001", func(_ *irc.Event) {
client.Notice(params.Channel, msg)
client.Quit()
})
client.Loop()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment