Konubinix' opinionated web of thoughts

Matrix Bridge Slack Double Puppeting

Fleeting

I get did get a ghost. Indeed, it is not implemented yet

func (user *User) GetIGhost() bridge.Ghost {
    // if user.ID == "" {
    // 	return nil
    // }
    // p := user.bridge.GetPuppetByID(user.ID)
    // if p == nil {
    // 	return nil
    // }
    // return p
    return nil
}

...

func fnLoginMatrix(ce *Event) {
    if len(ce.Args) == 0 {
        ce.Reply("**Usage:** `login-matrix <access token>`")
        return
    }
    puppet := ce.User.GetIDoublePuppet()
    if puppet == nil {
        puppet = ce.User.GetIGhost()
        if puppet == nil {
            ce.Reply("Didn't get a ghost :(")
            return
        }
    }
    err := puppet.SwitchCustomMXID(ce.Args[0], ce.User.GetMXID())
    if err != nil {
        ce.Reply("Failed to enable double puppeting: %v", err)
    } else {
        ce.Reply("Successfully switched puppet")
    }
}