gsbot

package
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: 15 Imported by: 0

Documentation

Overview

Package gsbot contains some useful utilites for working with the steam package. It implements authentication with sentries, server lists and logging messages and events.

Every module is optional and requires an instance of the GsBot struct.

Each a module auto-registers as `steam.PacketHandler` with the `steam.Client` and `EventHandler` with GsBot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth module handles authentication.

It logs on automatically after a ConnectedEvent and saves the sentry data to a file which is also used for logon if available.

If you're logging on for the first time Steam may require an authcode. You can then connect again with the new logon details.

func NewAuth

func NewAuth(bot *GsBot, credentials *steam.LogOnDetails, sentryPath string) *Auth

func (*Auth) HandleEvent

func (a *Auth) HandleEvent(event interface{})

func (*Auth) LogOn

func (a *Auth) LogOn(credentials *steam.LogOnDetails) error

LogOn is called automatically after every ConnectedEvent, but must be called once again manually with an authcode if Steam requires it when logging on for the first time.

type Debug

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

Debug module logs incoming packets and events to a directory.

func NewDebug

func NewDebug(bot *GsBot, basedir string) (*Debug, error)

func (*Debug) HandleEvent

func (d *Debug) HandleEvent(event interface{})

func (*Debug) HandlePacket

func (d *Debug) HandlePacket(packet *protocol.Packet)

type EventHandler

type EventHandler interface {
	HandleEvent(event interface{})
}

type GsBot

type GsBot struct {
	Client *steam.Client
	Log    *log.Logger
	// contains filtered or unexported fields
}

GsBot is the base struct holding common data among GsBot modules.

func Default

func Default() *GsBot

Default creates a new GsBot with a new steam.Client where logs are written to stdout.

func (*GsBot) HandleEvent

func (bot *GsBot) HandleEvent(event interface{})

func (*GsBot) RegisterEventHandler

func (bot *GsBot) RegisterEventHandler(handler EventHandler)

type ServerList

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

ServerList module saves the server list from ClientCMListEvent and uses it when you call `client.Connect`.

func NewServerList

func NewServerList(bot *GsBot, listPath string) *ServerList

func (*ServerList) Connect

func (s *ServerList) Connect() (bool, error)

func (*ServerList) ConnectBind

func (s *ServerList) ConnectBind(laddr *net.TCPAddr) (bool, error)

func (*ServerList) HandleEvent

func (s *ServerList) HandleEvent(event interface{})

Jump to

Keyboard shortcuts

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