Class: BanchoLobby

BanchoLobby

Represents a Bancho multiplayer lobby


new BanchoLobby()

Properties:
Name Type Description
channel BanchoMultiplayerChannel
id number

Multiplayer lobby ID (used in multiplayer history links)

name string

Name of the lobby, as seen in-game

slots Array.<BanchoLobbyPlayer>

Array of BanchoLobbyPlayer determining each users' slot, from 0 to 15

size number

Current size of the lobby

beatmapId number
beatmap nodesu.Beatmap

Beatmap fetched from the API (late/not as reliable, use beatmapId when possible)

winCondition number

See BanchoLobbyWinConditions

teamMode number

See BanchoLobbyTeamModes

mods Array.<BanchoMod>
freemod boolean
playing boolean

Whether we're currently playing or not

scores Array.<BanchoLobbyPlayerScore>

Scores set during the currently ongoing match, or the previous match. Emptied when a new match starts. Sorted by pass and score once match is finished.

Source:

Methods


<async> abortMatch()

Abort the match

Source:

<async> abortTimer()

Aborts an ongoing timer

Source:

<async> addRef(ref)

Adds referees to the lobby

Parameters:
Name Type Description
ref Array.<string> | string

A string or array of strings of referee(s) to add, referenced by their usernames or #

Source:

<async> changeTeam(player, team)

Change's one team

Parameters:
Name Type Description
player BanchoLobbyPlayer
team string

See BanchoLobbyTeams

Source:

<async> clearHost()

Get back the host from one's hand

Source:

<async> closeLobby()

Close the lobby

Source:

<async> fetchFromAPI()

Fetch the lobby from the osu! API.

Source:
Returns:

Promise<nodesu.Multi>


getHistoryUrl()

Gets the mp link or however you name it.

Source:
Returns:
Type
string

getHost()

Gets the player who is currently host

Source:
Returns:
Type
BanchoLobbyPlayer

<async> getPlayerById()

Gets or instanciate a player by its userid

Source:

<async> getPlayerByName(name)

Gets or instanciate a player by its username

Parameters:
Name Type Description
name string
Source:

getPlayerSlot(player)

Gets the slot of a player

Parameters:
Name Type Description
player BanchoLobbyPlayer
Source:
Returns:
Type
number

<async> invitePlayer(player)

Invites a player to the lobby

Parameters:
Name Type Description
player string

Referenced by their username or #

Source:

<async> kickPlayer(player)

Kicks a player from the lobby

Parameters:
Name Type Description
player string

Referenced by their username or #

Source:

<async> lockSlots()

Locks the lobby's slots and teams

Source:

<async> movePlayer(player, slot)

Moves a player from one slot to another

Parameters:
Name Type Description
player BanchoLobbyPlayer
slot number

starting from 0

Source:

removeRef(ref)

Removes referees from the lobby

Parameters:
Name Type Description
ref Array.<string> | string

A string or array of strings of referee(s) to remove, referenced by their usernames or #

Source:

<async> setHost(player)

Sets a player as the host of the lobby

Parameters:
Name Type Description
player string

Referenced by their username or #

Source:

<async> setMap(map [, gamemode])

Set a given map in the lobby

Parameters:
Name Type Argument Default Description
map number | nodesu.Beatmap

Either a beatmap ID or a Beatmap object from nodesu

gamemode number <optional>
nodesu.Mode.osu

See nodesu.Mode

Source:

<async> setMods(mods, freemod)

Set given mods in the lobby

Parameters:
Name Type Default Description
mods Array.<BanchoMod> | string

Either an array of BanchoMods or a mods string joined by spaces

freemod boolean false
Source:

<async> setPassword(password)

Sets the lobby's password

Parameters:
Name Type Description
password string
Source:

<async> setSettings(teamMode, winCondition [, size])

Sets the settings of the lobby

Parameters:
Name Type Argument Description
teamMode number

See BanchoLobbyTeamModes

winCondition number

See BanchoLobbyWinConditions

size number <optional>
Source:

<async> setSize(size)

Set the amount of open slots in the lobby

Parameters:
Name Type Description
size number
Source:

sortScores()

Sort scores by pass and score.

Source:

<async> startMatch( [timeout])

Start the match

Parameters:
Name Type Argument Default Description
timeout number <optional>
null

Timeout before the game starts. Defaults to 0

Source:

<async> startTimer(timeout)

Start a timer

Parameters:
Name Type Description
timeout number

Timeout

Source:

<async> unlockSlots()

Unlocks the lobby's slots and teams

Source:

<async> updateSettings()

Fires !mp settings, updates properties and player slots

Source:

Events


allPlayersReady

Source:

beatmap

Fired when the beatmap property is updated from the API

Type: nodesu.Beatmap
Source:

beatmapId

Fired when the beatmapId is updated

Type: number
Source:

beatmapNotFound

Emitted when a selected map is not found on the osu! API.

Type: number
Source:

freemod

Fired when the lobby's freemod property is updated

Type: boolean
Source:

host

Type: BanchoLobbyPlayer
Source:

hostCleared

Source:

invalidBeatmapId

Source:

matchAborted

Source:

matchFinished

Sorted scores array

Type: Array.<BanchoLobbyPlayerScore>
Source:

matchSettings

Type: object
Properties:
Name Type Description
size number
teamMode number

See BanchoLobbyTeamModes

winCondition number

See BanchoLobbyWinConditions

Source:

matchStarted

Source:

mods

Fired when the lobby's mods are updated

Type: Array.<BanchoMod>
Source:

name

Fired when the name of the lobby is updated

Type: string
Source:

passwordChanged

Source:

passwordRemoved

Source:

playerChangedTeam

Type: object
Properties:
Name Type Description
player BanchoLobbyPlayer
team string

See BanchoLobbyTeams

Source:

playerFinished

Type: BanchoLobbyPlayerScore
Source:

playerJoined

Type: object
Properties:
Name Type Description
player BanchoLobbyPlayer
slot number

Starting from 0

team string

Blue or Red

Source:

playerLeft

Type: BanchoLobbyPlayer
Source:

playerMoved

Type: object
Properties:
Name Type Description
player BanchoLobbyPlayer
slot number

Starting from 0

Source:

playing

Fired when the lobby starts or stops playing

Type: Symbol
Source:
See:
  • {BanchoLobbyState}

refereeAdded

Type: string
Source:

refereeRemoved

Type: string
Source:

size

Fired when the size of the lobby is updated

Type: number
Source:

slots

Fired when the slots of the lobby are updated

Type: Array.<BanchoLobbyPlayer>
Source:

slotsLocked

Source:

slotsUnlocked

Source:

teamMode

Fired when the team mode is updated

Type: number
Source:
See:

userNotFound

Source:

userNotFoundUsername

Type: string
Source:

winCondition

Fired when the win condition is updated

Type: number
Source:
See: