forked from hswaw/hscloud
lelegram: mutually exclude multimedia
Change-Id: I6c300e8627c825f5b2f1281efc8f4c33574289f7
This commit is contained in:
parent
a885488fd0
commit
a07688fe74
2 changed files with 9 additions and 9 deletions
|
@ -8,7 +8,7 @@ local kube = import "../../kube/kube.libsonnet";
|
|||
},
|
||||
image: {
|
||||
teleimg: "registry.k0.hswaw.net/q3k/teleimg:1578243230-79e4e790f877597c3175823ee7783eb99744dc27",
|
||||
lelegram: "registry.k0.hswaw.net/q3k/lelegram:1578253551-79e4e790f877597c3175823ee7783eb99744dc27",
|
||||
lelegram: "registry.k0.hswaw.net/q3k/lelegram:1578255597-a885488fd0f9fcd271f6a02416aae5bb3fd9c9ac",
|
||||
},
|
||||
bridge: {
|
||||
telegram: "-1001345766954",
|
||||
|
|
|
@ -123,14 +123,15 @@ func plainFromTelegram(selfID int, u *tgbotapi.Update) *telegramPlain {
|
|||
parts = append(parts, fmt.Sprintf("<sticker%s>", emoji))
|
||||
}
|
||||
|
||||
// This message contains an animation.
|
||||
if u.Message.Animation != nil {
|
||||
// Mutually exclusive stuff.
|
||||
switch {
|
||||
case u.Message.Animation != nil:
|
||||
// This message contains an animation.
|
||||
a := u.Message.Animation
|
||||
parts = append(parts, fmt.Sprintf("<uploaded animation: %s >\n", fileURL(a.FileID, "mp4")))
|
||||
}
|
||||
|
||||
// This message contains a document.
|
||||
if u.Message.Document != nil {
|
||||
case u.Message.Document != nil:
|
||||
// This message contains a document.
|
||||
d := u.Message.Document
|
||||
fnp := strings.Split(d.FileName, ".")
|
||||
ext := "bin"
|
||||
|
@ -138,10 +139,9 @@ func plainFromTelegram(selfID int, u *tgbotapi.Update) *telegramPlain {
|
|||
ext = fnp[len(fnp)-1]
|
||||
}
|
||||
parts = append(parts, fmt.Sprintf("<uploaded file: %s >\n", fileURL(d.FileID, ext)))
|
||||
}
|
||||
|
||||
// This message contains a photo.
|
||||
if u.Message.Photo != nil {
|
||||
case u.Message.Photo != nil:
|
||||
// This message contains a photo.
|
||||
// Multiple entries are for different file sizes, choose the highest quality one.
|
||||
hq := (*u.Message.Photo)[0]
|
||||
for _, p := range *u.Message.Photo {
|
||||
|
|
Loading…
Reference in a new issue