steam

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2020 License: BSD-3-Clause Imports: 36 Imported by: 1

README

Steam for Go

Automate actions on the Steam network with Go.

Introduction

This library implements Steam's protocol to allow automation of different actions on Steam without running an actual Steam client. It is based on SteamKit2, a .NET library.

In addition, it contains APIs to Steam Community features, like trade offers and inventories.

Some of the currently implemented features:

  • Trading and trade offers, including inventories and notifications
  • Friend and group management
  • Chatting with friends
  • Persona states (online, offline, looking to trade, etc.)
  • SteamGuard with two-factor authentication
  • Team Fortress 2: Crafting, moving, naming and deleting items

If this is useful to you, there's also the go-steamapi package that wraps some of the official Steam Web API's types.

This package was originally authored by Philipp15b and was forked/adopted by FACEIT.

Installation

go get github.com/13k/go-steam

Usage

You can view the documentation with the godoc tool or online on godoc.org.

You should also take a look at the following sub-packages:

Working with go-steam

Whether you want to develop your own Steam bot or directly work on go-steam itself, there are are few things to know.

  • If something is not working, check first if the same operation works (under the same conditions!) in the Steam client on that account. Maybe there's something go-steam doesn't handle correctly or you're missing a warning that's not obviously shown in go-steam. This is particularly important when working with trading since there are restrictions, for example newly authorized devices will not be able to trade for seven days.
  • Since Steam does not maintain a public API for most of the things go-steam implements, you can expect that sometimes things break randomly. Especially the trade and tradeoffer packages have been affected in the past.
  • Always gather as much information as possible. When you file an issue, be as precise and complete as you can. This makes debugging way easier.
  • If you haven't noticed yet, expect to find lots of things out yourself. Debugging can be complicated and Steam's internals are too.
  • Sometimes things break and other SteamKit ports are fixed already. Maybe take a look what people are saying over there? There's also the SteamKit IRC channel.

Updating go-steam to a new SteamKit version

To update go-steam to a new version of SteamKit, do the following:

cd generator
go get -d -v ./
go build -v
./generator clean proto steamlang

Apply the protocol changes where necessary.

License

Steam for Go is licensed under the New BSD License. More information can be found in LICENSE.txt.

Documentation

Overview

Package steam allows you to automate actions on Valve's Steam network. It is a Go port of SteamKit.

To login, you'll have to create a new Client first. Then connect to the Steam network and wait for a ConnectedCallback. Then you may call the Login method in the Auth module with your login information. This is covered in more detail in the method's documentation. After you've received the LoggedOnEvent, you should set your persona state to online to receive friend lists etc.

Example code

You can also find a running example in the `gsbot` package.

package main

import (
	"io/ioutil"
	"log"

	"github.com/13k/go-steam"
	"github.com/13k/go-steam-resources/steamlang"
)

func main() {
	myLoginInfo := &steam.LogOnDetails{
		Username: "Your username",
		Password: "Your password",
	}

	client := steam.NewClient()

	client.Connect()

	for event := range client.Events() {
		switch e := event.(type) {
		case *steam.ConnectedEvent:
			client.Auth.LogOn(myLoginInfo)
		case *steam.MachineAuthUpdateEvent:
			ioutil.WriteFile("sentry", e.Hash, 0666)
		case *steam.LoggedOnEvent:
			client.Social.SetPersonaState(steamlang.EPersonaState_Online)
		case steam.FatalErrorEvent:
			log.Print(e)
		case error:
			log.Print(e)
		}
	}
}

Events

go-steam emits events that can be read via Client.Events(). Although the channel has the type interface{}, only types from this package ending with "Event" and errors will be emitted.

Index

Constants

View Source
const (
	MachineIDKeyMachineUUID = "BB3"
	MachineIDKeyMacAddress  = "FF2"
	MachineIDKeyDiskUUID    = "3B3"
	MachineIDKeyUnknownData = "333"
)

Variables

View Source
var CMServers = []string{
	"162.254.192.101:27020",
	"162.254.192.100:27017",
	"162.254.192.100:27020",
	"162.254.192.100:27019",
	"162.254.192.100:27021",
	"162.254.192.101:27019",
	"162.254.192.108:27019",
	"162.254.192.109:27020",
	"162.254.192.109:27017",
	"162.254.192.108:27018",
	"162.254.192.101:27018",
	"162.254.192.109:27019",
	"162.254.192.109:27018",
	"162.254.192.108:27021",
	"162.254.192.109:27021",
	"162.254.192.108:27017",
	"162.254.192.101:27017",
	"162.254.192.100:27018",
	"162.254.192.101:27021",
	"162.254.192.108:27020",
	"162.254.193.6:27019",
	"162.254.193.6:27017",
	"162.254.193.47:27019",
	"162.254.193.6:27018",
	"162.254.193.7:27019",
	"162.254.193.7:27017",
	"162.254.193.47:27018",
	"162.254.193.7:27018",
	"162.254.193.47:27017",
	"162.254.193.46:27018",
	"162.254.193.46:27017",
	"162.254.193.46:27019",
	"155.133.254.132:27019",
	"155.133.254.132:27018",
	"162.254.195.82:27019",
	"162.254.195.66:27017",
	"162.254.195.66:27019",
	"155.133.254.133:27019",
	"155.133.254.132:27021",
	"155.133.254.133:27018",
	"162.254.195.83:27018",
	"162.254.195.66:27018",
	"155.133.254.132:27017",
	"162.254.195.67:27017",
	"162.254.195.82:27018",
	"162.254.195.83:27017",
	"162.254.195.82:27017",
	"162.254.195.83:27019",
	"162.254.195.67:27018",
	"205.196.6.67:27017",
	"155.133.254.133:27017",
	"205.196.6.75:27019",
	"205.196.6.67:27018",
	"155.133.254.132:27020",
	"162.254.195.67:27019",
	"205.196.6.75:27017",
	"205.196.6.67:27019",
	"205.196.6.75:27018",
	"162.254.196.67:27019",
	"162.254.196.83:27017",
	"162.254.196.68:27017",
	"162.254.196.83:27019",
	"162.254.196.68:27019",
	"162.254.196.84:27019",
	"162.254.196.84:27017",
	"162.254.196.67:27018",
	"162.254.196.84:27018",
	"162.254.196.68:27018",
	"162.254.196.83:27018",
	"162.254.196.67:27017",
	"155.133.248.36:27018",
	"155.133.248.36:27020",
	"155.133.248.36:27021",
	"155.133.248.36:27017",
	"155.133.248.36:27019",
	"155.133.248.34:27021",
	"155.133.248.35:27019",
	"155.133.248.35:27017",
	"155.133.248.35:27021",
	"155.133.248.37:27017",
	"155.133.248.37:27021",
	"155.133.248.37:27018",
	"155.133.248.34:27018",
	"155.133.248.35:27020",
	"155.133.248.34:27020",
	"155.133.248.35:27018",
	"155.133.248.34:27019",
	"155.133.248.34:27017",
	"155.133.248.37:27019",
	"155.133.248.37:27020",
	"185.25.182.77:27021",
	"185.25.182.77:27017",
	"185.25.182.76:27019",
	"185.25.182.77:27019",
	"185.25.182.77:27020",
	"185.25.182.77:27018",
	"185.25.182.76:27021",
	"185.25.182.76:27020",
	"185.25.182.76:27018",
	"185.25.182.76:27017",
}

CMServers contains a list of worlwide servers

Functions

func GetPublicKey

func GetPublicKey(universe steamlang.EUniverse) *rsa.PublicKey

func GetRandomCM

func GetRandomCM() (*netutil.PortAddr, error)

func InitializeSteamDirectory

func InitializeSteamDirectory() error

Load initial server list from Steam Directory Web API. Call InitializeSteamDirectory() before Connect() to use steam directory server list instead of static one.

Types

type AccountInfoEvent

type AccountInfoEvent struct {
	PersonaName          string
	Country              string
	CountAuthedComputers int32
	AccountFlags         steamlang.EAccountFlags
	FacebookID           uint64 `json:",string"`
	FacebookName         string
}

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(client *Client) *Auth

func (*Auth) HandlePacket

func (a *Auth) HandlePacket(packet *protocol.Packet)

func (*Auth) LogOn

func (a *Auth) LogOn(details *LogOnDetails) error

LogOn logs on with the given details.

You must always specify username and password OR username and loginkey. For the first login, don't set an authcode or a hash and you'll receive an error (EResult_AccountLogonDenied) and Steam will send you an authcode. Then you have to login again, this time with the authcode.

Shortly after logging in, you'll receive a `MachineAuthUpdateEvent` with a hash which allows you to login without using an authcode in the future.

If you don't use Steam Guard, username and password are enough.

After the event EMsg_ClientNewLoginKey is received you can use the LoginKey to login instead of using the password.

type ChatActionResultEvent

type ChatActionResultEvent struct {
	ChatRoomID steamid.SteamID `json:",string"`
	ChatterID  steamid.SteamID `json:",string"`
	Action     steamlang.EChatAction
	Result     steamlang.EChatActionResult
}

Fired when a chat action has completed

type ChatEnterEvent

type ChatEnterEvent struct {
	ChatRoomID    steamid.SteamID `json:",string"`
	FriendID      steamid.SteamID `json:",string"`
	ChatRoomType  steamlang.EChatRoomType
	OwnerID       steamid.SteamID `json:",string"`
	ClanID        steamid.SteamID `json:",string"`
	ChatFlags     byte
	EnterResponse steamlang.EChatRoomEnterResponse
	Name          string
}

Fired in response to joining a chat

type ChatInviteEvent

type ChatInviteEvent struct {
	InvitedID    steamid.SteamID `json:",string"`
	ChatRoomID   steamid.SteamID `json:",string"`
	PatronID     steamid.SteamID `json:",string"`
	ChatRoomType steamlang.EChatRoomType
	FriendChatID steamid.SteamID `json:",string"`
	ChatRoomName string
	GameID       uint64 `json:",string"`
}

Fired when a chat invite is received

type ChatMemberInfoEvent

type ChatMemberInfoEvent struct {
	ChatRoomID      steamid.SteamID `json:",string"`
	Type            steamlang.EChatInfoType
	StateChangeInfo StateChangeDetails
}

Fired in response to a chat member's info being received

type ChatMsgEvent

type ChatMsgEvent struct {
	ChatRoomID steamid.SteamID `json:",string"` // not set for friend messages
	ChatterID  steamid.SteamID `json:",string"`
	Message    string
	EntryType  steamlang.EChatEntryType
	Timestamp  time.Time
	Offline    bool
}

Fired when the client receives a message from either a friend or a chat room

func (*ChatMsgEvent) IsMessage

func (c *ChatMsgEvent) IsMessage() bool

Whether the type is ChatMsg

type ClanEventDetails

type ClanEventDetails struct {
	ID         uint64 `json:",string"`
	EventTime  uint32
	Headline   string
	GameID     uint64 `json:",string"`
	JustPosted bool
}

type ClanStateEvent

type ClanStateEvent struct {
	ClandID             steamid.SteamID `json:",string"`
	StateFlags          steamlang.EClientPersonaStateFlag
	AccountFlags        steamlang.EAccountFlags
	ClanName            string
	Avatar              string
	MemberTotalCount    uint32
	MemberOnlineCount   uint32
	MemberChattingCount uint32
	MemberInGameCount   uint32
	Events              []ClanEventDetails
	Announcements       []ClanEventDetails
}

Fired when a clan's state has been changed

type Client

type Client struct {
	Auth          *Auth
	Social        *Social
	Web           *Web
	Notifications *Notifications
	Trading       *Trading
	GC            *GameCoordinator
	// contains filtered or unexported fields
}

Client implements a client to the Steam network.

Always poll events from the channel returned by Events() or receiving messages will stop. All access, unless otherwise noted, should be threadsafe.

When a FatalErrorEvent is emitted, the connection is automatically closed. The same client can be used to reconnect. Other errors don't have any effect.

func NewClient

func NewClient() *Client

func (*Client) Connect

func (c *Client) Connect() (*netutil.PortAddr, error)

Connect connects to a random Steam server and returns its address.

If this client is already connected, it is disconnected first.

This method tries to use an address from the Steam Directory and falls back to the built-in server list if the Steam Directory can't be reached.

If you want to connect to a specific server, use `ConnectTo`.

func (*Client) ConnectTo

func (c *Client) ConnectTo(addr *netutil.PortAddr) error

