On This Page

Users and DMs

9 symbols from @neontechspace/fluxerly

Interfaces#

DirectMessageChannel#

A one-to-one direct message or group conversation outside a community

Pass id to the messages API to address this conversation. The frozen snapshot describes returned settings and recipients, not current access or proof that a later message can be delivered

interface DirectMessageChannel
icon#

Group icon hash, or null

string | null
id#

Decimal channel ID, accepted by the existing messages API

string
lastMessageId#

Last message ID supplied by Fluxer, or null

string | null
name#

Group name, or null when absent

string | null
nicknames#

Supplied nickname overrides, keyed by decimal user ID

Readonly<Record<string, string>>
ownerId#

Group owner ID, or null for a one-to-one DM

string | null
recipients#

Public recipient snapshots supplied by Fluxer, not necessarily including the current bot

readonly User[]
type#

Explicitly distinguishes one-to-one and group conversations

"group" | "dm"

DirectMessageGroupEdit#

Rename a group conversation, change its icon or nicknames, or transfer its ownership

Omitted fields remain unchanged. This does not create a group or add recipients. Fluxer enforces membership and ownership, and an error after dispatch does not prove that earlier changes were rolled back

interface DirectMessageGroupEdit
icon optional#

Image data URI, or null to clear

Fluxer validates the image

string | null
name optional#

Group name, or null to clear it

Raw input may contain at most 10,000 UTF-16 code units. For validation, Fluxer's general-name rules remove U+000C and U+202E, trim surrounding whitespace, strip provider-defined invisible characters, normalize whitespace and collapse its runs, then require 1–100 UTF-16 code units. The SDK sends the original string without lowercasing or hyphenating it

string | null
nicknames optional#

Nicknames keyed by user ID

A nickname must be a nonempty raw string and contain at most 32 UTF-16 code units after U+000C and U+202E removal and surrounding-whitespace trimming. A normalized-empty string is allowed. The original string is sent unchanged, and null clears a nickname. Non-owners may change only their own

Readonly<Record<string, string | null>> | null| Readonly<
    Record<string, string | null>
  >
| null
ownerId optional#

Transfer ownership to an existing non-bot recipient

Requires current ownership

string

DirectMessageLatestMessages#

Latest-message lookup results for the selected private channel IDs

Look in messages for returned IDs and omittedChannelIds for requested IDs missing from the response. A channel returned with null differs from a channel missing from the response. Neither explains why no message was returned

interface DirectMessageLatestMessages<
    M extends MessageCore = Message
>interface DirectMessageLatestMessages<
  M extends MessageCore = Message
>
messages#

Returned entries keyed by requested channel ID

Null is ambiguous and does not prove an empty channel or access denial

Readonly<Record<string, M | null>>
omittedChannelIds#

Requested IDs omitted by Fluxer, in input order

Omission is distinct from a returned null

readonly string[]

DirectMessages#

Open and manage private one-to-one or group conversations with the bot's credentials

Use directMessages.send to open a conversation and send in one call, or the messages namespace when the private channel ID is known. No gateway connection is required. HTTP calls start immediately with the client's shared default deadline (rest.defaultTimeoutMs, 30,000 ms unless configured) and eligible read retries. Writes retry only confirmed rate-limit rejection, never an uncertain outcome. Abort waits for cleanup and returns CancelledError. Unexpected failures reject with SdkDefect

interface DirectMessages<M extends MessageCore = Message>interface DirectMessages<
  M extends MessageCore = Message
>

close#

Close a one-to-one conversation for this bot, or leave a group conversation

Another recipient's conversation is not erased. If the group owner leaves, ownership may transfer. Enabled cache invalidation normally stays scoped to this conversation. A cache-wide conflict check can also prevent older in-flight results from being stored

close(id: string, options?: RequestOptions): ResultAsync<
    void,
    UserOperationFailure | ConfigurationError | CancelledError
>close(
  id: string,
  options?: RequestOptions
): ResultAsync<
  void,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

id
string
options optional
RequestOptions

editGroup#

Change supplied settings of an existing group conversation

A null name clears it, and omitted fields remain unchanged. Fluxer enforces member and owner permissions. A failed response does not guarantee rollback. Enabled cache invalidation normally stays scoped to this conversation. A cache-wide conflict check can also prevent older in-flight results from being stored

