23 symbols from @neontechspace/fluxerly
Variables#
Permissions#
const Permissions: Readonly<{ … }>Combine bigint values with |, such as Permissions | Permissions.
Test a grant with (bits & Permissions) === Permissions.
Convert bigint to a decimal string before JSON serialization, which cannot serialize bigint directly.
These are raw grants, not effective-permission calculations: Hierarchy, channel overwrites and server rules still apply.
Unknown unsigned 64-bit bits can be passed explicitly. Fluxer may mask or reject grants
Add#Reactions -
Start a new emoji reaction on a message, rather than only join an existing reaction
bigint Administrator#-
Grant all permission bits and bypass channel overwrites
Hierarchy and other server checks still apply
bigint Attach#Files -
Upload files and media with messages
bigint Ban#Members -
Ban accounts from a community and optionally remove their recent messages
bigint Create#Public Threads -
Start a public thread or an announcement thread
bigint Deafen#Members -
Community-deafen other voice participants, preventing them from hearing or speaking
bigint Embed#Links -
Show automatic embedded previews for links in messages
bigint Manage#Guild -
Change community-wide settings, such as its name and icon
bigint Manage#Messages -
Delete other members' messages
Pinning and unpinning use PinMessages separately
bigint Manage#Roles -
bigint Manage#Threads -
Archive, lock, rename and delete threads, see every private thread and act in a locked thread
Guilddescribes when an elevated MFA level makes Fluxer reject its use.mfa Level bigint Mention#Everyone -
Use @everyone and @here, and mention roles even when they are not marked mentionable
bigint Moderate#Members -
Apply member timeouts that temporarily restrict messaging, reactions and voice participation
bigint Move#Members -
bigint Mute#Members -
Community-mute other voice participants, preventing them from speaking to everyone
bigint Priority#Speaker -
Use the priority push-to-talk key binding to make speech stand out over other speakers
bigint Read#Message History -
Read earlier messages in a channel, subject to community history-cutoff rules
bigint Send#Messages In Threads -
Send messages in threads and add other members to them
In a thread, Fluxer uses this permission in place of SendMessages
bigint Send#Tts Messages -
Send text-to-speech messages that enabled recipients can hear read aloud
bigint Use#External Emojis -
Use custom emoji owned by other communities
bigint Use#External Stickers -
Use custom stickers owned by other communities
bigint Use#Vad -
Use voice activity detection to transmit speech without holding a push-to-talk key
bigint View#Audit Log -
Read the community's recorded administrative and moderation activity
bigint
hierarchy#
Compare roles and members by Fluxer's role hierarchy from snapshots already held, returning plain values
Invalid snapshots throw Guild with reason input
const hierarchy: HierarchyHelpersimport { hierarchy } from "@neontechspace/fluxerly"
export async function hierarchyExample(client, guildId, actorUserId, targetUserId) {
const [guild, actor, target, roles] = await Promise.all([
client.guilds.fetch(guildId),
client.members.fetch({ guildId, userId: actorUserId }),
client.members.fetch({ guildId, userId: targetUserId }),
client.roles.fetchAll(guildId),
])
if (guild.isErr())
return guild
if (actor.isErr())
return actor
if (target.isErr())
return target
if (roles.isErr())
return roles
return hierarchy.canManage({ guild: guild.value, actor: actor.value, target: target.value, roles: roles.value })
}
import { hierarchy, type Client } from "@neontechspace/fluxerly"
export async function hierarchyExample(client: Client, guildId: string, actorUserId: string, targetUserId: string) {
const [guild, actor, target, roles] = await Promise.all([
client.guilds.fetch(guildId),
client.members.fetch({ guildId, userId: actorUserId }),
client.members.fetch({ guildId, userId: targetUserId }),
client.roles.fetchAll(guildId),
])
if (guild.isErr()) return guild
if (actor.isErr()) return actor
if (target.isErr()) return target
if (roles.isErr()) return roles
return hierarchy.canManage({ guild: guild.value, actor: actor.value, target: target.value, roles: roles.value })
}
permissionBits #
Build and inspect raw permission flags with bigint values
Use from to combine named permissions, missing to find absent names, and to to produce a decimal string. Each helper returns a plain value and throws Helper for unknown names or bits outside the unsigned 64-bit range. These helpers inspect flags only, not whether Fluxer will allow a particular action
const permissionBits: PermissionBitHelpersInterfaces#
ChannelPermissions #
One entry of the permissions result: A member's raw permission bits in one community channel
The bits come from the same calculation as permissions, with the channel's own overwrites. They do not show whether the member can view the channel or whether an action will succeed
interface ChannelPermissionschannel#-
The listed community channel, a frozen snapshot with its permission overwrites
GuildChannel
GuildRole #
A community role that groups members and supplies permission grants, hierarchy rank and display settings
Every community also has an implicit everyone role whose ID equals the guild ID. This frozen snapshot is not a member's effective permissions and does not update as roles change
interface GuildRole extends RoleReferenceinterface GuildRole
extends RoleReferencecolor#-
RGB integer, zero means no explicit color
number hoistoptional#Position -
Separate member-list ordering, preserving absent versus null
number | null iconoptional#-
Image icon hash, not an image URL
Use
assetsfor its URL. Null means no image icon, and omission means unavailable. A role has at most one of icon and.role Icon unicodeEmoji string | null name#-
Role display name
string permissions#-
Raw grants from Fluxer, including unknown future bits, as an unsigned 64-bit bigint
bigint
Inherited from Role: guild, id
GuildRoleUpdateBulk #
One bulk role update, not individual update events or a complete role list
Unchanged roles may be omitted
interface GuildRoleUpdateBulkOverwritePatch #
Changes for permission: Which permissions to allow, deny or return to inheritance
Every list is optional, and a permission may appear in at most one of them
interface OverwritePatchallowoptional#-
Permissions to allow, which also stops denying them
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[] denyoptional#-
Permissions to deny, which also stops allowing them
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[] inheritoptional#-
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
PermissionBitInspection #
Known permission names and any unnamed bits found by permission
This object and its names array are frozen. They do not decide what a user may do
interface PermissionBitInspectionnames#-
Present known names in Permissions declaration order, not sorted by display label
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[] unknown#Bits -
Present bits without a known name, preserved exactly rather than discarded
bigint
PermissionHelpers #
Calculate permission flags from supplied data or fresh reads
A permission value alone does not determine channel visibility, role hierarchy, timeouts or authorization for an action
interface PermissionHelperscalculate#
Calculate permission flags from supplied guild, member, role and optional channel data
No request or cache read is made, and connection state is irrelevant, including after client shutdown. The bigint result ranges from 0n through 18_446_744_073_709_551_615n and preserves unknown flags. Community owner or base Administrator gets all flags. Otherwise the calculation applies everyone, combined roles, then member overwrites. Only the target channel's stored overwrites are used, not its parent category's. A thread uses the overwrites of the parent supplied with it, then grants SendMessages exactly when SendMessagesInThreads is granted, as Fluxer does. A thread without its parent, or with any other channel as parent, is rejected. Missing or inconsistent input is misuse and throws Guild for permissions with reason input in both APIs. A timed-out member keeps its permission bits, but Fluxer blocks sending messages, editing and publishing the member's own messages, reacting, uploading, typing, changing the member's own nickname, writing in threads and joining voice, so check members as well
calculate(input: PermissionInput): bigintcalculate(
input: PermissionInput
): bigintParameters
input-
PermissionInput
- Returns
bigint
Returns the value synchronously.
Unexpected failures throw Sdk
fetch#
Fetch guild, member, role and optional channel data, then calculate their permission flags
Use fetch for every channel of a community. No gateway connection is needed, and by default every observation is read fresh without consulting a cache. Set prefer to take each observation from an enabled cache when it is there and fetch only what is missing. A cached channel without its overwrite list is fetched, and so are all roles when any needed role is not cached. Cached observations reflect the last applied gateway events, which can differ from Fluxer, and they can come from different moments. Cached entries stay while a shard can resume and are cleared when a new session starts, after which they are fetched. Use the default right before an action where a stale grant matters. With caches disabled, prefer behaves as the default. A thread channel adds a read of its parent channel, and the result follows Fluxer's thread rule as in calculate. Underlying fetches can enter enabled caches, but the calculated result is not cached. The sequential reads are separate observations, so the result does not guarantee a later action will succeed. The default deadline, rest (30,000 ms unless configured), covers the whole helper with shared read retries and awaited cancellation cleanup. Only fetches count toward it, so reads served by a cache need no time. Invalid target, deadline or a prefer that is not a boolean fails with permissions reason input. Resource errors keep their Guild or Channel. A channel from another community fails instead of mixing guild data, and so does a channel other than a thread that Fluxer sends without its permission overwrite list, with permissions reason response, outcome unknown, details and details. Client closure fails with Client. Its outcome is not when the client closes before a read is sent or during a cache lookup, including when every observation is cached, rejected while a read waits out a 429 before its retry, and unknown with details while a read is in flight
fetch(
target: PermissionTarget,
options?: PermissionFetchOptions
): ResultAsync<
bigint,
| ClientClosedError | ChannelOperationError | ConfigurationError
| GuildOperationError | CancelledError
>fetch(
target: PermissionTarget,
options?: PermissionFetchOptions
): ResultAsync<
bigint,
| ClientClosedError
| ChannelOperationError
| ConfigurationError
| GuildOperationError
| CancelledError
>Parameters
target-
PermissionTarget optionsoptional-
PermissionFetchOptions
- Returns
ResultAsync< bigint, | ClientClosedError | ChannelOperationError | ConfigurationError | GuildOperationError | CancelledError >ResultAsync< bigint, | ClientClosedError | ChannelOperationError | ConfigurationError | GuildOperationError | CancelledError >
fetchChannels #
Fetch one member's permission flags in every channel of a community, such as to see what the bot can do in each channel
Pass the bot's own ID as user, which client returns once the bot has connected. It reads the guild, the member, the role list and the channel list once each, always fresh, then calculates each channel locally the same way as calculate and fetch, so the community owner and an Administrator get every flag. That is four reads for the whole community, where fetch with a channel takes up to four per channel. Returns a frozen array of frozen { channel, permissions } entries, in the order Fluxer lists the channels. Fluxer lists only the channels the bot can view, so a channel that only the member can view is missing. Threads and forum posts are not listed, so call fetch with a thread's ID for one. The reads happen at different moments, so the result does not guarantee that a later action will succeed. It ignores timeouts and role hierarchy, and a channel's bits do not prove that the member can view it. The reads can fill enabled caches, but the result itself is not cached. Unlike fetch, it has no prefer, because no cache holds a complete channel list. The default deadline, rest (30,000 ms unless configured), covers the whole call, including read retries and awaited cancellation cleanup. An invalid target or deadline fails with permissions reason input. Errors from the reads keep their Guild or Channel. A listed channel that Fluxer sends without its permission overwrites fails with permissions reason response, outcome unknown, details and details, as in fetch. Client closure fails with Client. Its outcome is not when the client closes before a read is sent, rejected while a read waits out a 429 before its retry, and unknown with details while a read is in flight
fetchChannels(
target: MemberReference,
options?: RequestOptions
): ResultAsync<
readonly ChannelPermissions[],
| ClientClosedError | ChannelOperationError | ConfigurationError
| GuildOperationError | CancelledError
>fetchChannels(
target: MemberReference,
options?: RequestOptions
): ResultAsync<
readonly ChannelPermissions[],
| ClientClosedError
| ChannelOperationError
| ConfigurationError
| GuildOperationError
| CancelledError
>Parameters
target-
MemberReference optionsoptional-
RequestOptions
- Returns
ResultAsync< readonly ChannelPermissions[], | ClientClosedError | ChannelOperationError | ConfigurationError | GuildOperationError | CancelledError >ResultAsync< readonly ChannelPermissions[], | ClientClosedError | ChannelOperationError | ConfigurationError | GuildOperationError | CancelledError >
import { permissionBits } from "@neontechspace/fluxerly"
export async function sendableChannels(client, guildId) {
const botId = client.users.getSelf()?.id
if (botId === undefined)
return []
const result = await client.permissions.fetchChannels({ guildId, userId: botId })
if (result.isErr())
throw result.error
return result.value
.filter(({ permissions }) => permissionBits.hasAll(permissions, ["ViewChannel", "SendMessages"]))
.map(({ channel }) => channel.id)
}
import { permissionBits, type Client } from "@neontechspace/fluxerly"
export async function sendableChannels(client: Client, guildId: string) {
const botId = client.users.getSelf()?.id
if (botId === undefined) return []
const result = await client.permissions.fetchChannels({ guildId, userId: botId })
if (result.isErr()) throw result.error
return result.value
.filter(({ permissions }) => permissionBits.hasAll(permissions, ["ViewChannel", "SendMessages"]))
.map(({ channel }) => channel.id)
}
PermissionInput #
Calculate a member's community or channel permission bits from supplied guild, member, role and channel data
interface PermissionInputThe roles list must include the implicit everyone role whose ID equals guild and every role in member.
Supply channel with permission to include that channel's explicit permission overrides.
Omit channel to calculate community-level bits.
For a thread, supply the thread as channel and its parent channel, with its overwrites, as parent
The calculation first combines everyone and assigned-role grants. It then applies channel overrides for everyone, the member's roles together, and finally the member. Allows win over denies within each stage. Owners and members with Administrator receive all 64 bits, including unknown bits. A thread has no overwrites of its own, so Fluxer calculates in its parent channel and then grants SendMessages exactly when SendMessagesInThreads is granted there. The calculation does the same
Duplicate, incomplete or cross-community resources fail with Guild reason input
The calculated bits do not prove that Fluxer will allow an action. The calculation does not check visibility, timeouts, role hierarchy, multi-factor authentication (MFA) or age gates. In a thread it also does not check whether the member can see a private thread, which Fluxer allows only to its members and to members who can manage threads, or whether the thread is archived or locked. The result can become stale immediately after the input was observed
export function permissionsExample(client, input, target) {
return {
local: client.permissions.calculate(input),
remote: client.permissions.fetch(target),
}
}
import type { Client, PermissionInput, PermissionTarget } from "@neontechspace/fluxerly"
export function permissionsExample(client: Client, input: PermissionInput, target: PermissionTarget) {
return {
local: client.permissions.calculate(input),
remote: client.permissions.fetch(target),
}
}
channeloptional#-
Target channel's explicit overwrites, or a thread whose permissions come from
parentChannel Omit for a community-level calculation
GuildChannel member#-
Membership whose raw permissions are calculated
GuildMember parentoptional#Channel -
Parent channel of a thread supplied as
channel, with its permission overwritesRequired when
channelis a thread, and rejected otherwise. It must be in the same community and have the ID that the thread'sparentnamesId GuildChannel
PermissionOverwrite #
Give or deny channel permissions to one role or member
A permission absent from both allow and deny remains subject to other applicable roles and overwrites. Build these bitfields with Permissions constants and bigint bitwise operators. This is one explicit overwrite, not the member's final permissions. SDK writes accept values through 9_223_372_036_854_775_807n and send ViewChannelMembers replacements to Fluxer. Received values can use the full unsigned 64-bit range
interface PermissionOverwriteallow#-
Permissions explicitly granted here
Writes accept 0n through 9_223_372_036_854_775_807n, and responses can use unsigned 64-bit values. 0n grants nothing explicitly
bigint deny#-
Permissions explicitly denied here
Writes accept 0n through 9_223_372_036_854_775_807n, and responses can use unsigned 64-bit values. 0n denies nothing explicitly
bigint type#-
Whether id identifies a role or a community member
"role" | "member"
PermissionTarget #
Choose whose permission bits permissions should calculate, by default from fresh REST reads
interface PermissionTarget extends MemberReferenceinterface PermissionTarget
extends MemberReferenceSupply channel to include a separate target-channel read, or omit it for community-level bits.
The client reads guild, member, roles and optional channel in that order under one total deadline, without consulting
caches unless prefer is set.
When the channel is a thread, the client also reads its parent channel under the same deadline and calculates as
Fluxer does for the thread.
Resources can change between reads. The result is not one simultaneous snapshot and does not guarantee that Fluxer will allow an action
Inherited from Member: guild, user
RoleCreate #
Create a named community role with an optional color and permission grants
New roles have no grants by default in this SDK. Use roles afterward for hoist and mentionable settings. Role creation does not assign the role to a member, and Fluxer chooses its initial hierarchy position
interface RoleCreatecoloroptional#-
RGB integer 0–16,777,215, default 0
number iconoptional#-
Image data URI for the role's icon, or null for none
Fluxer accepts a still image of at most 256 KiB and from 32 through 1024 pixels on each side. It cannot be combined with an emoji or
iconSource Role Id string | null iconoptional#Source Role Id -
ID of a role in this community whose icon the new role copies
An image is stored again, so the copy outlives the source
string name#-
Role name, 1–100 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming
The original string is sent unchanged
string permissionsoptional#-
Bigint from 0n through 9_223_372_036_854_775_807n, default 0n: Unlike raw Fluxer, never inherit everyone's grants implicitly
Explicit ViewChannelMembers replacements are advertised to Fluxer by the SDK
bigint
RoleEdit #
Change the name, grants or display settings of an existing role
Omitted fields stay unchanged and at least one defined field is required. The permissions field replaces grants instead of adding to them. The implicit everyone role accepts only color and permissions. Use roles for hierarchy rank
interface RoleEditcoloroptional#-
RGB integer 0–16,777,215
number hoistoptional#Position -
Signed 32-bit member-list position
Null clears it
number | null iconoptional#-
Image data URI for the role's icon, under the same limits as
Role, or null to remove the imageCreate .icon Setting an image replaces an emoji icon, and both together fail
string | null nameoptional#-
Role name, 1–100 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming
The original string is sent unchanged
string permissionsoptional#-
Replace raw grants with a bigint from 0n through 9_223_372_036_854_775_807n, not an incremental grant
Explicit ViewChannelMembers replacements are advertised to Fluxer by the SDK
bigint
RoleHierarchyInput #
Check whether one community member outranks another using guild, member and role snapshots already held by the caller
Supply the actor who would perform the action and the target they would act on. The hierarchy function checks rank only, without fetching resources or authorizing moderation
interface RoleHierarchyInputactor#-
Member whose hierarchy rank is being evaluated
GuildMember target#-
Member the actor would need to outrank
GuildMember
RoleHoistPosition #
One display-order assignment, independent of permission hierarchy and the role's hoist flag
interface RoleHoistPositionhoist#Position -
Signed 32-bit display ordering value, not the permission-hierarchy position
number
RoleManagementInput #
Check whether a community member's rank allows managing one role using guild, member and role snapshots already held by the caller
Supply the actor who would manage the role and the role they would act on. The hierarchy function checks rank only, without fetching resources or authorizing role changes
interface RoleManagementInputactor#-
Member whose hierarchy rank is being evaluated
GuildMember
RolePosition #
One requested hierarchy position, not an absolute final-position guarantee
interface RolePositionposition#-
Nonnegative safe integer ordering value
Fluxer normalizes positions and applies manageable-role constraints
number
RoleReference #
Address one role inside its owning community for role reads and changes, without fetching it or retaining a client
interface RoleReferenceRoles#
Create, edit, order and delete community roles, or read their current or cached data
Shared Guilds request limits, deadlines and read retries apply. Fluxer enforces permissions and hierarchy. No local permission prediction is performed
interface RolesWrites retry only confirmed HTTP 429 rejection.
Abort waits for request cleanup but cannot undo a dispatched write
Expected failures return Guild or Client.
Unexpected failures reject with Sdk.
Inputs are copied when called.
Results are snapshots, not gateway acknowledgement.
Role permissions use bigint, which requires explicit conversion before JSON serialization.
Every remote role mutation accepts Audited. The fetch method rejects audit
create#
Create a role with a name, optional color and permission flags
The permissions input defaults to 0n, rather than copying the everyone role's grants. Supplied permissions must be from 0n through 9_223_372_036_854_775_807n. Explicit permissions use Fluxer's feature opt-in for ViewChannelMembers. The result reports the actual server grants, which can differ from the request. Use a separate edit to change hoist or mentionable settings. The application manages the created role afterward. After an unknown outcome, use fetch before deciding whether to create again
create(
guildId: string,
input: RoleCreate,
options?: AuditedRequestOptions
): ResultAsync<
GuildRole,
ConfigurationError | GuildOperationFailure | CancelledError
>create(
guildId: string,
input: RoleCreate,
options?: AuditedRequestOptions
): ResultAsync<
GuildRole,
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
guildId -
string input-
RoleCreate optionsoptional-
AuditedRequestOptions
- Returns
ResultAsync< GuildRole, ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< GuildRole, | ConfigurationError | GuildOperationFailure | CancelledError >
import { Permissions } from "@neontechspace/fluxerly"
export async function createRoleExample(client, guildId) {
const result = await client.roles.create(guildId, {
name: "Readers",
permissions: Permissions.ViewChannel | Permissions.ReadMessageHistory,
})
if (result.isErr())
throw result.error
return result.value
}
import { Permissions, type Client } from "@neontechspace/fluxerly"
export async function createRoleExample(client: Client, guildId: string) {
const result = await client.roles.create(guildId, {
name: "Readers",
permissions: Permissions.ViewChannel | Permissions.ReadMessageHistory,
})
if (result.isErr()) throw result.error
return result.value
}
delete#
Delete a role and remove its member assignments in Fluxer
The everyone role cannot be deleted. Fluxer removes the role from each member in separate writes before it deletes the role, and does not roll them back. A failure can leave the role in place after some members already lost it, so fetch the role and the affected members again before retrying. HTTP 204 succeeds with no value, without proving member-event delivery. Snapshots already returned to the caller remain unchanged
delete(
role: RoleReference,
options?: AuditedRequestOptions
): ResultAsync<
void,
ConfigurationError | GuildOperationFailure | CancelledError
>delete(
role: RoleReference,
options?: AuditedRequestOptions
): ResultAsync<
void,
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
role-
RoleReference optionsoptional-
AuditedRequestOptions
- Returns
ResultAsync< void, ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< void, | ConfigurationError | GuildOperationFailure | CancelledError >
edit#
Change only supplied role fields and return the server's snapshot
Empty inputs and unknown fields fail locally. The permissions input replaces all raw grants rather than adding flags, and can set or clear ViewChannelMembers. The replacement must be from 0n through 9_223_372_036_854_775_807n, and larger received masks cannot be written unchanged. The everyone role accepts only color and permissions. Other supplied fields fail, even in a mixed input
edit(
role: RoleReference,
input: RoleEdit,
options?: AuditedRequestOptions
): ResultAsync<
GuildRole,
ConfigurationError | GuildOperationFailure | CancelledError
>edit(
role: RoleReference,
input: RoleEdit,
options?: AuditedRequestOptions
): ResultAsync<
GuildRole,
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
role-
RoleReference input-
RoleEdit optionsoptional-
AuditedRequestOptions
- Returns
ResultAsync< GuildRole, ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< GuildRole, | ConfigurationError | GuildOperationFailure | CancelledError >
fetchAll #
Fetch the community's current role list, including everyone, in server order
This always reads remotely, without pagination or background refresh
fetchAll(guildId: string, options?: RequestOptions): ResultAsync<
readonly GuildRole[],
ConfigurationError | GuildOperationFailure | CancelledError
>fetchAll(
guildId: string,
options?: RequestOptions
): ResultAsync<
readonly GuildRole[],
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
guildId -
string optionsoptional-
RequestOptions
- Returns
ResultAsync< readonly GuildRole[], ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< readonly GuildRole[], | ConfigurationError | GuildOperationFailure | CancelledError >
get#
Look up a role by decimal guild and id in the enabled cache, including the everyone role
No request is made. The cache misses, stale-snapshot warnings, misuse and recency rules of guilds apply
get(role: RoleReference): GuildRole | undefinedget(
role: RoleReference
): GuildRole | undefinedParameters
role-
RoleReference
- Returns
GuildRole | undefined
Returns the value synchronously.
Unexpected failures throw Sdk
getAll #
Look up every role of a community by decimal guild in the enabled cache, including the everyone role
No request is made. The frozen list is ordered as roles orders it, highest in the hierarchy first: Larger positions first, and the smaller numeric ID first between equal positions. The result is undefined unless the cache holds the complete list. A guild event makes the list complete, as does a full role read, such as roles, that finishes while the community's shard is connected, when no role event, role write or lost connection overlapped it. Only role events keep the list current, so a read while that shard is not connected, such as before connect, leaves it unknown. Later role create and update events keep it complete. Removing any of the community's roles makes it unknown again, whether by a role deletion event, expiry, capacity eviction, cache or cache, as does a role the cache does not keep because of its limits or max. So does every role write by the bot that succeeds or has an unknown outcome, including create, edit and reorder. A shard's new session, including its first, makes it unknown until the next guild, while a resumed session keeps it. The roles limit, 1,000 entries unless configured, counts roles of every community together, so a bot in many communities needs a larger limit to keep complete lists. An invalid ID is misuse: The default API throws Guild with reason input and the native API dies with it. A closing or closed client has no cache, so the result is undefined
getAll(guildId: string): readonly GuildRole[] | undefinedgetAll(
guildId: string
): readonly GuildRole[] | undefinedParameters
guildId -
string
- Returns
readonly GuildRole[] | undefined
Returns the value synchronously.
Unexpected failures throw Sdk
export async function roleNamesExample(client, guildId) {
const cached = client.roles.getAll(guildId)
if (cached)
return cached.map((role) => role.name)
const fetched = await client.roles.fetchAll(guildId)
if (fetched.isErr())
throw fetched.error
return fetched.value.map((role) => role.name)
}
import type { Client } from "@neontechspace/fluxerly"
export async function roleNamesExample(client: Client, guildId: string) {
const cached = client.roles.getAll(guildId)
if (cached) return cached.map((role) => role.name)
const fetched = await client.roles.fetchAll(guildId)
if (fetched.isErr()) throw fetched.error
return fetched.value.map((role) => role.name)
}
reorder#
Change role hierarchy positions using distinct role IDs and nonnegative safe-integer positions
The everyone role cannot move. HTTP 204 succeeds with no value and no new role list. Fluxer normalizes manageable positions, so use fetch if final order matters. This is not a transaction. A failure can leave partial changes, requiring a fresh read before recovery
reorder(
guildId: string,
positions: readonly RolePosition[],
options?: AuditedRequestOptions
): ResultAsync<
void,
ConfigurationError | GuildOperationFailure | CancelledError
>reorder(
guildId: string,
positions:
readonly RolePosition[],
options?: AuditedRequestOptions
): ResultAsync<
void,
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
guildId -
string positions-
readonly RolePosition[] optionsoptional-
AuditedRequestOptions
- Returns
ResultAsync< void, ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< void, | ConfigurationError | GuildOperationFailure | CancelledError >
resetHoistPositions #
Clear display-position assignments across the community, including roles above the bot
Fluxer requires ManageRoles. Permission hierarchy and hoist flags remain unchanged. HTTP 204 succeeds with no value, not a role list. Changes are not transactional and a failure can be partial. Successful writes and writes with unknown outcomes invalidate cached guild roles. Refetch to resolve an unknown outcome
resetHoistPositions(
guildId: string,
options?: AuditedRequestOptions
): ResultAsync<
void,
ConfigurationError | GuildOperationFailure | CancelledError
>resetHoistPositions(
guildId: string,
options?: AuditedRequestOptions
): ResultAsync<
void,
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
guildId -
string optionsoptional-
AuditedRequestOptions
- Returns
ResultAsync< void, ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< void, | ConfigurationError | GuildOperationFailure | CancelledError >
setHoistPositions #
Set roles' display positions without changing their permission hierarchy or enabling hoist
Pass a nonempty list of distinct role IDs with integer hoist values from -2,147,483,648 through 2,147,483,647. The everyone role is excluded. Fluxer checks ManageRoles and hierarchy. HTTP 204 succeeds with no value, not a role list. Successful writes and writes with unknown outcomes invalidate cached guild roles and conflicting pending reads. Failure or cancellation can leave partial changes. Refetch before deciding to replay
setHoistPositions(
guildId: string,
positions: readonly RoleHoistPosition[],
options?: AuditedRequestOptions
): ResultAsync<
void,
ConfigurationError | GuildOperationFailure | CancelledError
>setHoistPositions(
guildId: string,
positions:
readonly RoleHoistPosition[],
options?: AuditedRequestOptions
): ResultAsync<
void,
| ConfigurationError
| GuildOperationFailure
| CancelledError
>Parameters
guildId -
string positions-
readonly RoleHoistPosition[] optionsoptional-
AuditedRequestOptions
- Returns
ResultAsync< void, ConfigurationError | GuildOperationFailure | CancelledError >ResultAsync< void, | ConfigurationError | GuildOperationFailure | CancelledError >
import {} from "@neontechspace/fluxerly"
export function orderRoleDisplay(client, guildId, roleId) {
return client.roles.setHoistPositions(guildId, [{ id: roleId, hoistPosition: 0 }])
}
import { type Client } from "@neontechspace/fluxerly"
export function orderRoleDisplay(client: Client, guildId: string, roleId: string) {
return client.roles.setHoistPositions(guildId, [{ id: roleId, hoistPosition: 0 }])
}
Type Aliases#
HierarchyHelpers #
Compare roles and members by Fluxer's role hierarchy using snapshots the caller already holds
Each method returns a plain value without fetching, retaining input or authorizing an action
type HierarchyHelpers = Readonly<{ … }>type HierarchyHelpers =
Readonly<{ … }>canManage #
Check the rank requirement for one member to manage another from supplied snapshots
The community owner and a member targeting itself pass. A non-owner cannot manage the owner. For other targets, the actor's highest explicit role must outrank the target's highest explicit role. An actor with no explicit roles fails. An actor with an explicit role outranks a target with none. The roles list must include one same-community observation for every actor and target role ID. The output of roles may include the implicit everyone role, which is ignored for rank comparison. Members must not list everyone as an explicit role. Malformed, incomplete, duplicate, cross-community or inconsistent snapshots throw Guild hierarchy/input without retaining the input. A true result confirms only the rank requirement and does not authorize an action. It does not check permissions, multi-factor authentication (MFA), endpoint-specific requirements, current provider membership or concurrent remote changes. To fetch fresh data and check in one call, use members
canManage(input: RoleHierarchyInput): booleancanManage(
input: RoleHierarchyInput
): booleanParameters
input-
RoleHierarchyInput
- Returns
boolean
canManageRole #
Check the rank requirement for one member to manage one role, such as to assign or edit it, from supplied snapshots
The community owner passes. Any other actor passes only when the actor's highest explicit role outranks the role, with equal positions ordered by numeric ID and the smaller ID higher. An actor with no explicit roles fails, and so does an actor whose highest role is the role itself. Administrator does not bypass rank in Fluxer. The roles list must include one same-community observation for every actor role ID, and the role need not be in it. Members must not list everyone as an explicit role. Malformed, incomplete, duplicate or cross-community snapshots throw Guild hierarchy/input without retaining the input. A true result confirms only the rank requirement and does not authorize an action. Fluxer also requires the ManageRoles permission, which permission checks. Neither check covers multi-factor authentication (MFA), endpoint-specific requirements or concurrent remote changes
canManageRole(input: RoleManagementInput): booleancanManageRole(
input: RoleManagementInput
): booleanParameters
input-
RoleManagementInput
- Returns
boolean
compare#
Find which of two roles ranks higher, for example when presenting or checking role order locally
Returns 1 when left is higher, -1 when right is higher, and 0 for the same role. A larger position is higher. Tied positions use the smaller numeric role ID as higher. Malformed or cross-community snapshots throw Guild hierarchy/input without retaining the input. This reports only which role ranks higher in the supplied data. It does not evaluate permissions, multi-factor authentication (MFA), membership visibility or whether a provider endpoint accepts an action
compare(left: GuildRole, right: GuildRole): -1 | 0 | 1compare(
left: GuildRole,
right: GuildRole
): -1 | 0 | 1Parameters
- Returns
-1 | 0 | 1
highestRole #
Find the role that gives a member the highest rank, from supplied snapshots
The implicit everyone role is ignored, so a member with no explicit roles gives undefined. Equal positions are ordered by numeric ID, with the smaller ID higher. The roles list must include one same-community observation for every role ID of the member and may include the everyone role, as the output of roles does. The member must not list everyone as an explicit role. Malformed, incomplete, duplicate or cross-community snapshots throw Guild hierarchy/input without retaining the input. This reports rank only, not the member's permissions
highestRole(
member: GuildMember,
roles: readonly GuildRole[]
): GuildRole | undefinedhighestRole(
member: GuildMember,
roles: readonly GuildRole[]
): GuildRole | undefinedParameters
member-
GuildMember roles-
readonly GuildRole[]
- Returns
GuildRole | undefined
isAbove #
Check whether a supplied role outranks another role, without fetching either one
Equal positions are ordered by numeric ID, with the smaller ID higher. Comparing a role with itself returns false. Malformed or cross-community snapshots throw Guild hierarchy/input without retaining the input. This compares the supplied roles only. It does not check permissions or whether Fluxer will allow an action
isAbove(left: GuildRole, right: GuildRole): booleanisAbove(
left: GuildRole,
right: GuildRole
): booleanParameters
- Returns
boolean
PermissionBitHelpers #
Methods of the permission helper, which builds and inspects raw bigint permission flags
Each method returns a plain value and throws Helper for invalid input
type PermissionBitHelpers = Readonly<{ … }>type PermissionBitHelpers =
Readonly<{ … }>from#
Combine names such as ["Manage into one bigint permission set for role or overwrite inputs
An empty array gives 0n, and duplicates have no extra effect. Administrator remains one flag rather than expanding to all permissions. Throws Helper for an unknown name
from(
names: readonly (
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers")[]
): bigintfrom(
names: readonly (
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers")[]
): bigintParameters
names-
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
- Returns
bigint
has#
Return whether bits contains one named permission
Throws Helper for bits outside the unsigned 64-bit bigint range or an unknown permission name. This does not calculate inherited permissions or authorize an action
has(
bits: bigint,
permission:
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers"
): booleanhas(
bits: bigint,
permission:
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers"
): booleanParameters
bits-
bigint permission-
| "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers"| "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers"
- Returns
boolean
hasAll #
Return true if bits contains every requested permission, including true for an empty names array
Every name is validated even if a permission is missing, and unknown bits are unchanged. Throws Helper for invalid bits or unknown names
hasAll(
bits: bigint,
names: readonly (
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers")[]
): booleanhasAll(
bits: bigint,
names: readonly (
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers")[]
): booleanParameters
bits-
bigint names-
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
- Returns
boolean
hasAny #
Return true if bits contains at least one requested permission, or false for an empty names array
Every name is validated even after finding a match. Throws Helper for invalid bits or unknown names
hasAny(
bits: bigint,
names: readonly (
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers")[]
): booleanhasAny(
bits: bigint,
names: readonly (
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers")[]
): booleanParameters
bits-
bigint names-
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
- Returns
boolean
inspect#
Return a frozen object listing present known names and any remaining flags as unknown
Names follow Permissions declaration order. Unknown flags are preserved, and Administrator does not add other names. Throws Helper for bits outside the unsigned 64-bit range
inspect(bits: bigint): PermissionBitInspectioninspect(
bits: bigint
): PermissionBitInspectionParameters
bits-
bigint
- Returns
PermissionBitInspection
label#
Return the English label that Fluxer's own app shows for a permission, such as "Manage community" for ManageGuild and "Time out members" for ModerateMembers
Use it to show a permission to people, because the identifier is not a readable name. The labels are fixed English text and are not translated. They are Fluxer's community-scope titles. Inside a channel's permission screen, Fluxer titles ManageChannels "Manage channel" and ManageRoles "Manage permissions", and every other title is the same there. Throws Helper for an unknown permission name
label(
name:
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers"
): stringlabel(
name:
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers"
): stringParameters
name-
| "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers"| "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers"
- Returns
string
missing#
List requested permissions absent from bits, in the order first requested and without duplicates
Returns a frozen array, empty if nothing is missing, and input arrays are not changed. Throws Helper for invalid bits or unknown names
missing(
bits: bigint,
names: readonly (
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker"
| "Stream" | "ViewChannel" | "SendMessages"
| "SendTtsMessages" | "ManageMessages" | "EmbedLinks"
| "AttachFiles" | "ReadMessageHistory" | "MentionEveryone"
| "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers" | "UseVad"
| "ChangeNickname" | "ManageNicknames" | "ManageRoles"
| "ManageWebhooks" | "ManageExpressions" | "ManageThreads"
| "CreatePublicThreads" | "CreatePrivateThreads"
| "UseExternalStickers" | "SendMessagesInThreads"
| "ModerateMembers" | "CreateExpressions" | "PinMessages"
| "BypassSlowmode" | "UpdateRtcRegion"
| "ViewChannelMembers")[]
): readonly (
| "CreateInstantInvite" | "KickMembers" | "BanMembers"
| "Administrator" | "ManageChannels" | "ManageGuild"
| "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream"
| "ViewChannel" | "SendMessages" | "SendTtsMessages"
| "ManageMessages" | "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis"
| "Connect" | "Speak" | "MuteMembers" | "DeafenMembers"
| "MoveMembers" | "UseVad" | "ChangeNickname"
| "ManageNicknames" | "ManageRoles" | "ManageWebhooks"
| "ManageExpressions" | "ManageThreads" | "CreatePublicThreads"
| "CreatePrivateThreads" | "UseExternalStickers"
| "SendMessagesInThreads" | "ModerateMembers"
| "CreateExpressions" | "PinMessages" | "BypassSlowmode"
| "UpdateRtcRegion" | "ViewChannelMembers")[]missing(
bits: bigint,
names: readonly (
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild"
| "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel"
| "SendMessages"
| "SendTtsMessages"
| "ManageMessages"
| "EmbedLinks" | "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis"
| "Connect" | "Speak"
| "MuteMembers"
| "DeafenMembers"
| "MoveMembers" | "UseVad"
| "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers")[]
): readonly (
| "CreateInstantInvite"
| "KickMembers" | "BanMembers"
| "Administrator"
| "ManageChannels"
| "ManageGuild" | "AddReactions"
| "ViewAuditLog"
| "PrioritySpeaker" | "Stream"
| "ViewChannel" | "SendMessages"
| "SendTtsMessages"
| "ManageMessages" | "EmbedLinks"
| "AttachFiles"
| "ReadMessageHistory"
| "MentionEveryone"
| "UseExternalEmojis" | "Connect"
| "Speak" | "MuteMembers"
| "DeafenMembers" | "MoveMembers"
| "UseVad" | "ChangeNickname"
| "ManageNicknames"
| "ManageRoles"
| "ManageWebhooks"
| "ManageExpressions"
| "ManageThreads"
| "CreatePublicThreads"
| "CreatePrivateThreads"
| "UseExternalStickers"
| "SendMessagesInThreads"
| "ModerateMembers"
| "CreateExpressions"
| "PinMessages"
| "BypassSlowmode"
| "UpdateRtcRegion"
| "ViewChannelMembers")[]Parameters
bits-
bigint names-
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
- Returns
readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]readonly ( | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageExpressions" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion" | "ViewChannelMembers")[]
patchOverwrite #
Change some permissions of a channel overwrite's allow and deny bits and keep the rest, for channels, which replaces both bit sets
current is the overwrite as read, or undefined when there is none, which counts as nothing allowed or denied. In change, allow sets the permissions in allow and clears them from deny, deny does the reverse, and inherit clears them from both. Every other bit stays as it was, including bits without a known name. Returns a frozen object with the new allow and deny. Throws Helper when a permission is in more than one list, a name is unknown, change has another key or current holds bits outside the unsigned 64-bit range. An overwrite with both allow and deny at 0n has no effect, so remove it with channels. An overwrite read from Fluxer can carry bit 63, which cannot be written back, and Fluxer can still refuse bits that the bot itself lacks
patchOverwrite(
current:
| Pick<PermissionOverwrite, "allow" | "deny">
| undefined,
change: OverwritePatch
): Readonly<Pick<PermissionOverwrite, "allow" | "deny">>patchOverwrite(
current:
| Pick<
PermissionOverwrite,
"allow" | "deny"
>
| undefined,
change: OverwritePatch
): Readonly<
Pick<
PermissionOverwrite,
"allow" | "deny"
>
>Parameters
current-
Pick<PermissionOverwrite, "allow" | "deny"> | undefined| Pick< PermissionOverwrite, "allow" | "deny" > | undefined change-
OverwritePatch
- Returns
Readonly<Pick<PermissionOverwrite, "allow" | "deny">>Readonly< Pick< PermissionOverwrite, "allow" | "deny" > >
import { permissionBits } from "@neontechspace/fluxerly"
export async function muteChannelExample(client, channelId, current) {
const { allow, deny } = permissionBits.patchOverwrite(current, {
deny: ["SendMessages", "AddReactions"],
inherit: ["ViewChannel"],
})
return await client.channels.setPermissionOverwrite(channelId, { id: "20", type: "role", allow, deny })
}
import { permissionBits, type Client, type PermissionOverwrite } from "@neontechspace/fluxerly"
export async function muteChannelExample(
client: Client,
channelId: string,
current: PermissionOverwrite | undefined,
) {
const { allow, deny } = permissionBits.patchOverwrite(current, {
deny: ["SendMessages", "AddReactions"],
inherit: ["ViewChannel"],
})
return await client.channels.setPermissionOverwrite(channelId, { id: "20", type: "role", allow, deny })
}
refusedGrants #
Return the permission bits that Fluxer would refuse when an overwrite changes from current to next, so the change can be checked before the request is sent
Unless the bot has Administrator, Fluxer lets it allow, or stop denying, only permissions it has in the overwrite's channel, and answers missing otherwise. Removing an overwrite stops all of its denies. Pass the overwrite as read as current and the one to write as next, with undefined for no overwrite, so a next of undefined is a removal. Pass the bot's permission bits in that channel as held, such as the result of permissions with a channel or an entry of permissions. Returns 0n when nothing would be refused. That is always the case when held includes Administrator, and when the change only denies bits or stops allowing them. One call covers one overwrite. For channels with a new list, call it for each target ID in either list. For a category move with sync, call it for each target ID in the channel's or the category's overwrites, with the channel's bits. For channels, pass undefined as current and the parent category's bits as held, or the community-wide bits when there is no parent, because Fluxer checks only the allow bits there. Throws Helper when an overwrite or held has the wrong type or bits outside the unsigned 64-bit range
refusedGrants(
current:
| Pick<PermissionOverwrite, "allow" | "deny">
| undefined,
next: Pick<PermissionOverwrite, "allow" | "deny"> | undefined,
held: bigint
): bigintrefusedGrants(
current:
| Pick<
PermissionOverwrite,
"allow" | "deny"
>
| undefined,
next:
| Pick<
PermissionOverwrite,
"allow" | "deny"
>
| undefined,
held: bigint
): bigintParameters
current-
Pick<PermissionOverwrite, "allow" | "deny"> | undefined| Pick< PermissionOverwrite, "allow" | "deny" > | undefined next-
Pick<PermissionOverwrite, "allow" | "deny"> | undefined| Pick< PermissionOverwrite, "allow" | "deny" > | undefined held-
bigint
- Returns
bigint
import { permissionBits } from "@neontechspace/fluxerly"
export async function allowTtsExample(client, guildId, channelId, botId, current) {
const held = await client.permissions.fetch({ guildId, userId: botId, channelId })
if (held.isErr())
return held
const next = permissionBits.patchOverwrite(current, { allow: ["SendTtsMessages"] })
const refused = permissionBits.refusedGrants(current, next, held.value)
if (refused !== 0n)
return permissionBits.inspect(refused).names
return await client.channels.setPermissionOverwrite(channelId, { id: "20", type: "role", ...next })
}
import { permissionBits, type Client, type PermissionOverwrite } from "@neontechspace/fluxerly"
export async function allowTtsExample(
client: Client,
guildId: string,
channelId: string,
botId: string,
current: PermissionOverwrite | undefined,
) {
const held = await client.permissions.fetch({ guildId, userId: botId, channelId })
if (held.isErr()) return held
const next = permissionBits.patchOverwrite(current, { allow: ["SendTtsMessages"] })
const refused = permissionBits.refusedGrants(current, next, held.value)
if (refused !== 0n) return permissionBits.inspect(refused).names
return await client.channels.setPermissionOverwrite(channelId, { id: "20", type: "role", ...next })
}
sameOverwrites #
Return whether two overwrite lists are equal the way Fluxer compares them: The same target IDs, and for each ID the same type, allow and deny
Order and other fields of the entries are ignored. A channel whose overwrites equal its category's is synced with it. When channels, channels or channels changes the category's overwrites, Fluxer copies the change to exactly those children, with no opt-out. Compare each child with the category before the change to learn which channels it will rewrite. Two empty lists are equal, so a category without overwrites also syncs every child without overwrites. Throws Helper for a value that is not an array, an entry with an invalid ID, type or bits, or a list that names the same ID twice. Fluxer rejects duplicate IDs on write, so a list read from Fluxer never has one
sameOverwrites(
first: readonly PermissionOverwrite[],
second: readonly PermissionOverwrite[]
): booleansameOverwrites(
first:
readonly PermissionOverwrite[],
second:
readonly PermissionOverwrite[]
): booleanParameters
first-
readonly PermissionOverwrite[] second-
readonly PermissionOverwrite[]
- Returns
boolean
toDecimal #
Convert unsigned 64-bit bigint permission bits to the decimal string used in Fluxer JSON requests and URLs
Throws Helper for values outside that range
toDecimal(bits: bigint): stringParameters
bits-
bigint
- Returns
string
PermissionName #
A key of Permissions, such as "Manage, accepted by the named permission helpers
type PermissionName = keyof typeof Permissionstype PermissionName =
keyof typeof Permissions