ConnectTo connects to a specific server.

You may want to use one of the `GetRandom*CM()` functions in this package.

If this client is already connected, it is disconnected first.

func (*Client) ConnectToBind

func (c *Client) ConnectToBind(addr *netutil.PortAddr, local *net.TCPAddr) error

ConnectToBind connects to a specific server, and binds to a specified local IP.

If this client is already connected, it is disconnected first.

func (*Client) Connected

func (c *Client) Connected() bool

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) Emit

func (c *Client) Emit(event interface{})

func (*Client) Errorf

func (c *Client) Errorf(format string, a ...interface{})

Emits an error formatted with fmt.Errorf.

func (*Client) Events

func (c *Client) Events() <-chan interface{}

Get the event channel. By convention all events are pointers, except for errors. It is never closed.

func (*Client) Fatalf

func (c *Client) Fatalf(format string, a ...interface{})

Emits a FatalErrorEvent formatted with fmt.Errorf and disconnects.

func (*Client) NextJobID

func (c *Client) NextJobID() protocol.JobID

NextJobID returns the next job ID to use.

func (*Client) RegisterPacketHandler

func (c *Client) RegisterPacketHandler(handler protocol.PacketHandler)

Registers a protocol.PacketHandler that receives all incoming packets.

func (*Client) SessionID

func (c *Client) SessionID() int32

SessionID returns the session id.

func (*Client) SteamID

func (c *Client) SteamID() steamid.SteamID

SteamID returns the client's steam ID.

func (*Client) Write

func (c *Client) Write(msg protocol.Message)

Write adds a message to the send queue.

Modifications to the given message after writing are not allowed (possible race conditions).

Writes to this client when not connected are ignored.

type ClientCMListEvent

type ClientCMListEvent struct {
	Addresses []*netutil.PortAddr
}

A list of connection manager addresses to connect to in the future. You should always save them and then select one of these instead of the builtin ones for the next connection.

type ConnectedEvent

type ConnectedEvent struct{}

type DisconnectedEvent

type DisconnectedEvent struct{}

type FailureEvent

type FailureEvent struct {
	Result steamlang.EResult
}

FailureEvent is emitted when Steam is down for some reason.

type FatalErrorEvent

type FatalErrorEvent error

When this event is emitted by the Client, the connection is automatically closed. This may be caused by a network error, for example.

type FriendAddedEvent

type FriendAddedEvent struct {
	Result      steamlang.EResult
	SteamID     steamid.SteamID `json:",string"`
	PersonaName string
}

Fired in response to adding a friend to your friends list

type FriendStateEvent

type FriendStateEvent struct {
	SteamID      steamid.SteamID `json:",string"`
	Relationship steamlang.EFriendRelationship
}

func (*FriendStateEvent) IsFriend

func (f *FriendStateEvent) IsFriend() bool

type FriendsListEvent

type FriendsListEvent struct{}

type GameCoordinator

type GameCoordinator struct {
	// contains filtered or unexported fields
}

func NewGC

func NewGC(client *Client) *GameCoordinator

func (*GameCoordinator) HandlePacket

func (g *GameCoordinator) HandlePacket(packet *protocol.Packet)

func (*GameCoordinator) RegisterPacketHandler

func (g *GameCoordinator) RegisterPacketHandler(handler gc.PacketHandler)

func (*GameCoordinator) SetGamesPlayed

func (g *GameCoordinator) SetGamesPlayed(appIDs ...uint64)

Sets you in the given games. Specify none to quit all games.

func (*GameCoordinator) Write

func (g *GameCoordinator) Write(msg gc.Message) error

type GroupStateEvent

type GroupStateEvent struct {
	SteamID      steamid.SteamID `json:",string"`
	Relationship steamlang.EClanRelationship
}

func (*GroupStateEvent) IsMember

func (g *GroupStateEvent) IsMember() bool

type IgnoreFriendEvent

type IgnoreFriendEvent struct {
	Result steamlang.EResult
}

Fired in response to ignoring a friend

type LogOnDetails

