- Support creating lobbies with filtered names by queuing lobby creation
Created lobbies are no longer checked against their names for thecreateLobby
call to succeed. This helps in cases where the requested lobby name has filtered words.
As a consequence, lobby creation can no longer be done in parallel. They are now transparently queued. The promise returned bycreateLobby
still resolves when the lobby is created, so this should be fully transparent to the user. - Fix infinite loop when message fails to send
- BanchoChannel: Fix join and leave methods hanging forever if channel is already joined/left
- BanchoChannel: Fix JOIN and PART events being emitted before they're fully processed
- Fix slots types not being nullable
- BanchoLobby: Add timer events
Added the following events for!mp timer
:timerTick
,timerAborted
,timerEnded
Added the following events for!mp start
:startTimerStarted
,startTimerTick
,startTimerAborted
They are emitted with aseconds
parameter where applicable.
- Apply new personal account rate limits
- Add argument types to utility functions
- Add missing exports from typings
-
BanchoLobby: Fix mods listener never unset in
updateSettings
Caused some "memory leak" warning (MaxListenersExceededWarning
) to be fired (without any impact, per nodejs doc).
Rest assured, you'd have to execute a LOT ofupdateSettings
call in the same lobby to notice any increase in resources usage... -
BanchoLobby: Fix
!mp settings
never firing again on user lookup error
Never encountered this, also the id should be in cache from theplayerJoined
event anyway, but there is always a possibility...
- Fix typings compilation on recent TypeScript versions
-
Add ability to set default gamemode for fetching users from API
In order to optimize API calls in your application, you can rely on bancho.js' existing API data.
The newgamemode
parameter in the bancho.js config object allows you to specify which gamemode data to receive when fetching an user to save more API calls in certain applications. -
BanchoLobby: When updating from an FFA to a team-based mode, reset teams
When enabling teams, all players in the lobby are assigned a default team by Bancho. They're assigned predictably based on their slots.
bancho.js now applies the same logic when changing team mode.
- BanchoLobby: Fix beatmap never being refreshed from API
-
BREAKING CHANGES
- BanchoChannel#channelMembers is now a Map instead of a plain object.
- Following rate-limiting refactoring (see highlights below), the
limiterPublic
BanchoClient option is no longer supported.
Realistically this should never have been implemented, as bots are not supposed to ever send messages publicly (understand public channels like #osu, or every channel that are not PMs and multiplayer lobbies). - The mods array is now initialized to
null
inBanchoLobby
's constructor instead of an empty array.
-
BanchoUser instances are now garbage-collected
If you joined public channels like #osu, you will eventually get hundreds of thousands users registered, which inevitably caused some out-of-memory issues.
We fixed them by garbage-collecting these instances when they are no longer referenced anywhere, by usingWeakRef
.
Support was also added usingweak-value-map
as a peer dependency, which looks to be more memory-efficient but it is considered experimental. Probably only useful if you're running Node.js >= 10 < 14.6.0. -
Implement the IRC QUIT command
Bancho doesn't emitPART
when users are disconnecting without leaving channels first. This fixes users that were never marked as having left channels they were part of when disconnecting. -
Rate-limiting has been refactored
We're now using a much simpler implementation based on a FIFO queue with rate-limiting.
Default rate limits for both user and bot accounts have been fine-tuned. -
New
BanchoLobby
features:- New
banPlayer
method (using!mp ban
) - New
setName
method (using!mp name
) - New
gamemode
property (updated when referees use!mp map
with gamemode id, or usingsetMap
of course) - When a player leaves the lobby (
playerLeft
event), the subsequentupdateSettings
call will emitallPlayersReady
if all remaining players are ready. This works around a lack of reporting from Bancho when every player is ready, except the one who has just left, though it is not automatic and you do have to callupdateSettings
yourself.
- New
-
Add support for ACTION events (/me messages) See https://git.cartooncraft.fr/ThePooN/bancho.js/-/commit/e3636e427d4d00ce79b89b31b751d3e733622b75
-
Misc. bug fixes and minor improvements (eg. typings)
See the changelog for dev versions below.
- Fix stats with players who have non-decimal global accuracy
- Switch to an actually FIFO rate-limiting library
The new implementation is actually correct now... - Fine-tune rate limits again for user and bot accounts
- Updated all dependencies, fixing security issues (in dev dependencies)
- BanchoLobby: If playerLeft is emitted, emit allPlayersReady on callback of updateSettings if all players still present are ready
- Typings update (fix
BanchoUser
,BanchoChannel
andBanchoLobby
not extendingEventEmitter
and new rate-limiting options)
- BREAKING CHANGE: Mods are no longer initialized in BanchoLobby ctor. They are now initialized in
updateSettings
. - Fix crash when leaving multiplayer lobbies (thanks @KhooHaoYit!)
- Fix crash when receiving player slots events before updating settings (thanks @kiwec!)
- BanchoClient: Allow creation of private lobbies
- BanchoLobby: Add setName
- BanchoLobby: Add
gamemode
property. Fairly unreliable, as the only way to know it is when a referee sets it via !mp map, but it's better than nothing. - BanchoLobby: Remove identical update checks for beatmaps and mods
- BanchoLobby: Fix broken conditionals in
setSize
andsetSettings
- Miscellaneous doc/typings updates and fixes
- BREAKING CHANGE: The
limiterPublic
BanchoClient option is no longer supported. - DEPRECATED: Rate-limiting BanchoClient options
limiterPrivate
andlimiterTimespan
are now deprecated in favor of newer options. - New BanchoClient option:
rateLimit
can be used to pass aRateLimiter
object from thelimiter
NPM package (or similar implementation). Default is instancied with the right options for regular user accounts. - New BanchoClient option: setting
botAccount
totrue
applies the right options to the defaultRateLimiter
instance for bot accounts. - Add a message queue and proper rate-limiting
- Actualize README to better reflect current context
- Update typings following addition of action messages
- Add ACTION (/me messages) support
- WeakValueMap: Remove debug logging
- Add pure JavaScript WeakValueMap implementation
- Used as a substitude when weak-value-map npm module isn't available.
- Requires Node.js >= 14.6.0, or >= 13.0.0 with --harmony-weak-refs runtime flag.
- Improve message events description
- Development dependencies upgrade
- BanchoLobby#setMap: Fix typing
- Fix crash on connection close, introduced in recent betas.
- BanchoUser: Add joinDate and totalSecondsPlayed (API data)
- BanchoLobby: Add banPlayer method (!mp ban)
- BREAKING CHANGE: BanchoChannel#channelMembers is now a Map.
- Implement the IRC QUIT command.
- This fixes a huge memory leak, especially on high-traffic public channels (more importantly on #osu), as PARTs aren't emitted on user disconnection.
- Combined with
weak-value-map
, this should make bancho.js very low in RAM usage again! - I have measured a debugging bancho.js idle instance on #osu with 26.7k members staying stable at 15~20MB memory heap usage over 5 hours.
- Add
weak-value-map
supportweak-value-map
is a library that allows user and channel caches in bancho.js to be cleaned once they are no longer referenced.- It is an optional peer dependency, with fallback to regular
Map
when unpresent. It is highly recommended however, especially on large instances, as without that, cache is never cleared in any way.
- Upgrade dependencies
- Fix hard crash when encountering users using reserved JS keywords
- Upgrade dependencies
- BanchoLobby: Fix !mp start timeout not working when set to 0
- BanchoLobby: Fix race condition in updateSettings. See issue #35 for more details.
- Docs: Fix various missing async tags
- Update dev dependencies to fix security flaws
- Dependency updates (security audit)
- BanchoLobby: Fix matchFinished not setting playing to false
- README enhancements
- Typings enhancements
- Typings: include rejectedMessage event
- Message: add content getter
- Client: add rejectedMessage event to catch messages blocked by users with non-friends PMs disabled
- README enhancements
- Typings enhancements
- PrivateMessage: add recipient property
- Export BanchoMessage, PrivateMessage, ChannelMessage
- Many fixes on TypeScript typings
- BanchoLobby: Scores sorting
- BanchoLobby: Pass the sorted scores array when a match is finished
- BanchoLobby: Add more examples
- BanchoLobby: Rewrite synchronous queues
- BanchoLobby: Fix playerJoined event not working in TeamVS
- BanchoLobby: Fix changeTeam method not working
- BanchoLobby: Fix race condition with beatmap changing
- Emit PART for every channel on disconnection
- SECURITY: Fix OutgoingBanchoMessage not only keeping 1st line of message. This patches an IRC command insertion security breach.
- Rewrite BanchoMods (there should be no breaking changes, only improvements)
- Add level property to BanchoUser
- Update npm dependencies
- Fix documentation errors
- Library folders restructure (add Enums, Multiplayer and Multiplayer/Enums folder)
- Main class: export BanchoMods, add "is" methods in main class (isBanchoMod, isBanchoUser...)
- Update npm dependencies
- BanchoUser: add where() and stats() methods
- README/Contributing guide overhaul
- BanchoClient: constructor overhaul, now only takes a single object parameter with custom rate limits.
See documentation or config.json.example
- BanchoLobby: do not attempt to set maps or mods if they are comparable and identical
- BanchoClient: add createLobby(name) method
- BanchoClient: add getSelf() method, returning a BanchoUser instance representing the current user
- BanchoMessage: Add self property, set to true if message was sent by the current bancho.js instance
- Multiplayer: Set players' state to NotReady when the beatmap, the mods or the match settings are changed
- BanchoLobby: new event "playerChangedTeam"
- BanchoLobby.startTimer: make the parameter non-optional and add the method to typings
- Multiplayer: Unready everyone when one changes their team, also doesn't unready people when they don't have the map anymore in most cases
- BanchoLobby: add startTimer(timeout)
- Multiplayer: Fix setting player.isReady to false instead of manipulating player.state
- Multiplayer: Append every possibles !mp command with a random string to work around Bancho's anti-spam
- Multiplayer: fix setHost(player)
- Multiplayer: Fix movePlayer(player, slot) not finding player.
- Multiplayer: Fix winConditions/size potentially updating to null when they aren't specified in Bancho's !mp set answer
- BanchoMods: fix shortMods parsing
- Multiplayer regexes: Fix matchSettings regex not recognizing ScoreV2
- Multiplayer: Reset players when they join the lobby
- BanchoLobby: add abortTimer and add timeout parameter to startMatch
- Multiplayer: Fix incorrectly parsed mods
- Multiplayer: Don't fetch beatmap again if it's the same
- BanchoChannel: Fix join/leave functions not returning a promise but an internal callback when a request is already ongoing.
- Multiplayer: fix kickPlayer(player) and invitePlayer(player) kicking/inviting undefined (:
- Update npm packages
- Multiplayer: Fix lobby.setSize() never resolving
- Multiplayer: Fix beatmapFromSettings regex
- Multiplayer: Emit a new event beatmapNotFound if the map isn't on the osu! API
- Add player property to BanchoLobbyPlayerScore
- Multiplayer: Emit all events after setting vars
- Multiplayer: Rename matchSize event to size (and document size property)
- Multiplayer: Fix setting host not working if there was no host when room was joined
- Multiplayer: update vars before emitting event
- Add missing entries to typescript definitions and documentation
- BanchoChannel: return the same Promise if a join/part request is already ongoing
- Complete Multiplayer channels support, including:
- Events
- Commands
- Slots
- Settings
- Add rate limiter for officicially approved chat bots (part of the chat bots usergoup
- sendMessage methods are now promises that will resolve whenever the message is sent (as they can be delayed because of the rate-limiter), and will reject if we're disconnected
- New theme for the docs!
- Can also now retrieve BanchoUser instances by user ids with
BanchoClient.getUserById(userid: number)
.
- Fix connect() callback not being called if initial connection fails but succeeds later
- Fix uncaught exceptions errors if the end user doesn't listen for
errors
, making reconnection fails.
- Fix mesage not considered a PM if case doesn't match
- Channel members support
- Answers to IRC PINGs (was getting disconnected after a few minutes of connection without)
- WHOIS support on Bancho users
- JOIN and PART events now fire with a BanchoChannelMember
- Channels topics support
- Added type definitions (thanks @ekgame!)
- Add config file and CI variables in contributing guide
- Add connect.js and ping.js examples
- Add BanchoUser class
- Add nodesu as a dependency for osu! API requests
- Rename Message to BanchoMessage
- New class: OutgoingBanchoMessage
- New class: BanchoChannel
- BanchoClient.join/leaveChannel functions have been moved to BanchoChannel
- Fancier test logs
- Enhance README with a Getting Started section
- Documentation
- Changelog
- Contribution guide
- Test goals are now independent from test units
- Added leaving channels test goals
- Rename Client to BanchoClient
- Rewrote the original Bancho.js library in classes and split across multiple files
- Tests in GitLab CI
- Initial single-file library with very basic IRC support