diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-01-27 09:57:46 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-01-27 09:57:46 +0300 |
commit | 540c6cd546ccadbb2c32e435d1fdcb5af24a1360 (patch) | |
tree | a79c3809a6776844afcc21544518f587abed243b /telegram | |
parent | 6da0fd56fff386f19ae982cc02c8f0996c51e2f1 (diff) |
Unhardcode some paths
Diffstat (limited to 'telegram')
-rw-r--r-- | telegram/client.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/telegram/client.go b/telegram/client.go index 4995597..8813df0 100644 --- a/telegram/client.go +++ b/telegram/client.go @@ -78,11 +78,16 @@ func NewClient(conf config.TelegramConfig, jid string, component *xmpp.Component return &Client{}, errors.Wrap(err, "Wrong api_id") } + datadir := conf.Tdlib.Datadir + if datadir == "" { + datadir = "./sessions/" // ye olde defaute + } + parameters := client.TdlibParameters{ UseTestDc: false, - DatabaseDirectory: filepath.Join("./sessions/", jid), - FilesDirectory: filepath.Join("./sessions/", jid, "/files/"), + DatabaseDirectory: filepath.Join(datadir, jid), + FilesDirectory: filepath.Join(datadir, jid, "/files/"), UseFileDatabase: true, UseChatInfoDatabase: conf.Tdlib.Client.UseChatInfoDatabase, |