whatsapp-multi-devicewhatsapp-apiwhatsapprestgolanggogolang-whatsappbotwhatsapp-web-multi-devicewhatsapp-api-gorest-apigolang-whatsapp-api
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
735 B
29 lines
735 B
package services
|
|
|
|
import (
|
|
"context"
|
|
domainGroup "github.com/aldinokemal/go-whatsapp-web-multidevice/domains/group"
|
|
"github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/whatsapp"
|
|
"go.mau.fi/whatsmeow"
|
|
)
|
|
|
|
type groupService struct {
|
|
WaCli *whatsmeow.Client
|
|
}
|
|
|
|
func NewGroupService(waCli *whatsmeow.Client) domainGroup.IGroupService {
|
|
return &groupService{
|
|
WaCli: waCli,
|
|
}
|
|
}
|
|
|
|
func (service groupService) JoinGroupWithLink(_ context.Context, request domainGroup.JoinGroupWithLinkRequest) (response domainGroup.JoinGroupWithLinkResponse, err error) {
|
|
whatsapp.MustLogin(service.WaCli)
|
|
|
|
jid, err := service.WaCli.JoinGroupWithLink(request.Link)
|
|
if err != nil {
|
|
return
|
|
}
|
|
response.JID = jid.String()
|
|
return response, nil
|
|
}
|