type LogOnDetails struct {
	Username string
	// Can be omitted if using a LoginKey.
	Password string
	// Previously saved login key.
	LoginKey string
	// Steam Guard email code.
	AuthCode string
	// Steam Guard two-factor authentication code.
	TwoFactorCode string
	// Tells Steam to generate a login key to be used on subsequent logins without a password.
	// A `LoginKeyEvent` event will be emitted with the LoginKey to be saved.
	ShouldRememberPassword bool
	// Previously saved machine identification hash.
	// It can be saved when the event `MachineAuthUpdateEvent` is emitted.
	SentryFileHash SentryHash
	// Previously saved CellID from a `LoggedOnEvent` event.
	CellID uint32
	// LoginID uniquely identifies a logon session (required if establishing more than one active
	// session to the given account).
	LoginID uint32
}

type LogOnFailedEvent

type LogOnFailedEvent struct {
	Result steamlang.EResult
}

type LoggedOffEvent

type LoggedOffEvent struct {
	Result steamlang.EResult
}

type LoggedOnEvent

type LoggedOnEvent struct {
	Result         steamlang.EResult
	ExtendedResult steamlang.EResult
	AccountFlags   steamlang.EAccountFlags
	ClientSteamID  steamid.SteamID `json:",string"`
	Body           *pb.CMsgClientLogonResponse
}

type LoginKeyEvent

type LoginKeyEvent struct {
	UniqueID uint32
	LoginKey string
}

type MachineAuthUpdateEvent

type MachineAuthUpdateEvent struct {
	Hash SentryHash
}

type MachineID

type MachineID struct {
	MachineUUID uuid.UUID
	DiskUUID    uuid.UUID
	MacAddress  net.HardwareAddr
	// contains filtered or unexported fields
}

MachineID identifies the machine running the Steam client.

func NewMachineID

func NewMachineID() (*MachineID, error)

func (*MachineID) Auth

func (id *MachineID) Auth() ([]byte, error)

func (*MachineID) MessageObject

func (id *MachineID) MessageObject() *MessageObject

type MessageObject

type MessageObject struct {
	kv.KeyValue
}

func NewMessageObject

func NewMessageObject() *MessageObject

func (*MessageObject) AddColor

func (o *MessageObject) AddColor(key, value string) *MessageObject

func (*MessageObject) AddFloat32

func (o *MessageObject) AddFloat32(key, value string) *MessageObject

func (*MessageObject) AddInt32

func (o *MessageObject) AddInt32(key, value string) *MessageObject

func (*MessageObject) AddInt64

func (o *MessageObject) AddInt64(key, value string) *MessageObject

func (*MessageObject) AddObject

func (o *MessageObject) AddObject(key string) *MessageObject

func (*MessageObject) AddPointer

func (o *MessageObject) AddPointer(key, value string) *MessageObject

func (*MessageObject) AddString

func (o *MessageObject) AddString(key, value string) *MessageObject

func (*MessageObject) AddUint64

func (o *MessageObject) AddUint64(key, value string) *MessageObject

type NotificationEvent

type NotificationEvent struct {
	Type  NotificationType
	Count uint
}

This event is emitted for every CMsgClientUserNotifications message and likewise only used for trade offers. Unlike the the above it is also emitted when the count of a type that was tracked before by this Notifications instance reaches zero.

type NotificationType

type NotificationType uint
const (
	TradeOffer NotificationType = 1
)

type Notifications

type Notifications struct {
	// contains filtered or unexported fields
}

func NewNotifications

func NewNotifications(client *Client) *Notifications

func (*Notifications) HandlePacket

func (n *Notifications) HandlePacket(packet *protocol.Packet)

type PersonaStateEvent

type PersonaStateEvent struct {
	StatusFlags            steamlang.EClientPersonaStateFlag
	FriendID               steamid.SteamID `json:",string"`
	State                  steamlang.EPersonaState
	StateFlags             steamlang.EPersonaStateFlag
	GameAppID              uint32
	GameID                 uint64 `json:",string"`
	GameName               string
	GameServerIP           uint32
	GameServerPort         uint32
	QueryPort              uint32
	SourceSteamID          steamid.SteamID `json:",string"`
	GameDataBlob           []byte
	Name                   string
	Avatar                 string
	LastLogOff             uint32
	LastLogOn              uint32
	ClanRank               uint32
	ClanTag                string
	OnlineSessionInstances uint32
	PublishedSessionID     uint32
	PersonaSetByUser       bool
	FacebookName           string
	FacebookID             uint64 `json:",string"`
}