editGroup(
    id: string,
    input: DirectMessageGroupEdit,
    options?: RequestOptions
): ResultAsync<
    DirectMessageChannel,
    UserOperationFailure | ConfigurationError | CancelledError
>editGroup(
  id: string,
  input: DirectMessageGroupEdit,
  options?: RequestOptions
): ResultAsync<
  DirectMessageChannel,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

id
string
options optional
RequestOptions

fetch#

Fetch a private channel by decimal ID

A community-channel response is rejected as invalid. With the direct-message cache enabled, a concurrent fetch of another private channel ID does not keep this result from being stored, unless more than 256 private channel IDs are in flight at once

fetch(id: string, options?: RequestOptions): ResultAsync<
    DirectMessageChannel,
    UserOperationFailure | ConfigurationError | CancelledError
>fetch(
  id: string,
  options?: RequestOptions
): ResultAsync<
  DirectMessageChannel,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

id
string
options optional
RequestOptions

fetchAll#

Fetch this bot's currently open one-to-one and group conversations

Personal notes are excluded. The list is neither an atomic snapshot nor complete message history. Enabled cache replacement is skipped when a later targeted request or channel observation conflicts

fetchAll(options?: RequestOptions): ResultAsync<
    readonly DirectMessageChannel[],
    UserOperationFailure | ConfigurationError | CancelledError
>fetchAll(
  options?: RequestOptions
): ResultAsync<
  readonly DirectMessageChannel[],
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

options optional
RequestOptions

fetchLatestMessages#

Fetch the latest messages for 1–100 selected, distinct private channel IDs through Fluxer's batch endpoint

IDs are copied by index when execution starts. This does not enumerate conversations or fill a cache. A null entry does not prove an empty channel or denied access. The omittedChannelIds field separately lists requested IDs that Fluxer did not return. Do not treat omission as null, an empty channel or denied access. The batch uses POST and is not retried after a dispatched failure with an unknown outcome, even though it reads data

fetchLatestMessages(
    channelIds: readonly string[],
    options?: RequestOptions
): ResultAsync<
    DirectMessageLatestMessages<M>,
    UserOperationFailure | ConfigurationError | CancelledError
>fetchLatestMessages(
  channelIds: readonly string[],
  options?: RequestOptions
): ResultAsync<
  DirectMessageLatestMessages<M>,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

channelIds
readonly string[]
options optional
RequestOptions

get#

Look up a private channel in the optional cache using its decimal ID, without a request

A hit may be stale and becomes more recently used without extending its age. A miss produces undefined. An invalid ID is misuse: The default API throws UserOperationError with reason input and the native API dies with it. A closing or closed client has no cache, so the result is undefined

get(id: string): DirectMessageChannel | undefinedget(id: string):
  | DirectMessageChannel
  | undefined

Parameters

id
string
Returns
DirectMessageChannel | undefined

Returns the value synchronously. Unexpected failures throw SdkDefect

open#

Open or reopen a one-to-one conversation with the selected user

The result is a private channel, not proof a message can be delivered. Privacy checks can still prevent sending after opening succeeds. With the direct-message cache enabled, the channel ID is unknown until the response arrives, so some concurrent direct-message cache changes keep the result out of the cache. Examples are a directMessages.fetch call and a direct-message update event. A successful opening replaces only the returned channel's cached snapshot and keeps other cached private channels. A failed opening that was started clears the direct-message cache, because its outcome may be unknown and no channel is known to evict. Invalid input fails before the cache is touched and leaves it intact

open(userId: string, options?: RequestOptions): ResultAsync<
    DirectMessageChannel,
    UserOperationFailure | ConfigurationError | CancelledError
>open(
  userId: string,
  options?: RequestOptions
): ResultAsync<
  DirectMessageChannel,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

userId
string
options optional
RequestOptions

removeRecipient#

Remove a group recipient as owner, or remove the bot itself

This does not request deletion of that user's messages. If the last recipient leaves, Fluxer deletes the group. Enabled cache invalidation normally stays scoped to this conversation. A cache-wide conflict check can also prevent older in-flight results from being stored

