Beispiel #1
0
func (self Self) Perform(agent *agent.Agent) agent.AgentReply {
	if greeting(agent.LastQuery.Ask) {
		return agent.Reply("Hi. My name is " + agent.Name)
	}
	if feeling(agent.LastQuery.Ask) {
		return agent.Reply("I'm great. Thanks for asking")
	}
	return agent.Reply("Pardon?")
}
Beispiel #2
0
func (t Weather) Perform(agent *agent.Agent) agent.AgentReply {

	result, err := query("Cardiff")

	if err != nil {
		return agent.Reply(err.Error())
	}

	description := result.Weather[0].Description

	return agent.Reply("It looks like " + description)
}
Beispiel #3
0
func (ping Ping) Perform(agent *agent.Agent) agent.AgentReply {
	return agent.Reply("PONG")
}
Beispiel #4
0
func (t Time) Perform(agent *agent.Agent) agent.AgentReply {
	current_time := time.Now().UTC()
	return agent.Reply("The Current time is " + current_time.Format("2006-01-02 MST"))
}