This repository has been archived on 2023-07-05. You can view files and clone it, but cannot push or open issues or pull requests.
clessy/broker/action.go

28 lines
617 B
Go
Raw Normal View History

2016-02-08 16:57:27 +00:00
package main
2016-02-08 13:47:10 +00:00
import (
2016-02-20 20:40:24 +00:00
"net"
2016-02-09 14:55:37 +00:00
"github.com/hamcha/clessy/tg"
2016-02-08 13:47:10 +00:00
)
2016-02-20 20:40:24 +00:00
func executeClientCommand(action tg.ClientCommand, client net.Conn) {
2016-02-09 10:33:38 +00:00
switch action.Type {
case tg.CmdSendTextMessage:
data := *(action.TextMessageData)
api.SendTextMessage(data)
2016-02-20 20:40:24 +00:00
case tg.CmdGetFile:
data := *(action.FileRequestData)
api.GetFile(data, client, *action.Callback)
case tg.CmdSendPhoto:
data := *(action.PhotoData)
api.SendPhoto(data)
case tg.CmdForwardMessage:
data := *(action.ForwardMessageData)
api.ForwardMessage(data)
case tg.CmdSendChatAction:
data := *(action.ChatActionData)
api.SendChatAction(data)
2016-02-09 10:33:38 +00:00
}
2016-02-08 13:47:10 +00:00
}