case "message_new":
type Message struct {
Updates []struct {
Object struct {
Message struct {
FromId int `json:"from_id"`
Text string `json:"text"`
PeerId int `json:"peer_id"`
ConversationMessageId int `json:"conversation_message_id"`
} `json:"message"`
} `json:"object"`
}
}
message := Message{}
json.Unmarshal(getUpdates, &message)
SendMessage(message.Updates[0].Object.Message.Text, message.Updates[0].Object.Message.FromId)
break
case "message_event":
fmt.Println("ООО, калбек подъехал")
fmt.Println(string(getUpdates))
type Event struct {
Updates []struct {
Object struct {
UserId int `json:"user_id"`
PeerId int `json:"peer_id"`
EventId string `json:"event_id"`
Payload int `json:"payload"`
} `json:"object"`
GroupId int `json:"group_id"`
EventId string `json:"event_id"`
}
}
event := Event{}
json.Unmarshal(getUpdates, &event)
ShowKeyboard(
event.Updates[0].Object.Payload,
event.Updates[0].Object.UserId,
event.Updates[0].Object.PeerId,
)
break