You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to develop a real time light bot for Rocket.
My bot subscribe to each direct room (ie. conversation with other users) with a common channel.
ifchannels, e=c.GetChannelsIn(); e!=nil {
log.Panic("can not get channels in "+e.Error())
}
msgChannel:=make(chan models.Message, 10)
for_, ch:=rangechannels {
fmt.Println(fmt.Printf("subscribed to: %v", ch.ID))
ife=c.SubscribeToMessageStream(&models.Channel{ID: ch.ID}, msgChannel); e!=nil {
log.Println("can not subscribe to message stream for channel "+ch.ID+" "+e.Error())
}
}
count:=0for {
fmt.Println(count)
select {
casem:=<-msgChannel:
fmt.Println(fmt.Sprintf("ID: %s RoomID: %s Msg: %s User: %v", m.ID, m.RoomID, m.Msg, m.User))
count++
}
}
When I send a direct message to the bot on the Rocket Chat application the for loop prints exactly [number of subscribed channels] times the log message.
It can not figure out why. I just wanted to wait for messages in the channel and reply to the sender.
Thanks for your help.
The text was updated successfully, but these errors were encountered:
Hi,
I try to develop a real time light bot for Rocket.
My bot subscribe to each direct room (ie. conversation with other users) with a common channel.
When I send a direct message to the bot on the Rocket Chat application the
for
loop prints exactly [number of subscribed channels] times the log message.It can not figure out why. I just wanted to wait for messages in the channel and reply to the sender.
Thanks for your help.
The text was updated successfully, but these errors were encountered: