Skip to content

Commit

Permalink
Fix UploadMessagesPhoto for vk community chat
Browse files Browse the repository at this point in the history
  • Loading branch information
SevereCloud committed Apr 22, 2022
1 parent ce18c94 commit 92717a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bridge/vk/vk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}()

Expand Down Expand Up @@ -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)
Expand All @@ -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
}
Expand Down

0 comments on commit 92717a5

Please sign in to comment.