Raw Updates

You can also register a raw handler that will be called for all updates. This is useful when you want to handle all updates in a single function or when you want to handle updates that are not supported by custom handlers.

package main
 
import (
    "fmt"
    "github.com/amarnathcjd/gogram/telegram"
)
 
func main() {
    client, _ := telegram.NewClient(telegram.ClientConfig{ // Create a new client
        AppID:   6,
        AppHash: "app_hash",
    })
    client.Start() // establish a connection to the Telegram servers
 
    client.AddRawHandler(func(update *telegram.Update) error {
        fmt.Println("Raw update:", update)
        return nil
    })
}