mautrix-discord/remoteauth/user.go
Gary Kramlich 94104102d2 Initial discord remote auth support.
It works, but nothing is persisted yet as the user object needs some tweaking
especially the database side.
2022-01-04 20:20:45 -06:00

29 lines
460 B
Go

package remoteauth
import (
"fmt"
"strings"
)
type User struct {
UserID string
Discriminator string
AvatarHash string
Username string
Token string
}
func (u *User) update(payload string) error {
parts := strings.Split(payload, ":")
if len(parts) != 4 {
return fmt.Errorf("expected 4 parts but got %d", len(parts))
}
u.UserID = parts[0]
u.Discriminator = parts[1]
u.AvatarHash = parts[2]
u.Username = parts[3]
return nil
}