bancho

package module
v0.0.0-...-d7944d1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

README


gobancho
gobancho

A Go library for communicating with osu! Bancho.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Username:   "",
	Password:   "",
	Host:       "irc.ppy.sh",
	Port:       6667,
	APIKey:     "",
	BotAccount: false,
}
View Source
var IgnoredSplits = []string{
	"312",
	"333",
	"366",
	"372",
	"375",
	"376",
}

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Client *Client

	Name     string
	Topic    string
	Type     enums.ChannelType
	IsJoined bool
	Members  map[string]*Member

	Lobby *Lobby
}

func NewChannel

func NewChannel(client *Client, channelName string) *Channel

func (*Channel) Join

func (ch *Channel) Join()

type Client

type Client struct {
	Username   string
	Password   string
	Host       string
	Port       uint16
	APIKey     string
	BotAccount bool

	ConnectionState enums.ConnectionState
	Users           map[string]*User
	Channels        map[string]*Channel
	MessageQueue    []*OutgoingMessage
	RateLimiter     *rate.Limiter

	OnMessageReceived OnMessageReceivedHandler
}

func New

func New(config ...Config) *Client

func (*Client) Channel

func (c *Client) Channel(channelName string) (*Channel, error)

func (*Client) Connect

func (c *Client) Connect()

func (*Client) CreateLobby

func (c *Client) CreateLobby(name string) (*Channel, error)

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) HandleIRCCommand

func (c *Client) HandleIRCCommand(message string)

func (*Client) Listen

func (c *Client) Listen()

func (*Client) ProcessMessageQueue

func (c *Client) ProcessMessageQueue() error

ProcessMessageQueue Process client messages

func (*Client) Self

func (c *Client) Self() *User

func (*Client) Send

func (c *Client) Send(message string)

func (*Client) User

func (c *Client) User(username string) *User

type Config

type Config struct {
	Username   string
	Password   string
	Host       string
	Port       uint16
	APIKey     string
	BotAccount bool
}

type Lobby

type Lobby struct {
	Client    *Client
	Channel   *Channel
	ID        uint
	Name      string
	BeatmapID uint
}

type Member

type Member struct {
	Channel *Channel
	User    *User
	Mode    *MemberMode
}

func NewMember

func NewMember(client *Client, channel *Channel, username string) *Member

type MemberMode

type MemberMode struct {
	IRCLetter string
	Name      string
}

func NewMemberMode

func NewMemberMode(letter, name string) *MemberMode

type Message

type Message struct {
	Author    *User
	Channel   *Channel
	Content   string
	Timestamp *time.Time
	IsAction  bool
}

func NewMessage

func NewMessage(author *User, channel *Channel, content string, timestamp *time.Time, isAction bool) *Message

type OnMessageReceivedHandler

type OnMessageReceivedHandler func(*Client)

type OutgoingMessage

type OutgoingMessage struct {
	Client *Client

	RecipientUser    *User
	RecipientChannel *Channel
	Content          string
}

func NewOutgoingMessage

func NewOutgoingMessage(client *Client, recipientUser *User, recipientChannel *Channel, content string) *OutgoingMessage

func (*OutgoingMessage) Send

func (msg *OutgoingMessage) Send() error

type User

type User struct {
	Client      *Client
	IRCUsername string

	ID                 uint
	Username           string
	Country            string
	JoinDate           *time.Time
	PerformancePoint   float64
	GlobalRank         uint
	CountryRank        uint
	TotalScore         uint
	RankedScore        uint
	Accuracy           float64
	Count300           uint
	Count100           uint
	Count50            uint
	PlayCount          uint
	TotalSecondsPlayed uint
	Level              float64
	CountRankSS        uint
	CountRankS         uint
	CountRankA         uint
}

func NewUser

func NewUser(client *Client, username string) *User

func (*User) IsClient

func (u *User) IsClient() bool

func (*User) Send

func (u *User) Send(content string) (*Message, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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