mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-20 01:52:38 +01:00
Add initial sticker/video/photo/document support (telegram). #184
This commit is contained in:
parent
c3d45a9f06
commit
2a403f8b85
@ -114,9 +114,31 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
|||||||
if username == "" {
|
if username == "" {
|
||||||
username = "unknown"
|
username = "unknown"
|
||||||
}
|
}
|
||||||
|
if message.Sticker != nil {
|
||||||
|
text = text + " " + b.getFileDirectURL(message.Sticker.FileID)
|
||||||
|
}
|
||||||
|
if message.Video != nil {
|
||||||
|
text = text + " " + b.getFileDirectURL(message.Video.FileID)
|
||||||
|
}
|
||||||
|
if message.Photo != nil {
|
||||||
|
for _, p := range *message.Photo {
|
||||||
|
text = text + " " + b.getFileDirectURL(p.FileID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if message.Document != nil {
|
||||||
|
text = text + " " + message.Document.FileName + " : " + b.getFileDirectURL(message.Document.FileID)
|
||||||
|
}
|
||||||
if text != "" {
|
if text != "" {
|
||||||
flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)
|
flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)
|
||||||
b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account}
|
b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Btelegram) getFileDirectURL(id string) string {
|
||||||
|
res, err := b.c.GetFileDirectURL(id)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user