github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/chat/commands/leave.go (about) 1 package commands 2 3 import ( 4 "context" 5 6 "github.com/keybase/client/go/chat/globals" 7 "github.com/keybase/client/go/protocol/chat1" 8 "github.com/keybase/client/go/protocol/gregor1" 9 ) 10 11 type Leave struct { 12 *baseCommand 13 } 14 15 func NewLeave(g *globals.Context) *Leave { 16 return &Leave{ 17 baseCommand: newBaseCommand(g, "leave", "", "Leave the current team channel", false), 18 } 19 } 20 21 func (h *Leave) Execute(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID, 22 tlfName, text string, replyTo *chat1.MessageID) (err error) { 23 defer h.Trace(ctx, &err, "Leave")() 24 if !h.Match(ctx, text) { 25 return ErrInvalidCommand 26 } 27 return h.G().ChatHelper.LeaveConversation(ctx, uid, convID) 28 }