Fired when someone changing their friend details

type ProfileInfoEvent

type ProfileInfoEvent struct {
	Result      steamlang.EResult
	SteamID     steamid.SteamID `json:",string"`
	TimeCreated uint32
	RealName    string
	CityName    string
	StateName   string
	CountryName string
	Headline    string
	Summary     string
}

Fired in response to requesting profile info for a user

type SentryHash

type SentryHash []byte

type Social

type Social struct {
	Friends *socialcache.FriendsList
	Groups  *socialcache.GroupsList
	Chats   *socialcache.ChatsList
	// contains filtered or unexported fields
}

Social provides access to social aspects of Steam.

func NewSocial

func NewSocial(client *Client) *Social

func (*Social) AddFriend

func (s *Social) AddFriend(id steamid.SteamID)

AddFriend adds a friend to your friends list or accepts a friend. You'll receive a FriendStateEvent for every new/changed friend.

func (*Social) BanChatMember

func (s *Social) BanChatMember(room steamid.SteamID, user steamid.SteamID)

BanChatMember the specified chat member from the given chat room

func (*Social) GetAvatar

func (s *Social) GetAvatar() string

GetAvatar the local user's avatar

func (*Social) GetPersonaName

func (s *Social) GetPersonaName() string

GetPersonaName the local user's persona name

func (*Social) GetPersonaState

func (s *Social) GetPersonaState() steamlang.EPersonaState

GetPersonaState the local user's persona state

func (*Social) HandlePacket

func (s *Social) HandlePacket(packet *protocol.Packet)

HandlePacket handles a Steam packet.

func (*Social) IgnoreFriend

func (s *Social) IgnoreFriend(id steamid.SteamID, setIgnore bool)

IgnoreFriend ignores or unignores a friend on Steam

func (*Social) JoinChat

func (s *Social) JoinChat(id steamid.SteamID)

JoinChat attempts to join a chat room

func (*Social) KickChatMember

func (s *Social) KickChatMember(room steamid.SteamID, user steamid.SteamID)

KickChatMember the specified chat member from the given chat room

func (*Social) LeaveChat

func (s *Social) LeaveChat(id steamid.SteamID) error

LeaveChat attempts to leave a chat room

func (*Social) RemoveFriend

func (s *Social) RemoveFriend(id steamid.SteamID)

RemoveFriend removes a friend from your friends list

func (*Social) RequestFriendInfo

func (s *Social) RequestFriendInfo(id steamid.SteamID, requestedInfo steamlang.EClientPersonaStateFlag)

RequestFriendInfo requests persona state for a specified SteamID

func (*Social) RequestFriendListInfo

func (s *Social) RequestFriendListInfo(ids []steamid.SteamID, requestedInfo steamlang.EClientPersonaStateFlag)

RequestFriendListInfo requests persona state for a list of specified SteamIDs

func (*Social) RequestProfileInfo

func (s *Social) RequestProfileInfo(id steamid.SteamID)

RequestProfileInfo requests profile information for a specified SteamID

func (*Social) SendMessage

func (s *Social) SendMessage(to steamid.SteamID, entryType steamlang.EChatEntryType, message string)

SendMessage a chat message to ether a room or friend

func (*Social) SetPersonaName

func (s *Social) SetPersonaName(name string)

SetPersonaName the local user's persona name and broadcasts it over the network

func (*Social) SetPersonaState

func (s *Social) SetPersonaState(state steamlang.EPersonaState)

SetPersonaState the local user's persona state and broadcasts it over the network

func (*Social) UnbanChatMember

func (s *Social) UnbanChatMember(room steamid.SteamID, user steamid.SteamID)

UnbanChatMember the specified chat member from the given chat room

type StateChangeDetails

type StateChangeDetails struct {
	ChatterActedOn steamid.SteamID `json:",string"`
	StateChange    steamlang.EChatMemberStateChange
	ChatterActedBy steamid.SteamID `json:",string"`
}

type TradeProposedEvent

type TradeProposedEvent struct {
	RequestID TradeRequestID
	Other     steamid.SteamID `json:",string"`
}

