示例#1
0
文件: main.go 项目: willemvds/Steve
func UName(cv *xmpp.ChatView) {
	if cv.GetText() == "uname" {
		cmd := exec.Command("uname", "-a")
		output, err := cmd.CombinedOutput()
		if err != nil {
			XMPPSendMessage(cv.GetRemote(), fmt.Sprintf("%s", err))
		} else {
			XMPPSendMessage(cv.GetRemote(), string(output))
		}
	}
}
示例#2
0
文件: main.go 项目: willemvds/Steve
func DoMath(cv *xmpp.ChatView) {
	if strings.HasSuffix(cv.GetText(), "= ?") {
		expr := strings.TrimSpace(cv.GetText()[0 : len(cv.GetText())-3])
		answer, err := math.Parse("STEVE!", expr)
		if err != nil {
			XMPPSendMessage(cv.GetRemote(), "Steve not know!")
			return
		}
		XMPPSendMessage(cv.GetRemote(), fmt.Sprintf("%d", answer))
	}
}
示例#3
0
文件: main.go 项目: willemvds/Steve
func ForwardToIRC(cv *xmpp.ChatView) {
	tokens := strings.SplitN(cv.GetText(), " ", 2)
	if len(tokens) == 2 {
		IRCSendMessage(strings.TrimSpace(tokens[0]), tokens[1])
	}
}
示例#4
0
文件: main.go 项目: willemvds/Steve
func Reply(cv *xmpp.ChatView) {
	if len(cv.GetText()) > 0 {
		XMPPSendMessage(cv.GetRemote(), fmt.Sprintf("ACK: %s", cv.GetText()))
	}
}
示例#5
0
文件: main.go 项目: willemvds/Steve
func Log(cv *xmpp.ChatView) {
	log.Print("Received from", cv.GetRemote(), ":", cv.GetText())
}
示例#6
0
文件: main.go 项目: willemvds/Steve
func Print(cv *xmpp.ChatView) {
	fmt.Println("Received from", cv.GetRemote(), ":", cv.GetText())
}