7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
44 lines
934 B
Go
44 lines
934 B
Go
package telegram
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/constant"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
|
|
)
|
|
|
|
// Available MTProto default server addresses.
|
|
//
|
|
// See https://my.telegram.org/apps.
|
|
const (
|
|
AddrProduction = "149.154.167.50:443"
|
|
AddrTest = "149.154.167.40:443"
|
|
)
|
|
|
|
// Test-only credentials. Can be used with AddrTest and TestAuth to
|
|
// test authentication.
|
|
//
|
|
// Reference:
|
|
// - https://github.com/telegramdesktop/tdesktop/blob/5f665b8ecb48802cd13cfb48ec834b946459274a/docs/api_credentials.md
|
|
const (
|
|
TestAppID = constant.TestAppID
|
|
TestAppHash = constant.TestAppHash
|
|
)
|
|
|
|
// Config returns current config.
|
|
func (c *Client) Config() tg.Config {
|
|
return c.cfg.Load()
|
|
}
|
|
|
|
func (c *Client) fetchConfig(ctx context.Context) {
|
|
cfg, err := c.tg.HelpGetConfig(ctx)
|
|
if err != nil {
|
|
c.log.Warn("Got error on config update", zap.Error(err))
|
|
return
|
|
}
|
|
|
|
c.cfg.Store(*cfg)
|
|
}
|