handle leave chat from matrix side

This commit is contained in:
Karmanyaah Malhotra
2021-02-27 19:57:42 -05:00
parent b5af55122e
commit 3e75ffaf05
6 changed files with 279 additions and 262 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/karmanyaahm/groupme"
"maunium.net/go/mautrix-whatsapp/types"
)
type Client struct {
@ -50,3 +51,12 @@ func (c Client) LoadMessagesBefore(groupID, lastMessageID string, num int) ([]*g
}
return i.Messages, nil
}
func (c *Client) RemoveFromGroup(uid, groupID types.GroupMeID) error {
group, err := c.ShowGroup(context.TODO(), groupme.ID(groupID))
if err != nil {
return err
}
return c.RemoveMember(context.TODO(), groupme.ID(groupID), group.GetMemberByUserID(groupme.ID(uid)).ID)
}