2018-04-03 09:51:06 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
2018-04-03 09:54:00 +00:00
|
|
|
"github.com/hamcha/tg"
|
2018-04-03 09:51:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func executeClientCommand(action tg.ClientCommand, client net.Conn) {
|
|
|
|
switch action.Type {
|
|
|
|
case tg.CmdSendTextMessage:
|
|
|
|
data := *(action.TextMessageData)
|
|
|
|
api.SendTextMessage(data)
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|