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?") }
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) }
func (ping Ping) Perform(agent *agent.Agent) agent.AgentReply { return agent.Reply("PONG") }
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")) }