tg/cmd/tg-broker/action.go

31 lines
725 B
Go
Raw Permalink Normal View History

2018-04-03 09:51:06 +00:00
package main
import (
"net"
2018-10-31 09:15:58 +00:00
"git.fromouter.space/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)
2022-03-27 19:58:52 +00:00
api.GetFileNet(data, client, *action.Callback)
2018-04-03 09:51:06 +00:00
case tg.CmdSendPhoto:
data := *(action.PhotoData)
2022-03-27 20:22:20 +00:00
api.SendPhotoNet(data)
2018-04-03 09:51:06 +00:00
case tg.CmdForwardMessage:
data := *(action.ForwardMessageData)
api.ForwardMessage(data)
case tg.CmdSendChatAction:
data := *(action.ChatActionData)
api.SendChatAction(data)
case tg.CmdAnswerInlineQuery:
data := *(action.InlineQueryResults)
api.AnswerInlineQuery(data)
2018-04-03 09:51:06 +00:00
}
}