type TradeRequestID

type TradeRequestID uint32

type TradeResultEvent

type TradeResultEvent struct {
	RequestID TradeRequestID
	Response  steamlang.EEconTradeResponse
	Other     steamid.SteamID `json:",string"`
	// Number of days Steam Guard is required to have been active
	NumDaysSteamGuardRequired uint32
	// Number of days a new device cannot trade for.
	NumDaysNewDeviceCooldown uint32
	// Default number of days one cannot trade after a password reset.
	DefaultNumDaysPasswordResetProbation uint32
	// See above.
	NumDaysPasswordResetProbation uint32
}

type TradeSessionStartEvent

type TradeSessionStartEvent struct {
	Other steamid.SteamID `json:",string"`
}

type Trading

type Trading struct {
	// contains filtered or unexported fields
}

Trading provides access to the Steam client's part of Steam Trading, that is bootstrapping the trade.

The trade itself is not handled by the Steam client itself, but it's a part of the Steam website.

You'll receive a TradeProposedEvent when a friend proposes a trade. You can accept it with the RespondRequest method. You can request a trade yourself with RequestTrade.

func NewTrading

func NewTrading(client *Client) *Trading

func (*Trading) CancelRequest

func (t *Trading) CancelRequest(other steamid.SteamID)

This cancels a request made with RequestTrade.

func (*Trading) HandlePacket

func (t *Trading) HandlePacket(packet *protocol.Packet)

func (*Trading) RequestTrade

func (t *Trading) RequestTrade(other steamid.SteamID)

Requests a trade. You'll receive a TradeResultEvent if the request fails or if the friend accepted the trade.

func (*Trading) RespondRequest

func (t *Trading) RespondRequest(requestID TradeRequestID, accept bool)

Responds to a TradeProposedEvent.

type Web

type Web struct {

	// The `sessionid` cookie required to use the steam website.
	// This cookie may contain a characters that will need to be URL-escaped, otherwise
	// Steam (probably) interprets is as a string.
	// When used as an URL parameter this is automatically escaped by the Go HTTP package.
	SessionID string
	// The `steamLogin` cookie required to use the steam website. Already URL-escaped.
	// This is only available after calling LogOn().
	SteamLogin string
	// The `steamLoginSecure` cookie required to use the steam website over HTTPs. Already URL-escaped.
	// This is only availbile after calling LogOn().
	SteamLoginSecure string
	// contains filtered or unexported fields
}

func NewWeb

func NewWeb(client *Client) *Web

func (*Web) HandlePacket

func (w *Web) HandlePacket(packet *protocol.Packet)

func (*Web) LogOn

func (w *Web) LogOn() error

LogOn fetches the `steamLogin` cookie.

Returns an error if called before the first WebSessionIdEvent.

type WebLogOnErrorEvent

type WebLogOnErrorEvent error

type WebLoggedOnEvent

type WebLoggedOnEvent struct{}

type WebSessionIDEvent

type WebSessionIDEvent struct{}

Directories

Path Synopsis
cmd
gsbot
A simple example that uses the modules from the gsbot package and go-steam to log on to the Steam network.
A simple example that uses the modules from the gsbot package and go-steam to log on to the Steam network.
economy
inventory
Package inventory includes types as used in the trade package.
Package inventory includes types as used in the trade package.
trade
Allows automation of Steam Trading.
Allows automation of Steam Trading.
trade/api
Package api implements a trading API client.
Package api implements a trading API client.
trade/tradeoffer
Implements methods to interact with the official Trade Offer API.
Implements methods to interact with the official Trade Offer API.
Package gsbot contains some useful utilites for working with the steam package.
Package gsbot contains some useful utilites for working with the steam package.
internal
sys
Includes helper types for working with JSON data
Includes helper types for working with JSON data
Package protocol includes some basics for the Steam protocol.
Package protocol includes some basics for the Steam protocol.
gc
Package rwu provides utilities for reading and writing binary data.
Package rwu provides utilities for reading and writing binary data.
Package steamid provides types and functions to represent and manipulate a SteamID.
Package steamid provides types and functions to represent and manipulate a SteamID.
tf2
Provides access to TF2 Game Coordinator functionality.
Provides access to TF2 Game Coordinator functionality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL