Advertisement
Guest User

Untitled

a guest
Jun 11th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.58 KB | None | 0 0
  1. func main() {
  2.     tgbot := tgm.BotAPI
  3.     go tgbot.GetMessages()
  4.     go tgbot.SendMessages()
  5.  
  6.     dialogflow := df.DialogFlowClient
  7.     go dialogflow.DetectIntents()
  8.  
  9.     go func() {
  10.         for someText := range tgbot.GetMessagesChan {
  11.             dialogflow.RequestChannel <- &df.DFMessage{
  12.                 ID:      someText.ID,
  13.                 Request: someText.Request,
  14.             }
  15.         }
  16.     }()
  17.  
  18.     go func() {
  19.         for someResp := range dialogflow.ResponseChannel {
  20.             tgbot.SendMessagesChan <- &tgm.TgMsg{
  21.                 ID:       someResp.ID,
  22.                 Request:  someResp.Request,
  23.                 Response: someResp.Response,
  24.             }
  25.         }
  26.     }()
  27.  
  28.     <-mainStopSwitch
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement