This commit is contained in:
shoopea 2020-06-21 19:42:41 +02:00
parent 097734886f
commit 88461c28c6

22
main.go
View File

@ -16,12 +16,14 @@ type Client struct {
CompanyID uint8 CompanyID uint8
} }
var (
bot *tb.Bot
clients map[uint32]*Client
paused bool = true
forcePaused bool = true
)
func main() { func main() {
var (
clients map[uint32]*Client
paused bool = true
forcePaused bool = true
)
clients = make(map[uint32]*Client) clients = make(map[uint32]*Client)
@ -38,12 +40,20 @@ func main() {
} }
_, err = conn.Write(p.Bytes()) _, err = conn.Write(p.Bytes())
failError(err, "conn.Write") failError(err, "conn.Write")
logInfoDebug("Authentication sent (%v)", p.Bytes())
r := bufio.NewReader(conn) r := bufio.NewReader(conn)
b := make([]byte, 0xFFFF) b := make([]byte, 0xFFFF)
read := 0 read := 0
n := 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 { for {
p := Packet{} p := Packet{}