new BanchoClient(options)
Parameters:
Name | Type | Description |
---|---|---|
options |
BanchoClientOptions |
- Source:
Properties:
Name | Type | Description |
---|---|---|
osuApi |
nodesu.Client | Populated with a Nodesu client, if api key is passed to the constructor |
Extends
- EventEmitter
Methods
-
<async> connect()
-
Connects to Bancho, rejects an Error if connection fails
- Source:
Returns:
- Type
- Promise.<null, Error>
-
<async> createLobby(name [, privateLobby])
-
Creates a multiplayer lobby and return its channel.
Parameters:
Name Type Argument Default Description name
string Lobby name
privateLobby
boolean <optional>
false Mark as private
- Source:
Returns:
-
disconnect()
-
Disconnects from Bancho
- Source:
-
getChannel(channelName)
-
Get a BanchoChannel instance for the specified name
Parameters:
Name Type Description channelName
string - Source:
Returns:
-
getConnectState()
-
Returns the current connection state.
- Source:
Returns:
Current connection state. See ConnectStates
- Type
- Symbol
-
getSelf()
-
Get a BanchoUser representing ourself
- Source:
-
getUser(username)
-
Get a BanchoUser instance for the specified username
Parameters:
Name Type Description username
string - Source:
Returns:
- Type
- BanchoUser
-
<async> getUserById(userid)
-
Get a BanchoUser instance for the specified user id
Parameters:
Name Type Description userid
number - Source:
Returns:
- Type
- Promise.<BanchoUser>
-
isConnected()
-
Returns true if the connectState is Connected, otherwise false.
- Source:
Returns:
- Type
- boolean
-
isDisconnected()
-
Returns true if the connectState is Disconnected, otherwise false.
- Source:
Returns:
- Type
- boolean
Events
-
CM
-
Fired when a channel message is received, or sent from us (check for the
self
property).Type: ChannelMessage
- Source:
-
connected
-
Connected to Bancho!
- Source:
-
disconnected
-
Disconnected from Bancho!
Type: Error
- Source:
-
error
-
An error has occured on the socket.
Type: Error
- Source:
-
JOIN
-
Fired when a user has joined a channel
Type: BanchoChannelMember
- Source:
-
nochannel
-
Fired when a no channel error is received from Bancho.
Type: BanchoChannel
-
nouser
-
Fired when a no user error is received from Bancho.
Type: BanchoUser
-
PART
-
Fired when a user has left a channel
Type: BanchoChannelMember
- Source:
-
PM
-
Fired when a PM is received, or sent from us (check for the
self
property).Type: PrivateMessage
- Source:
-
QUIT
-
Fired when a user has disconnected from Bancho (with no other client opened)
Type: BanchoUser
- Source:
-
rejectedMessage
-
Fired when Bancho sends us back a PM that couldn't be sent.
As far as we know, only happens when a PM is rejected because the recipient blocks messages from non-friends.Type: PrivateMessage
- Source:
-
state
-
ConnectState has updated! Emits with an error if any.
Type: Error
- Source: