Import from @neontechspace/fluxerly
Build a Fluxer bot with JavaScript or TypeScript
Import from @neontechspace/ and call its methods directly
This default API also includes webhooks, OAuth and local helpers, without requiring an Effect runtime.
Network and other I/O operations return ResultAsync, which starts when called, not when awaited.
Await it to get a Result: If is is true, read error for the expected failure, otherwise read value.
Call or to get the value and throw the error instead, and return a Result from a handler to report its failure.
Methods returning AsyncIterable start work when a for await loop pulls its first item.
Local work returns plain values: Creating clients and routers, registering handlers, cache lookups and pure helpers.
Misuse of those, such as invalid options or a missing token, throws Configuration or the helper's own error at once.
Unexpected SDK or cleanup failures throw or reject with Sdk.
Use await using or try/finally to release client resources even when work fails
The glossary defines terms such as guild, gateway, shard, frozen snapshot and uncertain write
Coding agents: read node_ before writing code with this package
import { runBot } from "@neontechspace/fluxerly"
// A failed run is logged and sets process.exitCode, and Ctrl+C stops the bot cleanly, so the returned Result needs
// no further handling here
await runBot({
token: process.env.FLUXER_BOT_TOKEN,
commands: { prefix: "!", commands: { ping: { execute: ({ reply }) => reply("Pong!") } } },
})
import { runBot } from "@neontechspace/fluxerly"
// A failed run is logged and sets process.exitCode, and Ctrl+C stops the bot cleanly, so the returned Result needs
// no further handling here
await runBot({
token: process.env.FLUXER_BOT_TOKEN,
commands: { prefix: "!", commands: { ping: { execute: ({ reply }) => reply("Pong!") } } },
})
import { createClient, orThrow } from "@neontechspace/fluxerly"
await using client = createClient({ token: process.env.FLUXER_BOT_TOKEN })
client.on("messageCreate", (message) => message.content === "!ping" ? client.messages.reply(message, "Pong!") : undefined)
// Run connects, recovers and stays pending until the client ends, and await using shuts it down afterwards
orThrow(await client.run())
import { createClient, orThrow } from "@neontechspace/fluxerly"
await using client = createClient({ token: process.env.FLUXER_BOT_TOKEN })
client.on("messageCreate", (message) =>
message.content === "!ping" ? client.messages.reply(message, "Pong!") : undefined,
)
// Run connects, recovers and stays pending until the client ends, and await using shuts it down afterwards
orThrow(await client.run())
import { permissionBits, colors, text } from "@neontechspace/fluxerly"
export function pureHelpersExample(bits, content) {
return {
required: permissionBits.from(["ManageRoles", "ManageMessages"]),
missing: permissionBits.missing(bits, ["ManageRoles", "ManageMessages"]),
inspection: permissionBits.inspect(bits),
color: colors.parse("#ff8800"),
chunks: text.split(content, { maxLength: 2_000 }),
}
}
import { permissionBits, colors, text } from "@neontechspace/fluxerly"
export function pureHelpersExample(bits: bigint, content: string) {
return {
required: permissionBits.from(["ManageRoles", "ManageMessages"]),
missing: permissionBits.missing(bits, ["ManageRoles", "ManageMessages"]),
inspection: permissionBits.inspect(bits),
color: colors.parse("#ff8800"),
chunks: text.split(content, { maxLength: 2_000 }),
}
}
Categories#
- Builders and Formatting
34 symbols
EmbedBuilder MessageBuilder AssetUrl Options CustomEmoji Markup ColorInput Mention - Caching
11 symbols
ResourceCache Settings CacheKind MessageCache Options CacheChange CacheEntries Options CacheObserver Options - Channels
65 symbols
isThread Channel GuildChannel GuildThread Channel ForumTag Input GuildForum Channel GuildMedia Channel - Client and Lifecycle
29 symbols
createClient defineBot runBot ClientConnectionState BotOptions - Commands
63 symbols
CommandArgument Descriptor CommandArgument Schema CommandArgument Optional Value CommandContext Help Options MemoryCooldown Options PrefixCommand Guard - Emoji and Stickers
12 symbols
GuildEmoji GuildSticker ExpressionReference ExpressionMetadata EmojiCreate ExpressionBatch - Errors
94 symbols
describeError orThrow CancelledError ConfigurationError FluxerlyError ClientClosed Error - Events and Collectors
56 symbols
EventMap EventName EventBuffer Options MessageReaction HandlerOptions EventContext - Guilds and Members
77 symbols
GuildMember MemberReference GuildGuildList Summary UserIteration Query DiscoveryApplication - Invites and Webhooks
28 symbols
createWebhook Client InviteMetadata WebhookIncomingWebhook ChannelFollower Webhook Invite - Logging and Diagnostics
21 symbols
LogRecord LoggingOptions FailureReport ClientCounters LogCategory ClientDiagnostics - Messages
91 symbols
MessageMessageCore MessageReference SelectedMessage MessageFields ReactionEmoji Input - OAuth
14 symbols
OAuthTokens OAuthAuthorization Input OAuthCode Exchange Input OAuthConfig OAuthConnection OAuthIdentity - Options
21 symbols
RequestOptions AuditedRequest Options OperationSignal OperationOptions PaginationQuery InstanceOptions - Roles and Permissions
23 symbols
PermissionOverwrite GuildRole RoleReference PermissionTarget ChannelPermissions HierarchyHelpers - Sharding and Supervision
25 symbols
fileSession Store SessionStore ShardState ShardingOptions SupervisorAssignment IdentifyCoordinator - Users and DMs
9 symbols
UserDirectMessage Channel UserProfile Fields DirectMessage Group Edit DirectMessage Latest Messages UserProfile