session

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Overview

Package session abstracts around the REST API and the Gateway, managing both at once. It offers a handler interface similar to that in discordgo for Gateway events.

Index

Constants

This section is empty.

Variables

View Source
var ErrMFA = errors.New("Account has 2FA enabled")

Functions

This section is empty.

Types

type Session

type Session struct {
	*api.Client
	Gateway *gateway.Gateway

	// Command handler with inherited methods.
	*handler.Handler

	// MFA only fields
	MFA    bool
	Ticket string
	// contains filtered or unexported fields
}

Session manages both the API and Gateway. As such, Session inherits all of API's methods, as well has the Handler used for Gateway.

func Login added in v0.0.2

func Login(email, password, mfa string) (*Session, error)

Login tries to log in as a normal user account; MFA is optional.

func New

func New(token string) (*Session, error)

func NewWithGateway

func NewWithGateway(gw *gateway.Gateway) *Session

func (*Session) Close

func (s *Session) Close() error

func (*Session) Open

func (s *Session) Open() error

func (*Session) Wait added in v0.1.5

func (s *Session) Wait() error

Wait blocks until either a SIGINT or a Gateway fatal error is received. Check the Gateway documentation for more information.

Jump to

Keyboard shortcuts

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