Versions in this module Expand all Collapse all v1 v1.0.0 Sep 26, 2023 Changes in this version + const DEFAULT_BUFFER_SIZE + const WHOIS_CHANNELS + const WHOIS_END + const WHOIS_USER_ID + var ErrChannelAlreadyJoined = errors.New("already joined") + var ErrChannelNotJoined = errors.New("you are not joined to this channel") + var ErrConnectionTimeout = errors.New("connection timed out") + func SendBanchoBotCommand(ctx context.Context, client *Client, command string, ...) (r *R, err error) + func SendBanchoBotWhere(client *Client, u *User) (string, error) + type BanchoBotStats struct + Accuracy float64 + Level int + Online bool + PlayCount int + Rank int + RankedScore int64 + Status string + UserId int + Username string + func SendBanchoBotStats(client *Client, u *User) (*BanchoBotStats, error) + type BaseMessage struct + Date time.Time + Message string + Self bool + Sender Recipient + User *User + func (b *BaseMessage) Action() string + func (b *BaseMessage) Author() *User + func (b *BaseMessage) Content() string + func (b *BaseMessage) From() Recipient + func (b *BaseMessage) Reply(content string) error + func (b *BaseMessage) ReplyAction(content string) error + func (b *BaseMessage) String() string type Channel + func SendBanchoBotMpMake(c *Client, name string, private bool) (*Channel, error) + func (c *Channel) GetMember(username string) (*ChannelMember, bool) + func (c *Channel) IsClient() bool + func (c *Channel) Part() error + func (c *Channel) Send(message string) error type ChannelMemberMode + const None type Client + UpdateBuffer int + func NewClient(opt ClientOptions) *Client + func (c *Client) GetUpdateChan(listenTypes []UpdateType, bufferSize ...int) chan *Update + func (c *Client) JoinChannel(channelName string) (channel *Channel, err error) + func (c *Client) Quit() <-chan struct{} + func (c *Client) SendRaw(format string, a ...any) error + func (c *Client) Shutdown() type ConnectState + func (s ConnectState) String() string type Message + Author func() *User + From func() Recipient + Reply func(string) error + ReplyAction func(string) error + String func() string type OutgoingMessage + Recipient Recipient + type Recipient interface + IsClient func() bool + Name func() string + Send func(string) error + SendAction func(string) error + Type func() RecipientType + type RecipientType uint8 + const CHANNEL + const USER + type Update struct + ChannelMessage *ChannelMessage + ChannelNotFound string + ConnectState *ConnectState + Error error + Join *ChannelMember + Message Message + Part *ChannelMember + PrivateMessage *PrivateMessage + Quit *User + Raw string + RejectedMessage Message + Type UpdateType + UserNotFound string + Whois *WhoisUpdate + type UpdateType uint8 + const CHANNEL_MESSAGE + const CHANNEL_NOT_FOUND + const CONNECT_STATE + const ERROR + const JOIN + const MESSAGE + const PART + const PRIVATE_MESSAGE + const QUIT + const RAW + const REJECTED_MESSAGE + const USER_NOT_FOUND + const WHOIS type User + func (u *User) Send(message string) error + type UserData struct + Accuracy float64 + Id int + PlayCount int + Rank int + RankedScore int64 + Username string + type WhoisData struct + Channels []*Channel + UserId int + type WhoisUpdate struct + Channels []*Channel + Type WhoisUpdateType + User *User + UserId int + type WhoisUpdateType uint8 v0 v0.0.2 Feb 9, 2023 Changes in this version + const BANCHOHOST + const BANCHOPORT + var ErrBadAuthentication = errors.New("bancho authentication failed") + var ErrChannelNotFound = errors.New("no such channel") + var ErrConnectionClosed = errors.New("connection closed") + var ErrMessageTimeout = errors.New("message timeout") + var ErrMissingCredentials = errors.New("username or password field is empty string, please provide credentials") + var ErrUserNotFound = errors.New("user not found") + var ErrUserOffline = errors.New("user offline") + var IrcHandlers = map[string]func(*Client, []string) + func RandomString() string + func TruncateString(str string, length int) string + type BanchoBotStatsResponse struct + Accuracy float64 + Error error + Level int + Online bool + Rank int + RankedScore int64 + Status string + UserID int + Username string + type Channel struct + ChannelName string + Joined bool + Members *xsync.MapOf[string, *ChannelMember] + Topic string + func NewChannel(b *Client, name string) *Channel + func (c *Channel) Join() <-chan error + func (c *Channel) Leave() <-chan error + func (c *Channel) Name() string + func (c *Channel) OnJoin(handler func(*ChannelMember)) func() + func (c *Channel) OnMessage(handler func(*ChannelMessage)) func() + func (c *Channel) OnPart(handler func(*ChannelMember)) func() + func (c *Channel) OnceJoin(handler func(*ChannelMember)) func() + func (c *Channel) OnceMessage(handler func(*ChannelMessage)) func() + func (c *Channel) OncePart(handler func(*ChannelMember)) func() + func (c *Channel) SendAction(message string) error + func (c *Channel) SendMessage(message string) error + func (c *Channel) Type() string + type ChannelMember struct + Channel *Channel + Mode ChannelMemberMode + User *User + type ChannelMemberHandlerType func(*ChannelMember) + func (eh ChannelMemberHandlerType) Call(a ...interface{}) + func (eh ChannelMemberHandlerType) NumField() int + type ChannelMemberMode string + const IRCModerator + const IRCUser + func (c ChannelMemberMode) ToSymbol() string + type ChannelMessage struct + Channel *Channel + func (b *ChannelMessage) Action() string + func (b *ChannelMessage) Content() string + func (c *ChannelMessage) Sender() MessageSender + type ChannelMessageHandlerType func(*ChannelMessage) + func (eh ChannelMessageHandlerType) Call(a ...interface{}) + func (eh ChannelMessageHandlerType) NumField() int + type Client struct + Api osuapi.Client + BotAccount bool + Channels *xsync.MapOf[string, *Channel] + Done chan struct{} + Host string + Password string + Port string + RateLimiter ratelimit.Limiter + Reconnect bool + Timeout time.Duration + Username string + Users *xsync.MapOf[string, *User] + func NewBanchoClient(opt ClientOptions) (b *Client) + func (b *Client) Close() + func (b *Client) Connect() (err error) + func (b *Client) Disconnect() + func (b *Client) GetChannel(channelName string) (channel *Channel, err error) + func (b *Client) GetSelf() (user *User) + func (b *Client) GetUser(username string) (user *User) + func (b *Client) IsConnected() bool + func (b *Client) IsConnecting() bool + func (b *Client) IsDisconnected() bool + func (b *Client) IsReconnecting() bool + func (b *Client) OnChannelMessage(handler func(*ChannelMessage)) func() + func (b *Client) OnConnect(handler func()) func() + func (b *Client) OnConnectState(handler func(ConnectState)) func() + func (b *Client) OnDisconnect(handler func(error)) func() + func (b *Client) OnError(handler func(error)) func() + func (b *Client) OnJoin(handler func(*ChannelMember)) func() + func (b *Client) OnMessage(handler func(Message)) func() + func (b *Client) OnPart(handler func(*ChannelMember)) func() + func (b *Client) OnPrivateMessage(handler func(*PrivateMessage)) func() + func (b *Client) OnQuit(handler func(*User)) func() + func (b *Client) OnRawMessage(handler func([]string)) func() + func (b *Client) OnceChannelMessage(handler func(*ChannelMessage)) func() + func (b *Client) OnceConnect(handler func()) func() + func (b *Client) OnceConnectState(handler func(ConnectState)) func() + func (b *Client) OnceDisconnect(handler func(error)) func() + func (b *Client) OnceError(handler func(error)) func() + func (b *Client) OnceJoin(handler func(*ChannelMember)) func() + func (b *Client) OnceMessage(handler func(Message)) func() + func (b *Client) OncePart(handler func(*ChannelMember)) func() + func (b *Client) OncePrivateMessage(handler func(*PrivateMessage)) func() + func (b *Client) OnceQuit(handler func(*User)) func() + func (b *Client) OnceRawMessage(handler func([]string)) func() + func (b *Client) Send(format string, a ...any) error + type ClientOptions struct + ApiKey string + BotAccount bool + Host string + Password string + Port string + RateLimiter ratelimit.Limiter + Reconnect *bool + Username string + type ConnectState int + const Connected + const Connecting + const Disconnected + const Reconnecting + type ConnectStateHandlerType func(ConnectState) + func (eh ConnectStateHandlerType) Call(a ...interface{}) + func (eh ConnectStateHandlerType) NumField() int + type EllipseInterfaceHandlerType func(...interface{}) + func (eh EllipseInterfaceHandlerType) Call(a ...interface{}) + func (eh EllipseInterfaceHandlerType) NumField() int + type EmptyHandlerType func() + func (eh EmptyHandlerType) Call(a ...interface{}) + func (eh EmptyHandlerType) NumField() int + type EventEmitter struct + func (e *EventEmitter) Emit(name string, params ...interface{}) + func (e *EventEmitter) On(name string, handler interface{}) func() + func (e *EventEmitter) Once(name string, handler interface{}) func() + func (e *EventEmitter) RemoveAllListeners(name string) + type EventHandler interface + Call func(...interface{}) + NumField func() int + type EventHandlerInstance struct + type Lobby struct + Channel *Channel + Client *Client + Id int + func NewLobby(c *Channel) (l *Lobby) + func (l *Lobby) Name() string + func (l *Lobby) SendAction(message string) error + func (l *Lobby) SendMessage(message string) error + func (l *Lobby) Type() string + type Message interface + Action func() string + Content func() string + Sender func() MessageSender + type MessageHandlerType func(Message) + func (eh MessageHandlerType) Call(a ...interface{}) + func (eh MessageHandlerType) NumField() int + type MessageSender interface + Name func() string + SendAction func(string) error + SendMessage func(string) error + Type func() string + type OutgoingMessage struct + C chan error + Content string + func (o *OutgoingMessage) Send() error + type PrivateMessage struct + Recipient *User + func (b *PrivateMessage) Action() string + func (b *PrivateMessage) Content() string + func (p *PrivateMessage) Sender() MessageSender + type PrivateMessageHandlerType func(*PrivateMessage) + func (eh PrivateMessageHandlerType) Call(a ...interface{}) + func (eh PrivateMessageHandlerType) NumField() int + type RawMessageHandlerType func([]string) + func (eh RawMessageHandlerType) Call(a ...interface{}) + func (eh RawMessageHandlerType) NumField() int + type User struct + func (u *User) Data() osuapi.User + func (u *User) FetchFromAPI(osuMode ...int) (osuapi.User, error) + func (u *User) IsClient() bool + func (u *User) Name() string + func (u *User) OnMessage(handler func(*PrivateMessage)) func() + func (u *User) OnceMessage(handler func(*PrivateMessage)) func() + func (u *User) SendAction(message string) error + func (u *User) SendMessage(message string) error + func (u *User) Stats() <-chan BanchoBotStatsResponse + func (u *User) Type() string + func (u *User) Where() <-chan WhereResponse + func (u *User) Whois() <-chan WhoisResponse + type WhereResponse struct + Country string + Error error + type WhoisResponse struct + Channels []*Channel + Error error + UserId int + type WithErrorHandlerType func(error) + func (eh WithErrorHandlerType) Call(a ...interface{}) + func (eh WithErrorHandlerType) NumField() int