forked from jshiffer/matterbridge
Fix UploadMessagesPhoto for vk community chat (vk) (#1812)
This commit is contained in:
parent
ce18c948e6
commit
ee932a9f8e
@ -64,7 +64,7 @@ func (b *Bvk) Connect() error {
|
||||
go func() {
|
||||
err := b.lp.Run()
|
||||
if err != nil {
|
||||
b.Log.Fatal("Enable longpoll in group management")
|
||||
b.Log.WithError(err).Fatal("Enable longpoll in group management")
|
||||
}
|
||||
}()
|
||||
|
||||
@ -223,7 +223,7 @@ func (b *Bvk) uploadFiles(extra map[string][]interface{}, peerID int) (string, s
|
||||
}
|
||||
a, err := b.uploadFile(fi, peerID)
|
||||
if err != nil {
|
||||
b.Log.Error("File upload error ", fi.Name)
|
||||
b.Log.WithError(err).Error("File upload error ", fi.Name)
|
||||
}
|
||||
|
||||
attachments = append(attachments, a)
|
||||
@ -237,7 +237,8 @@ func (b *Bvk) uploadFile(file config.FileInfo, peerID int) (string, error) {
|
||||
|
||||
photoRE := regexp.MustCompile(".(jpg|jpe|png)$")
|
||||
if photoRE.MatchString(file.Name) {
|
||||
p, err := b.c.UploadMessagesPhoto(peerID, r)
|
||||
// BUG(VK): for community chat peerID=0
|
||||
p, err := b.c.UploadMessagesPhoto(0, r)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user