1
0
mirror of synced 2024-11-22 04:26:01 +03:00

send animation as file

This commit is contained in:
Pavel 2019-08-28 11:17:11 +03:00
parent 65bd93b242
commit 46810dab09
5 changed files with 10 additions and 1 deletions

View File

@ -1029,6 +1029,10 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S
snd.Message.Type = v1.MsgTypeImage snd.Message.Type = v1.MsgTypeImage
snd.Message.Note = attachments.Caption snd.Message.Note = attachments.Caption
case "animation":
fileID = attachments.Animation.FileID
snd.Message.Type = v1.MsgTypeFile
caption += ".mp4"
case "document": case "document":
fileID = attachments.Document.FileID fileID = attachments.Document.FileID
snd.Message.Type = v1.MsgTypeFile snd.Message.Type = v1.MsgTypeFile
@ -1052,7 +1056,7 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S
item := v1.Item{} item := v1.Item{}
fileUrl := fmt.Sprintf("https://api.telegram.org/file/bot%s/%s", botToken, file.FilePath) fileUrl := fmt.Sprintf("https://api.telegram.org/file/bot%s/%s", botToken, file.FilePath)
switch { switch {
case t == "sticker" || t == "voice": case t == "sticker" || t == "voice" || t == "animation":
item, _, err = getItemData( item, _, err = getItemData(
client, client,
fileUrl, fileUrl,

View File

@ -41,6 +41,8 @@ func getMessageID(data *tgbotapi.Message) string {
return "audio" return "audio"
case data.Contact != nil: case data.Contact != nil:
return "contact" return "contact"
case data.Animation != nil:
return "animation"
case data.Document != nil: case data.Document != nil:
return "document" return "document"
case data.Location != nil: case data.Location != nil:

View File

@ -39,6 +39,7 @@ audio: "[audio file]"
contact: "[contact]" contact: "[contact]"
document: "[document]" document: "[document]"
location: "[location]" location: "[location]"
animation: "[animation]"
video: "[video]" video: "[video]"
voice: "[voice message]" voice: "[voice message]"
photo: "[photo]" photo: "[photo]"

View File

@ -40,6 +40,7 @@ audio: "[archivo de audio]"
contact: "[contacto]" contact: "[contacto]"
document: "[documento]" document: "[documento]"
location: "[localidad]" location: "[localidad]"
animation: "[animación]"
video: "[video]" video: "[video]"
voice: "[mensaje de voz]" voice: "[mensaje de voz]"
photo: "[foto]" photo: "[foto]"

View File

@ -39,6 +39,7 @@ audio: "[аудио файл]"
contact: "[контакт]" contact: "[контакт]"
document: "[документ]" document: "[документ]"
location: "[местонахождение]" location: "[местонахождение]"
animation: "[анимация]"
video: "[видео]" video: "[видео]"
voice: "[голосовое сообщение]" voice: "[голосовое сообщение]"
photo: "[изображение]" photo: "[изображение]"