removeRecipient(
    id: string,
    userId: string,
    options?: RequestOptions
): ResultAsync<
    void,
    UserOperationFailure | ConfigurationError | CancelledError
>removeRecipient(
  id: string,
  userId: string,
  options?: RequestOptions
): ResultAsync<
  void,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

id
string
userId
string
options optional
RequestOptions

send#

Open or reopen a one-to-one conversation with a user, then send a message

A plain string sends only that text, as shorthand for { content }. The whole operation uses one deadline, and mentions are disabled by default. Message metadata and data bytes are prepared before opening the conversation. File and stream sources are captured, not copied, and read later when uploads start, using messages.send's size, upload-budget and cleanup rules. An inline multipart 429 does not replay file or stream sources. MessageError with outcome notDispatched does not mean opening the conversation was undone. A send with an unknown outcome is never repeated automatically. The opened conversation is cached under the same conditions as open. Reply references are not accepted here. Use messages.reply with an existing channel and message reference

send(
    userId: string,
    input: string | ReplyInput,
    options?: RequestOptions
): ResultAsync<M, ConfigurationError | SendError | CancelledError>send(
  userId: string,
  input: string | ReplyInput,
  options?: RequestOptions
): ResultAsync<
  M,
  | ConfigurationError | SendError
  | CancelledError
>

Parameters

userId
string
input
string | ReplyInput
options optional
RequestOptions
Returns
ResultAsync<M, ConfigurationError | SendError | CancelledError>ResultAsync<
  M,
  | ConfigurationError | SendError
  | CancelledError
>
export async function notifyUserExample(client, userId) {
    const user = await client.users.fetch(userId)
    if (user.isErr())
        return user
    return client.directMessages.send(user.value.id, { content: `Hello ${user.value.displayName ?? user.value.username}` })
}
import type { Client } from "@neontechspace/fluxerly"
export async function notifyUserExample(client: Client, userId: string) {
    const user = await client.users.fetch(userId)
    if (user.isErr()) return user
    return client.directMessages.send(user.value.id, { content: `Hello ${user.value.displayName ?? user.value.username}` })
}

User#

Public identity of a Fluxer account, suitable for displaying who sent a message or belongs to a conversation

This returned data cannot be changed and does not update when the account changes. It excludes private account fields even for users.fetchSelf. Community nicknames and community-specific profile settings are separate from this account-wide identity

interface User
avatar#

Avatar asset hash, not an image URL, or null when no avatar is supplied

string | null
avatarColor#

Dominant avatar color, or null

number | null
discriminator#

Provider discriminator used with username to distinguish accounts with the same username

string
displayName#

Account-wide name shown instead of username where supported, or null when unset

string | null
flags#

Public account flags returned by Fluxer

number
id#

Decimal account ID

string
isBot#

Whether Fluxer identifies this account as a bot

boolean
isSystem#

Whether Fluxer identifies this account as a system user

boolean
username#

Account username, not unique by itself

string

UserProfile#

Result of users.fetchProfile, combining public identity with the profile information Fluxer allowed this caller to see

Account-wide and community-specific settings remain separate. The frozen result excludes relationships, connections, timezone and premium details, and does not populate user or member caches

interface UserProfile
guildProfile#

Explicit community-context profile fields, or null when Fluxer did not supply them

Null does not establish membership

UserProfileFields | null
isLimited#

Whether Fluxer limited this read by profile privacy

Its omitted unrestricted marker becomes false

boolean
profile#

Account-wide profile fields the SDK includes

UserProfileFields
user#

Public account identity returned with this profile, without updating the cache

User

UserProfileFields#

Displayable biography, pronouns and visual customization from a profile read

Null can mean either that the value is unset or that Fluxer hid it for privacy. These fields alone cannot distinguish those cases. Undefined bannerColor means Fluxer did not supply it

interface UserProfileFields
accentColor#

Packed profile accent color, or null

number | null
banner#

Banner hash, or null when absent or withheld by Fluxer

string | null
bannerColor optional#

Account-profile banner color when Fluxer supplies it

Community-specific profiles do not supply this field

number | null
bio#

Biography, null when absent or hidden by profile privacy

string | null
pronouns#

