5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-25 06:05:39 +00:00

Remove GroupID (vk) (#1668)

This commit is contained in:
Daniil Suvorov 2022-01-10 00:50:07 +03:00 committed by GitHub
parent e3ee0df7ba
commit 16ab4c6fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -34,6 +34,7 @@ type user struct {
type Bvk struct {
c *api.VK
lp *longpoll.LongPoll
usernamesMap map[int]user // cache of user names and avatar URLs
*bridge.Config
}
@ -45,21 +46,23 @@ func New(cfg *bridge.Config) bridge.Bridger {
func (b *Bvk) Connect() error {
b.Log.Info("Connecting")
b.c = api.NewVK(b.GetString("Token"))
lp, err := longpoll.NewLongPoll(b.c, b.GetInt("GroupID"))
var err error
b.lp, err = longpoll.NewLongPollCommunity(b.c)
if err != nil {
b.Log.Debugf("%#v", err)
return err
}
lp.MessageNew(func(ctx context.Context, obj events.MessageNewObject) {
b.lp.MessageNew(func(ctx context.Context, obj events.MessageNewObject) {
b.handleMessage(obj.Message, false)
})
b.Log.Info("Connection succeeded")
go func() {
err := lp.Run()
err := b.lp.Run()
if err != nil {
b.Log.Fatal("Enable longpoll in group management")
}
@ -69,6 +72,8 @@ func (b *Bvk) Connect() error {
}
func (b *Bvk) Disconnect() error {
b.lp.Shutdown()
return nil
}

View File

@ -1539,10 +1539,6 @@ MessageClipped="<clipped message>"
#See https://vk.com/dev/bots_docs
Token="Yourtokenhere"
#Group ID
#For example in URL https://vk.com/public168963511 group ID is 168963511
GroupID=123456789
###################################################################
# WhatsApp
###################################################################