Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"] {
Expand Down