Documentation ¶
Overview ¶
Package chat implements the official classic Battle.net chat API.
Index ¶
- Variables
- type Bot
- func (b *Bot) BanUser(uid int64) error
- func (b *Bot) Channel() string
- func (b *Bot) Connect() error
- func (b *Bot) InitDefaultHandlers()
- func (b *Bot) KickUser(uid int64) error
- func (b *Bot) RPC(command string, arg ...interface{}) (interface{}, error)
- func (b *Bot) Run() error
- func (b *Bot) SendEmote(s string) error
- func (b *Bot) SendMessage(s string) error
- func (b *Bot) SendWhisper(uid int64, s string) error
- func (b *Bot) SetModerator(uid int64) error
- func (b *Bot) UnbanUser(username string) error
- func (b *Bot) User(uid int64) (*User, bool)
- func (b *Bot) Users() map[int64]User
- type Config
- type User
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnexpectedPacket = errors.New("chat: Received unexpected packet")
)
Errors
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct { network.EventEmitter network.CAPIConn // Set once before Connect(), read-only after that Config // contains filtered or unexported fields }
Bot implements a basic chat bot using the official classic Battle.net chat API Public methods/fields are thread-safe unless explicitly stated otherwise
func (*Bot) InitDefaultHandlers ¶
func (b *Bot) InitDefaultHandlers()
InitDefaultHandlers adds the default callbacks for relevant packets
func (*Bot) RPC ¶
RPC executes Remote Procedure Call cmd asynchronously, retries on timeout/rate-limit Needs to called in a goroutine while Run() is running asynchronously to process incoming packets
func (*Bot) Run ¶
Run reads packets and emits an event for each received packet Not safe for concurrent invocation
func (*Bot) SendMessage ¶
SendMessage sends a chat message to the channel
func (*Bot) SendWhisper ¶
SendWhisper sends a chat message to one user in the channel
func (*Bot) SetModerator ¶
SetModerator sets the current chat moderator to a member of the current chat