logo bannerlogo banner
Page Navigator

These are miscellaneous utilities that can be useful in various ways.

bot.canSee

This function checks if the bot can see another player.

const canSee = bot.canSee(player);
console.log(`Can see player: ${canSee}`); // true or false

bot.quit

This closes the connection to the game, the matchmaker, and runs various cleanup functions.

Cleanup includes deleting nearly all properites on a bot, including bot.account, bot.game, and bot.players.

Once a bot has been quit, it cannot be used again. You must create a new bot to rejoin the game.

bot.quit();

bot.leave

If bot.quit is too much for you, and you want to be able to reuse a bot, you can use bot.leave() instead. This will leave the game, but keep the bot object intact so that you can rejoin games later.

bot.leave();

Extra (Helpful) Bot Properties

  • bot.state.inGame: boolean - is the bot in a game?
  • bot.matchmaker: Matchmaker - a Matchmaker instance tied to the bot
  • bot.api: API - an API instance tied to the bot
  • bot.ping: number - the bot's ping (requires the PING intent)