LittleSpace Network Developers
Sign in

API reference

Everything you can import from @littlespace/fluxkit.

#FluxerClient

JavaScript
const bot = new FluxerClient(options);
OptionDefaultWhat it does
instancerequiredThe instance’s address, like 'https://littlespace.chat'
tokenrequiredThe bot token. A leading Bot is removed if you include it.
prefix'!'The command prefix, or an array of them
ignoredEventstyping and presenceFluxer events to skip. Pass [] to get everything.
presenceyour saved statusThe status to show when the bot connects
shardnone[shardId, shardCount] for bots in more than 2,500 communities

#Methods

MethodReturnsWhat it does
login()PromiseConnects. Resolves when the bot is ready, rejects on a bad token.
destroy()Disconnects
command(name, options?, handler)the clientAdds a command. See Commands.
reply(message, content)Promise<message>Replies to a message without pinging the author
permissionsFor(message)BigInt or nullThe author’s permissions in that channel
channel(guildId, channelId)channel or nullA cached channel

#Properties

PropertyWhat it is
userThe bot’s own account, after ready
guildsA Map of the communities the bot is in, kept up to date
restThe REST client, below
commandsThe command list. commands.list() returns every command.
endpointsThe instance’s addresses from discovery
gateway.pingMilliseconds for the last heartbeat round trip

#Events

ready, message, commandError, error, debug, raw (name, data), and every Fluxer event by name, such as GUILD_MEMBER_ADD. See Events.

#rest

MethodWhat it does
sendMessage(channelId, content)Sends a message. content is a string or a message object.
editMessage(channelId, messageId, content)Edits one of the bot’s messages
deleteMessage(channelId, messageId, reason?)Deletes a message
react(channelId, messageId, emoji)Adds a reaction
createDM(userId)Opens a DM channel
me()The bot’s own account
get / post / patch / put / delete(path, ...)Any route from the Fluxer API. Paths work with or without /v1.

Every method takes a last options object with reason (shown in the audit log), query and headers.

Failed calls throw a FluxerAPIError with status, code and the response body.

#Other exports

ExportWhat it does
executeWebhook(url, body)Posts through a webhook. See Webhooks.
PermissionsEvery permission as a BigInt
hasPermission(perms, flag)Whether perms includes flag, counting Administrator
computePermissions(guild, userId, roleIds, channel?)Works out permissions by hand
discover(instance)Reads an instance’s published addresses
Commands, splitArgsThe command parser, if you want to use it on its own
REST, GatewayThe lower-level clients FluxerClient is built from