示例#1
0
func (t *TradeOffer) UnmarshalJSON(data []byte) error {
	type Alias TradeOffer
	aux := struct {
		*Alias
	}{
		Alias: (*Alias)(t),
	}
	if err := json.Unmarshal(data, &aux); err != nil {
		return err
	}
	if t.OtherAccountId == 0 {
		t.OtherSteamId = steamid.SteamId(0)
		return nil
	}
	t.OtherSteamId = steamid.SteamId(uint64(t.OtherAccountId) + 76561197960265728)
	return nil
}
示例#2
0
文件: grave.go 项目: orbitcube/grave
func GetSteamInfo() (string, string, steamid.SteamId) {
	details, error := ioutil.ReadFile("steam.conf")
	if error != nil {
		log.Print("Steam login not set up. Put \"<username>\n<password>\n<chatId>\" into a file called steam.conf")
		os.Exit(1)
	}

	login := strings.Split(string(details), "\n")
	chatInt, error := strconv.ParseUint(login[2], 10, 64)
	chatId := steamid.SteamId(chatInt)

	return login[0], login[1], chatId
}