aboutsummaryrefslogtreecommitdiff
path: root/telegram/connect.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-11-21 00:45:30 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-11-21 00:45:30 +0300
commitc0c21a35a4cfd326423ad530926a0e96c1b07dcf (patch)
treec1b4cc2f019b051c0269b0f92f1aa48eabf4feb5 /telegram/connect.go
parentf0c0d0ba94c923ca06b49211c70db47616e5a8e1 (diff)
Handle unsubscribe presence too, improve logging
Diffstat (limited to 'telegram/connect.go')
-rw-r--r--telegram/connect.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/telegram/connect.go b/telegram/connect.go
index 400c706..c30f9a0 100644
--- a/telegram/connect.go
+++ b/telegram/connect.go
@@ -3,6 +3,7 @@ package telegram
import (
"github.com/pkg/errors"
+ log "github.com/sirupsen/logrus"
"github.com/zelenin/go-tdlib/client"
)
@@ -12,6 +13,8 @@ func (c *Client) Connect() error {
return nil
}
+ log.Warn("Connecting to Telegram network...")
+
authorizer := client.ClientAuthorizer()
go func() {
for {
@@ -48,6 +51,10 @@ func (c *Client) Disconnect() {
return
}
+ log.Warn("Disconnecting from Telegram network...")
+
+ // TODO: send unavailable presence to cached chats
+
c.client.Stop()
c.online = false
}