go-chat-bot / bot

IRC, Slack, Telegram and RocketChat bot written in go
MIT License
826 stars 195 forks source link

added message filter to tweak slack params in post message #61

Closed matlockx closed 7 years ago

matlockx commented 7 years ago

An example would be:


func main() {
 ....
    slack.Run(kb.Token, messageFilter)
}

func messageFilter(message string, sender *bot.User) (string, slack.PostMessageParameters) {
    p := slack.PostMessageParameters{AsUser: true}
    p.Attachments = []slack.Attachment{{
        Color:      "good",
        Text:       message,
        AuthorName: sender.RealName,
    },}
    return "", p
}