21 lines
404 B
Go
21 lines
404 B
Go
package discord
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
var ErrNoSteam error = errors.New("steam connection not found")
|
|
|
|
func (s *OAuthSession) GetSteamID() (string, error) {
|
|
connections, err := s.UserConnections()
|
|
if err != nil {
|
|
return "", errors.Wrap(err, "s.UserConnections")
|
|
}
|
|
for _, conn := range connections {
|
|
if conn.Type == "steam" {
|
|
return conn.ID, nil
|
|
}
|
|
}
|
|
return "", ErrNoSteam
|
|
}
|