-// Notify queues event for the chat. It never blocks, so a slow network does not
-// stop the agent. The WhatsApp batches and the runs of the schedules do not go
-// to the chat: the reply of the agent tells the user what needs the user.
-func (b *TelegramBot) Notify(event Event) {
- switch event.Kind {
- case "busy", "idle", "reply", "error", "notice", "subagent":
- case "work":
- if event.Source == whatsappSource || event.Source == scheduleSource {
- return
- }
- case "user":
- if event.Source == telegramSource {
- return
- }
- default:
- return
- }
-
- b.mutex.Lock()
-
- b.queue = append(b.queue, event)
- b.mutex.Unlock()
-
- select {
- case b.ready <- struct{}{}:
- default:
- }
-}
-