Skip to content

Blockheads API (ex.api)

Bibliofile edited this page Oct 18, 2019 · 2 revisions

This documentation is for the old bot, for the functions available in the 7.x bot see here: https://blockheads-messagebot.github.io/MessageBot/classes/world.html

Communication with the portal API is handled through the api object, which can be accessed through extension.api.<function>.

All functions here return a promise.

api.worldStarted(refresh = false)

Resolves when the world has been started, rejects world has failed to start within roughly 60 seconds.

api.send(message)

Sends the specified message (string) to the server. Resolves with the response from the server.

api.getWorldName()

Resolves with the name of the world.

api.getOwnerName()

Resolves with the name of the owner of the world.

api.getOnlinePlayers(refresh = false)

Resolves with an array of the current online players from the portal page.

api.getLogs(refresh = false)

Gets the logs of the server and returns an array of the lines.

api.getLists(refresh = false)

Gets the whitelist, blacklist, modlist, and adminlist of the server. Also resolves with a stafflist of the combined admin and mod list. Returns with the format {admin: [], mod: [], staff: [], white: [], black: []}.