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 {