diff --git a/bot.go b/bot.go index 13d8591..564f097 100644 --- a/bot.go +++ b/bot.go @@ -16,7 +16,7 @@ const ( TOKEN_VAR = "SLACKSOC_TOKEN" NO_TOKEN_ERROR = "You must have the SLACKSOC_TOKEN variable to run the" + " slacksoc bot" - VERSION = "0.0.4" + VERSION = "0.0.5" ) type Bot struct { @@ -109,11 +109,24 @@ func (bot *Bot) ConstructReply(message map[string]interface{}, subtype interface return Mention(message["user"].(string), message["channel"].(string), "hi ", "") } else if text == "slacksoc: pm me" { return bot.DirectMessage(message["user"].(string), "hi") + } else if text == "have you tried installing Gentoo?" { + go bot.React(message, "funroll-loops") + return nil } return nil } } +func (bot *Bot) React(message map[string]interface{}, reaction string) { + channel := message["channel"].(string) + timestamp := message["ts"].(string) + parameters := url.Values{} + parameters.Set("channel", channel) + parameters.Set("timestamp", timestamp) + parameters.Set("name", reaction) + bot.Call("reactions.add", parameters) +} + func (bot *Bot) SetRealNameFields(message map[string]interface{}) interface{} { channel := message["channel"].(string) if channel != bot.Channels["general"] {