Comments (5)
I just change "version" from 3 to 2 and add converting to 64 SteamID from 32 SteamID in POST data
data := map[string]string{
"sessionid": c.sessionId,
"serverid": "1",
"partner": fmt.Sprintf("%d", other),
"tradeoffermessage": message,
"json_tradeoffer": string(jto),
"captcha": "",
"trade_offer_create_params": string(paramsJson),
}
to
data := map[string]string{
"sessionid": c.sessionId,
"serverid": "1",
"partner": fmt.Sprintf("%d", (((other.ToUint64() >> 1) * 2) + 76561197960265728)), // convert to 64SteamID
"tradeoffermessage": message,
"json_tradeoffer": string(jto),
"captcha": "",
"trade_offer_create_params": string(paramsJson),
}
And now I can get resp.Body with content: http://i.imgur.com/nWiCkwX.png
from go-steam.
So nobody can't help me?
case *steam.WebLoggedOnEvent:
log.Print("Successfully logged on web")
token := "awajV_Bp"
TOClient := tradeoffer.NewClient(SteamAPIKey, client.Web.SessionId, client.Web.SteamLogin, client.Web.SteamLoginSecure)
myItems := make([]tradeoffer.TradeItem, 1)
theirItems := make([]tradeoffer.TradeItem, 0)
myItems[0] = tradeoffer.TradeItem{
AppId: uint32(730),
ContextId: uint64(2),
Amount: uint(1),
AssetId: uint64(there was CORRECT asset id),
}
SID, _ := steamid.NewId(there was account id)
log.Println(TOClient.Create(SID, &token, myItems, theirItems, nil, ""))
Doesn't work too
from go-steam.
My own version of "create" function:
func (c *Client) Create(target steamid.SteamId, token string, myItems, theirItems []TradeItem, countered *TradeOfferId, message string) (*TradeCreateResult, error) {
tradeoffer := map[string]interface{}{
"newversion": true,
"version": 2,
"me": map[string]interface{}{
"assets": myItems,
"currency": make([]struct{}, 0),
"ready": false,
},
"them": map[string]interface{}{
"assets": theirItems,
"currency": make([]struct{}, 0),
"ready": false,
},
}
jto, err := json.Marshal(tradeoffer)
if err != nil {
panic(err)
}
formFields := map[string]string{
"serverid": "1",
"sessionid": c.sessionId,
"partner": target.ToString(),
"tradeoffermessage": message,
"json_tradeoffer": string(jto),
}
text, _ := json.Marshal(formFields)
fmt.Println(string(text)) // Debug
var referer string
if countered != nil {
referer = fmt.Sprintf("https://steamcommunity.com/tradeoffer/%d/", *countered)
formFields["tradeofferid_countered"] = fmt.Sprintf("%d", *countered)
} else {
if (token != "") {
params := make(map[string]string)
if token != "" {
params["trade_offer_access_token"] = token
}
paramsJson, err := json.Marshal(params)
if err != nil {
panic(err)
}
formFields["trade_offer_create_params"] = string(paramsJson)
referer = "https://steamcommunity.com/tradeoffer/new/?partner="+strconv.FormatUint(uint64(target.GetAccountId()), 10)+"&token="+token
} else {
referer = "https://steamcommunity.com/tradeoffer/new/?partner="+strconv.FormatUint(uint64(target.GetAccountId()), 10)
}
}
req := netutil.NewPostForm("https://steamcommunity.com/tradeoffer/new/send", netutil.ToUrlValues(formFields))
req.Header.Add("Referer", referer)
fmt.Println(req.Header) // Debug
resp, err := c.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
// If we failed, error out
if resp.StatusCode != 200 {
fmt.Println("StatusCode", resp.StatusCode) // Debug
data, _ := ioutil.ReadAll(resp.Body) // Debug
fmt.Println(string(data)) // Debug
return nil, errors.New("create error: status code not 200")
}
// Load the JSON result into TradeCreateResult
result := new(TradeCreateResult)
decoder := json.NewDecoder(resp.Body)
decoder.Decode(result)
return result, nil
}
and
case *steam.WebLoggedOnEvent:
log.Print("Successfully logged on web")
TOClient := tradeoffer.NewClient(SteamAPIKey, client.Web.SessionId, client.Web.SteamLogin, client.Web.SteamLoginSecure)
myItems := make([]tradeoffer.TradeItem, 1)
theirItems := make([]tradeoffer.TradeItem, 0)
myItems[0] = tradeoffer.TradeItem{
AppId: uint32(730),
ContextId: uint64(2),
Amount: uint(1),
AssetId: uint64(there was CORRECT asset id),
}
SID, err := steamid.NewId(there was SteamID64)
log.Println(err)
log.Println(TOClient.Create(SID, "awajV_Bp", myItems, theirItems, nil, ""))
but it too returns
{"strError":"There was an error sending your trade offer. Please try again later. (26)"}
from go-steam.
@TwinkerMan you resolve problem? May be you bot under defence SteamGuard?
from go-steam.
Closing due to unresponsiveness. Hopefully everything works OK now.
from go-steam.
Related Issues (20)
- AuthSessionTicket implementation HOT 2
- download CSGO demo HOT 3
- SteamKit 2.3.0 Full Release HOT 3
- Feature request: Auto-generate Steam Guard TOTP codes HOT 1
- Use in C ++ project?
- SteamAPI.Init == true - should it work?
- gs-bot returns connection failure on successful connection HOT 1
- Wrong module path in go.mod HOT 12
- Update generator for new protoc and protoc-gen-go HOT 1
- Steam Unified Messaging HOT 1
- Sentry file ignored — possible cause HOT 2
- proto: file "steammessages_base.proto" has a name conflict over CMsgProtoBufHeader HOT 3
- how to accept trade offer and confirm with MFA?
- Is there a sending gift example?
- Send message to group chat HOT 1
- client.Connect() timeout HOT 4
- Gamecordinator csgo send ECsgoGCMsg = 9156 but steam not respond anyhing HOT 1
- how can I disconnect correctly without a data race?
- Hello, can you update the new version of cookies for Steam? The current access token for encrypted Steam is universal
- Runtime Error on handleLogOnResponse HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-steam.