aboutsummaryrefslogtreecommitdiff
path: root/telegram/client.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-11-12 18:50:25 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-11-12 18:50:25 +0300
commita5c97d68e77ca8c9c5518051f085051487cd0fbf (patch)
tree75e94674574fc613090bd2f05c88ec9d7f8d751d /telegram/client.go
parentfbe99c65ec36bb0d8b3a508e0894a9830ff9c995 (diff)
Spawn TDlib instances for recovered sessions
Diffstat (limited to 'telegram/client.go')
-rw-r--r--telegram/client.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/telegram/client.go b/telegram/client.go
index 688912b..82f65d0 100644
--- a/telegram/client.go
+++ b/telegram/client.go
@@ -7,6 +7,7 @@ import (
"strconv"
"dev.narayana.im/narayana/telegabber/config"
+ "dev.narayana.im/narayana/telegabber/persistence"
"github.com/zelenin/go-tdlib/client"
)
@@ -35,12 +36,13 @@ type Client struct {
client *client.Client
jid string
parameters *client.TdlibParameters
+ session *persistence.Session
online bool
logVerbosity client.Option
}
// NewClient instantiates a Telegram App
-func NewClient(conf config.TelegramConfig, jid string) (Client, error) {
+func NewClient(conf config.TelegramConfig, jid string, session *persistence.Session) (Client, error) {
logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{
NewVerbosityLevel: stringToLogConstant(conf.Loglevel),
})
@@ -76,6 +78,7 @@ func NewClient(conf config.TelegramConfig, jid string) (Client, error) {
return Client{
parameters: &parameters,
jid: jid,
+ session: session,
logVerbosity: logVerbosity,
}, nil
}