diff options
Diffstat (limited to 'bridge/telegram/telegram.go')
-rw-r--r-- | bridge/telegram/telegram.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 29f2f291..f1c7168c 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -2,6 +2,7 @@ package btelegram import ( "html" + "log" "strconv" "strings" @@ -16,6 +17,8 @@ const ( HTMLFormat = "HTML" HTMLNick = "htmlnick" MarkdownV2 = "MarkdownV2" + FormatPng = "png" + FormatWebp = "webp" ) type Btelegram struct { @@ -25,6 +28,16 @@ type Btelegram struct { } func New(cfg *bridge.Config) bridge.Bridger { + tgsConvertFormat := cfg.GetString("MediaConvertTgs") + if tgsConvertFormat != "" { + err := helper.CanConvertTgsToX() + if err != nil { + log.Fatalf("Telegram bridge configured to convert .tgs files to '%s', but lottie does not appear to work:\n%#v", tgsConvertFormat, err) + } + if tgsConvertFormat != FormatPng && tgsConvertFormat != FormatWebp { + log.Fatalf("Telegram bridge configured to convert .tgs files to '%s', but only '%s' and '%s' are supported.", FormatPng, FormatWebp, tgsConvertFormat) + } + } return &Btelegram{Config: cfg, avatarMap: make(map[string]string)} } |