diff --git a/main.go b/main.go index 028eee1..4185319 100644 --- a/main.go +++ b/main.go @@ -16,12 +16,14 @@ type Client struct { CompanyID uint8 } +var ( + bot *tb.Bot + clients map[uint32]*Client + paused bool = true + forcePaused bool = true +) + func main() { - var ( - clients map[uint32]*Client - paused bool = true - forcePaused bool = true - ) clients = make(map[uint32]*Client) @@ -38,12 +40,20 @@ func main() { } _, err = conn.Write(p.Bytes()) failError(err, "conn.Write") - logInfoDebug("Authentication sent (%v)", p.Bytes()) r := bufio.NewReader(conn) b := make([]byte, 0xFFFF) read := 0 n := 0 + // Registering bot + bot, err = tb.NewBot(tb.Settings{ + Token: "954090437:AAEMYeUWGluKZRwXi_K3-T23ZVpFoqQAmu0", + URL: "https://api.telegram.org", + Poller: &tb.LongPoller{Timeout: 10 * time.Second}, + }) + failError(err, "Registering bot") + logInfoDebug("Connected to Telegram") + for { p := Packet{}