Pronouns, null when absent or hidden by profile privacy

string | null

UserProfileQuery#

Choose whether users.fetchProfile also asks for profile customization in one community

Omit guildId for the account-wide profile. This request does not list mutual communities or relationships and does not fetch a GuildMember

interface UserProfileQuery
guildId optional#

Decimal guild ID whose profile settings to include when Fluxer supplies them

string

Users#

Read public user account and profile data, without connecting the gateway

Use get for an explicitly enabled local account cache, or fetch for a remote read. HTTP calls start immediately with the client's default deadline (rest.defaultTimeoutMs, 30,000 ms unless configured) and bounded eligible read retries. Any writes retry only confirmed rate-limit rejection, not an uncertain outcome. Abort waits for cleanup and returns CancelledError. Unexpected failures reject with SdkDefect

interface Users

fetch#

Fetch a public account snapshot by decimal user ID

An unknown user fails with reason notFound rather than an empty result. With the user cache enabled, a concurrent fetch of another user ID does not keep this result from being stored, unless more than 256 user IDs are being read at once

fetch(id: string, options?: RequestOptions): ResultAsync<
    User,
    UserOperationFailure | ConfigurationError | CancelledError
>fetch(
  id: string,
  options?: RequestOptions
): ResultAsync<
  User,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

id
string
options optional
RequestOptions

fetchProfile#

Fetch a user's privacy-filtered profile, optionally for the community specified in query.guildId

The frozen result includes only documented identity and profile fields. The isLimited field reports Fluxer's privacy restriction, not missing community membership. A guildProfile of null means no contextual profile was supplied, not proof the user is outside the community. No gateway connection, hidden member fetch or account or profile cache use is performed, and each call issues a separate read. Users' shared deadlines and eligible read retries apply. Fluxer may clear expired premium state while serving this GET. Invalid input, denied access or a malformed response fails with UserOperationError for users.fetchProfile. Cancellation affects this request only and waits for cleanup

fetchProfile(
    id: string,
    query?: UserProfileQuery,
    options?: RequestOptions
): ResultAsync<
    UserProfile,
    UserOperationFailure | ConfigurationError | CancelledError
>fetchProfile(
  id: string,
  query?: UserProfileQuery,
  options?: RequestOptions
): ResultAsync<
  UserProfile,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

id
string
query optional
UserProfileQuery
options optional
RequestOptions
export function profileExample(client, userId, guildId) {
    return client.users.fetchProfile(userId, { guildId })
}
import type { Client } from "@neontechspace/fluxerly"
export function profileExample(client: Client, userId: string, guildId: string) {
    return client.users.fetchProfile(userId, { guildId })
}

fetchSelf#

Fetch the authenticated bot's public account data remotely

Private account fields are excluded. With the user cache enabled, the bot's ID is unknown until the response arrives, so some concurrent user cache changes keep the result out of the cache. Examples are another users.fetch or users.fetchSelf call, a user update event and a lost gateway connection

fetchSelf(options?: RequestOptions): ResultAsync<
    User,
    UserOperationFailure | ConfigurationError | CancelledError
>fetchSelf(
  options?: RequestOptions
): ResultAsync<
  User,
  | UserOperationFailure
  | ConfigurationError
  | CancelledError
>

Parameters

options optional
RequestOptions

get#

Look up a public account in the optional cache using its decimal ID, without a request

A hit may be stale and becomes more recently used without extending its age. A miss produces undefined. An invalid ID is misuse: The default API throws UserOperationError with reason input and the native API dies with it. A closing or closed client has no cache, so the result is undefined

get(id: string): User | undefined

Parameters

id
string
Returns
User | undefined

Returns the value synchronously. Unexpected failures throw SdkDefect

getSelf#

Look up the bot's own public account as the gateway's READY reported it, without a request

The result is undefined until this client's first READY, and also while no READY has carried a complete public account. A later READY with a complete public account, such as for a new session, replaces it, while an incomplete one keeps the previous account. Other user updates and fetchSelf results do not change it, so its username or avatar can be stale. The value remains available after the client stops. This lookup never fails. Use fetchSelf for a current remote snapshot

getSelf(): User | undefined
Returns
User | undefined

Returns the value synchronously