mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-22 07:00:27 +00:00
parent
aa274e5ab7
commit
64b899ac89
@ -113,6 +113,12 @@ func (b *Bwhatsapp) Connect() error {
|
|||||||
return fmt.Errorf("error on update of contacts: %v", err)
|
return fmt.Errorf("error on update of contacts: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// see https://github.com/Rhymen/go-whatsapp/issues/137#issuecomment-480316013
|
||||||
|
for len(b.conn.Store.Contacts) == 0 {
|
||||||
|
b.conn.Contacts() // nolint:errcheck
|
||||||
|
<-time.After(1 * time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
// map all the users
|
// map all the users
|
||||||
for id, contact := range b.conn.Store.Contacts {
|
for id, contact := range b.conn.Store.Contacts {
|
||||||
if !isGroupJid(id) && id != "status@broadcast" {
|
if !isGroupJid(id) && id != "status@broadcast" {
|
||||||
@ -192,6 +198,12 @@ func isGroupJid(identifier string) bool {
|
|||||||
func (b *Bwhatsapp) JoinChannel(channel config.ChannelInfo) error {
|
func (b *Bwhatsapp) JoinChannel(channel config.ChannelInfo) error {
|
||||||
byJid := isGroupJid(channel.Name)
|
byJid := isGroupJid(channel.Name)
|
||||||
|
|
||||||
|
// see https://github.com/Rhymen/go-whatsapp/issues/137#issuecomment-480316013
|
||||||
|
for len(b.conn.Store.Contacts) == 0 {
|
||||||
|
b.conn.Contacts() // nolint:errcheck
|
||||||
|
<-time.After(1 * time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
// verify if we are member of the given group
|
// verify if we are member of the given group
|
||||||
if byJid {
|
if byJid {
|
||||||
// channel.Name specifies static group jID, not the name
|
// channel.Name specifies static group jID, not the name
|
||||||
|
Loading…
Reference in New Issue
Block a user