From bef980092f7aba04241cc32c016296b8dd924e97 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 2 Aug 2023 15:14:45 +0300 Subject: [PATCH] Save access token when enabling double puppeting manually. Fixes #5 --- custompuppet.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/custompuppet.go b/custompuppet.go index 4443704..528b804 100644 --- a/custompuppet.go +++ b/custompuppet.go @@ -42,7 +42,15 @@ func (user *User) SwitchCustomMXID(accessToken string, mxid id.UserID) error { } user.DoublePuppetIntent = nil user.AccessToken = accessToken - return user.startCustomMXID(false) + err := user.startCustomMXID(false) + if err != nil { + return err + } + err = user.Update(context.TODO()) + if err != nil { + return fmt.Errorf("failed to save access token to database: %w", err) + } + return nil } func (user *User) CustomIntent() *appservice.IntentAPI {