mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-25 01:40:30 +00:00
Merge pull request #757 from AmandaCameron/bugfix/irc-notify
Fix the IRC notification plugin.
This commit is contained in:
commit
f79e091519
1 changed files with 16 additions and 4 deletions
|
@ -53,11 +53,23 @@ func (i *IRC) sendSuccess(req *model.Request) error {
|
||||||
// to the connected IRC client
|
// to the connected IRC client
|
||||||
func (i *IRC) send(channel string, message string) error {
|
func (i *IRC) send(channel string, message string) error {
|
||||||
client := irc.IRC(i.Nick, i.Nick)
|
client := irc.IRC(i.Nick, i.Nick)
|
||||||
if client != nil {
|
|
||||||
|
if client == nil {
|
||||||
return fmt.Errorf("Error creating IRC client")
|
return fmt.Errorf("Error creating IRC client")
|
||||||
}
|
}
|
||||||
defer client.Disconnect()
|
|
||||||
client.Connect(i.Server)
|
err := client.Connect(i.Server)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error connecting to IRC server: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
client.AddCallback("001", func(_ *irc.Event) {
|
||||||
client.Notice(channel, message)
|
client.Notice(channel, message)
|
||||||
|
client.Quit()
|
||||||
|
})
|
||||||
|
|
||||||
|
go client.Loop()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue