Handle InputMedia{Document,Audio} in media groups.
This commit is contained in:
parent
f2cd95670d
commit
b163052f82
4 changed files with 110 additions and 6 deletions
56
configs.go
56
configs.go
|
@ -1805,6 +1805,30 @@ func prepareInputMediaParam(inputMedia interface{}, idx int) interface{} {
|
|||
m.Thumb = fmt.Sprintf("attach://file-%d-thumb", idx)
|
||||
}
|
||||
|
||||
return m
|
||||
case InputMediaAudio:
|
||||
switch m.Media.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
m.Media = fmt.Sprintf("attach://file-%d", idx)
|
||||
}
|
||||
|
||||
switch m.Thumb.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
m.Thumb = fmt.Sprintf("attach://file-%d-thumb", idx)
|
||||
}
|
||||
|
||||
return m
|
||||
case InputMediaDocument:
|
||||
switch m.Media.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
m.Media = fmt.Sprintf("attach://file-%d", idx)
|
||||
}
|
||||
|
||||
switch m.Thumb.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
m.Thumb = fmt.Sprintf("attach://file-%d-thumb", idx)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
|
@ -1847,6 +1871,38 @@ func prepareInputMediaFile(inputMedia interface{}, idx int) []RequestFile {
|
|||
File: f,
|
||||
})
|
||||
}
|
||||
case InputMediaDocument:
|
||||
switch f := m.Media.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
files = append(files, RequestFile{
|
||||
Name: fmt.Sprintf("file-%d", idx),
|
||||
File: f,
|
||||
})
|
||||
}
|
||||
|
||||
switch f := m.Thumb.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
files = append(files, RequestFile{
|
||||
Name: fmt.Sprintf("file-%d", idx),
|
||||
File: f,
|
||||
})
|
||||
}
|
||||
case InputMediaAudio:
|
||||
switch f := m.Media.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
files = append(files, RequestFile{
|
||||
Name: fmt.Sprintf("file-%d", idx),
|
||||
File: f,
|
||||
})
|
||||
}
|
||||
|
||||
switch f := m.Thumb.(type) {
|
||||
case string, FileBytes, FileReader:
|
||||
files = append(files, RequestFile{
|
||||
Name: fmt.Sprintf("file-%d", idx),
|
||||
File: f,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue