31 lines
725 B
Go
31 lines
725 B
Go
package main
|
|
|
|
import (
|
|
"net"
|
|
|
|
"git.fromouter.space/hamcha/tg"
|
|
)
|
|
|
|
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.GetFileNet(data, client, *action.Callback)
|
|
case tg.CmdSendPhoto:
|
|
data := *(action.PhotoData)
|
|
api.SendPhotoNet(data)
|
|
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)
|
|
}
|
|
}
|