예제 #1
0
파일: funny.go 프로젝트: BRONSOLO/ahipbot
func (funny *Funny) Handle(bot *ahipbot.Bot, msg *ahipbot.BotMessage) {
	if msg.BotMentioned {
		if msg.ContainsAny([]string{"excitement", "exciting"}) {
			bot.Reply(msg, "http://static.fjcdn.com/gifs/Japanese+kids+spongebob+toys_0ad21b_3186721.gif")

		} else if msg.Contains("you're funny") {
			bot.Reply(msg, "/me blushes")
		}
	}

	if msg.ContainsAny([]string{"what is your problem", "what's your problem"}) {
		bot.Reply(msg, "http://media4.giphy.com/media/19hU0m3TJe6I/200w.gif")
		return

	} else if msg.Contains("force push") {
		url := ahipbot.RandomString("forcePush")
		bot.Reply(msg, url)
		return
	}

	if msg.Contains("blast") {
		//url := "https://plot.ly/__internal/ping"
		//url := "https://plot.ly/"
		url := "https://stage.plot.ly/__internal/ping"
		go func() {
			bot.Reply(msg, fmt.Sprintf("Blasting URL: %s for 60 seconds, with 5 workers", url))
			b := blaster.New(url)
			b.Start(5, time.Duration(60*time.Second))
			for rep := range b.Reply {
				bot.Reply(msg, rep)
			}
		}()
	}
}
예제 #2
0
파일: healthy.go 프로젝트: BRONSOLO/ahipbot
// Handler
func (healthy *Healthy) Handle(bot *ahipbot.Bot, msg *ahipbot.BotMessage) {
	if msg.ContainsAny([]string{"health", "healthy?", "health_check"}) {
		log.Println("Health check. Requested by", msg.From)
		bot.Reply(msg, healthy.CheckAll())
	}
}