예제 #1
0
func ClaimHandler(ctx context.Context, bot *slackbot.Bot, evt *slack.MessageEvent) {
	if slackbot.IsMentioned(evt, bot.BotUserID()) {
		if strings.Contains(evt.Text, "mine") {
			if lastNewLead != nil {
				err := AssignNewLeadOwner(ctx, evt.User)
				if err != nil {
					bot.Reply(evt.Channel, err.Error(), WithoutTyping)
				} else {
					bot.Reply(evt.Channel, fmt.Sprintf("@%s staked their claim! :pick:", evt.User), WithoutTyping)
					bot.Reply(evt.Channel, fmt.Sprintf("*%s* is now in your hands, make the most it!\nRemember what our buddy Zig says:\n> _\"You were born to win, but to be a winner, you must plan to win, prepare to win, and expect to win.\"_", lastNewLead.FirstName), WithTyping)
				}
			} else {
				bot.Reply(evt.Channel, "I'm sorry, I don't know of any new leads you can claim. :disappointed:", WithTyping)
			}
		} else {
			bot.Reply(evt.Channel, "You really do care about me. :heart:", WithTyping)
		}
	}
}
예제 #2
0
func MentionHandler(ctx context.Context, bot *slackbot.Bot, evt *slack.MessageEvent) {
	if slackbot.IsMentioned(evt, bot.BotUserID()) {
		bot.Reply(evt, "You really do care about me. :heart:", WithTyping)
	}
}