move gotd fork into repo. (#111)

- 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
This commit is contained in:
Adam Van Ymeren
2025-06-27 20:03:37 -07:00
committed by GitHub
parent 0952df0244
commit 7a04f298d2
19264 changed files with 1539697 additions and 84 deletions
@@ -0,0 +1,61 @@
package manager
import (
"runtime"
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/internal/version"
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
)
// DeviceConfig is config which send when Telegram connection session created.
type DeviceConfig struct {
// Device model.
DeviceModel string
// Operating system version.
SystemVersion string
// Application version.
AppVersion string
// Code for the language used on the device's OS, ISO 639-1 standard.
SystemLangCode string
// Language pack to use.
LangPack string
// Code for the language used on the client, ISO 639-1 standard.
LangCode string
// Info about an MTProto proxy.
Proxy tg.InputClientProxy
// Additional initConnection parameters. For now, only the tz_offset field is supported,
// for specifying timezone offset in seconds.
Params tg.JSONValueClass
}
// SetDefaults sets default values.
func (c *DeviceConfig) SetDefaults() {
const notAvailable = "n/a"
// Strings must be non-empty, so set notAvailable if default value is empty.
set := func(to *string, value string) {
if value != "" {
*to = value
} else {
*to = notAvailable
}
}
if c.DeviceModel == "" {
set(&c.DeviceModel, runtime.Version())
}
if c.SystemVersion == "" {
set(&c.SystemVersion, runtime.GOOS)
}
if c.AppVersion == "" {
set(&c.AppVersion, version.GetVersion())
}
if c.SystemLangCode == "" {
c.SystemLangCode = "en"
}
if c.LangCode == "" {
c.LangCode = "en"
}
// It's okay to use zero value Proxy.
// It's okay to use zero value Params.
}