Set type join_leave for irc JOIN/PART messages send to mattermost

This commit is contained in:
Wim 2015-11-29 00:28:10 +01:00
parent 5c1b02c7a3
commit bd7c1e3e3c
1 changed files with 6 additions and 1 deletions

View File

@ -56,7 +56,7 @@ func (b *Bridge) handlePrivMsg(event *irc.Event) {
} }
func (b *Bridge) handleJoinPart(event *irc.Event) { func (b *Bridge) handleJoinPart(event *irc.Event) {
b.Send(b.Config.IRC.Nick, "irc-"+event.Nick+" "+strings.ToLower(event.Code)+"s "+event.Message()) b.SendType(b.Config.IRC.Nick, "irc-"+event.Nick+" "+strings.ToLower(event.Code)+"s "+event.Message(), "join_leave")
} }
func (b *Bridge) handleOther(event *irc.Event) { func (b *Bridge) handleOther(event *irc.Event) {
@ -67,9 +67,14 @@ func (b *Bridge) handleOther(event *irc.Event) {
} }
func (b *Bridge) Send(nick string, message string) error { func (b *Bridge) Send(nick string, message string) error {
return b.SendType(nick, message, "")
}
func (b *Bridge) SendType(nick string, message string, mtype string) error {
matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL} matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL}
matterMessage.UserName = nick matterMessage.UserName = nick
matterMessage.Text = message matterMessage.Text = message
matterMessage.Type = mtype
err := b.m.Send(matterMessage) err := b.m.Send(matterMessage)
if err != nil { if err != nil {
log.Println(err) log.Println(err)