handle leave chat from matrix side

This commit is contained in:
Karmanyaah Malhotra committed 2021-02-27 20:07:46 -05:00
1 parent b5af55122e
commit 3e75ffaf05
6 files changed
+279 -262

No files matched your search

+10
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)
}