This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
forked from faceit/go-steam
/
doc.go
44 lines (37 loc) · 1.38 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
Allows automation of Steam Trading.
Usage
Like go-steam, this package is event-based. Call Poll() until the trade has ended, that is until the
TradeEndedEvent is emitted.
// After receiving the steam.TradeSessionStartEvent
t := trade.New(sessionIdCookie, steamLoginCookie, steamLoginSecure, event.Other)
for {
eventList, err := t.Poll()
if err != nil {
// error handling here
continue
}
for _, event := range eventList {
switch e := event.(type) {
case *trade.ChatEvent:
// respond to any chat message
t.Chat("Trading is awesome!")
case *trade.TradeEndedEvent:
return
// other event handlers here
}
}
}
You can either log into steamcommunity.com and use the values of the `sessionID` and `steamLogin`
cookies, or use go-steam and after logging in with client.Web.LogOn() and receiving the
WebLoggedOnEvent use the `SessionID` and `SteamLogin` fields of steam.Web for the respective
cookies.
It is important that there is no delay between the Poll() calls greater than the timeout of the
Steam client (currently five seconds before the trade partner sees a warning) or the trade will be
closed automatically by Steam.
Notes
All method calls to Steam APIs are blocking. This packages' and its subpackages' types are not
thread-safe and no calls to any method of the same trade instance may be done concurrently except
when otherwise noted.
*/
package trade