Skip to content

Client

Defined in: packages/core/src/index.ts:317

Main Lunibee Discord client.

new Client(options): Client

Defined in: packages/core/src/index.ts:459

ClientOptions

Client

EventEmitter<ClientEvents>.constructor

readonly application: object

Defined in: packages/core/src/index.ts:327

commands: ApplicationCommandManager


optional applicationEmojis?: ApplicationEmojiManager

Defined in: packages/core/src/index.ts:341

The application’s own emojis; available after READY (application ID known).


readonly channels: ChannelManager

Defined in: packages/core/src/index.ts:324


readonly commands: CommandRegistry

Defined in: packages/core/src/index.ts:337

Slash and prefix commands made with command(): add, deploy and listen.


readonly guilds: GuildManager

Defined in: packages/core/src/index.ts:323


optional monetization?: MonetizationManager

Defined in: packages/core/src/index.ts:339

SKUs, entitlements and subscriptions; available after READY (application ID known).


readonly options: ClientOptions

Defined in: packages/core/src/index.ts:459


optional readyAt?: Date

Defined in: packages/core/src/index.ts:355


readonly rest: REST

Defined in: packages/core/src/index.ts:321


readonly stageInstances: StageInstanceManager

Defined in: packages/core/src/index.ts:326

Stage instances, cached by stage channel ID.


state: ClientState = "idle"

Defined in: packages/core/src/index.ts:356


optional user?: UserData

Defined in: packages/core/src/index.ts:348


readonly users: UserManager

Defined in: packages/core/src/index.ts:322


readonly voice: VoiceManager

Defined in: packages/core/src/index.ts:354

Voice connections, one per guild: await bot.voice.join({ guildId, channelId }) resolves when audio can flow. Fed by this client’s own VOICE_STATE_UPDATE and VOICE_SERVER_UPDATE events.

get api(): Api

Defined in: packages/core/src/index.ts:333

Discord’s REST API as a chained path: bot.api.guilds(id).members(userId).patch({ nick }). Uses this client’s rate limiting and retries; bot.rest and Routes stay available.

Api


get gateway(): Gateway

Defined in: packages/core/src/index.ts:345

Gateway


get ping(): number

Defined in: packages/core/src/index.ts:374

number


get resourceContext(): ResourceContext

Defined in: packages/core/src/index.ts:1458

Structures built by this client (members from interactions…) act through this.

ResourceContext

Lets structures built from an interaction (such as Interaction.member) act through the client. Optional.

InteractionClient.resourceContext


get token(): string | null

Defined in: packages/core/src/index.ts:368

string | null


get uptime(): number | null

Defined in: packages/core/src/index.ts:371

number | null


get ws(): Gateway

Defined in: packages/core/src/index.ts:342

Gateway

channel(id): ChannelHandle

Defined in: packages/core/src/index.ts:1434

Names a channel by id; see Client.guild for the read methods.

string

ChannelHandle


createCollector<E>(event, options?): Collector<string, ClientEvents[E][0]>

Defined in: packages/core/src/index.ts:1392

Collects the first argument of a client event until a limit, timeout, idle timeout, abort or stop(). The collector unsubscribes itself when it ends. Items are keyed by options.key, else their id, else order.

E extends keyof ClientEvents

E

CollectorOptions<ClientEvents[E][0]> & object = {}

Collector<string, ClientEvents[E][0]>


deleteInteractionReply(token, applicationId?): Promise<void>

Defined in: packages/core/src/index.ts:1649

Deletes the original interaction response.

string

Interaction token.

string

The interaction’s application_id.

Promise<void>

Promise fulfilled after deletion.

When REST fails.

InteractionClient.deleteInteractionReply


destroy(): void

Defined in: packages/core/src/index.ts:1591

Destroys the client, permanently closing the Gateway connection.

void


editInteractionReply(token, data, applicationId?): Promise<unknown>

Defined in: packages/core/src/index.ts:1632

Edits the original interaction response.

string

Interaction token.

Record<string, unknown>

Message payload.

string

The interaction’s application_id, which the webhook route needs.

Promise<unknown>

Discord response.

When REST fails.

InteractionClient.editInteractionReply


fetchDefaultSoundboardSounds(): Promise<APISoundboardSound[]>

Defined in: packages/core/src/index.ts:1530

Fetches Discord’s default soundboard sounds.

Promise<APISoundboardSound[]>


fetchGuildPreview(guildId): Promise<Record<string, unknown>>

Defined in: packages/core/src/index.ts:1707

Fetches a guild preview from Discord.

string

Promise<Record<string, unknown>>


fetchGuildTemplate(code): Promise<Record<string, unknown>>

Defined in: packages/core/src/index.ts:1758

Fetches a guild template from Discord.

string

Promise<Record<string, unknown>>


fetchInvite(code, options?): Promise<Record<string, unknown>>

Defined in: packages/core/src/index.ts:1723

Fetches an invite from Discord.

string

string

boolean

Promise<Record<string, unknown>>


fetchPremiumStickerPacks(): Promise<Record<string, unknown>>

Defined in: packages/core/src/index.ts:1751

Fetches premium sticker packs from Discord.

Promise<Record<string, unknown>>


fetchSticker(id): Promise<Record<string, unknown>>

Defined in: packages/core/src/index.ts:1744

Fetches a sticker from Discord.

string

Promise<Record<string, unknown>>


fetchVoiceRegions(): Promise<Record<string, unknown>[]>

Defined in: packages/core/src/index.ts:1716

Fetches the voice regions from Discord.

Promise<Record<string, unknown>[]>


fetchWebhook(id, token?): Promise<Record<string, unknown>>

Defined in: packages/core/src/index.ts:1697

Fetches a webhook from Discord.

string

string

Promise<Record<string, unknown>>


followUpInteraction(token, data, applicationId?): Promise<unknown>

Defined in: packages/core/src/index.ts:1660

Sends a follow-up interaction webhook message.

string

Interaction token.

Record<string, unknown>

Message payload.

string

The interaction’s application_id.

Promise<unknown>

Discord response.

When REST fails.

InteractionClient.followUpInteraction


generateInvite(options?): string

Defined in: packages/core/src/index.ts:1765

Generates an invite link for this client.

string | bigint

string[]

string


guild(id): GuildHandle

Defined in: packages/core/src/index.ts:1430

Names a guild by id. The handle reads it (peek() from the cache, get() from the cache or Discord, fetch() from Discord) and acts on it.

string

GuildHandle


interactionWebhookMessage(method, applicationId, token, messageId, data?): Promise<unknown>

Defined in: packages/core/src/index.ts:1671

Reads, edits or deletes an interaction webhook message (@original or a follow-up ID). Optional; required for Interaction.fetchReply, Interaction.editFollowUp and Interaction.deleteFollowUp.

"GET" | "PATCH" | "DELETE"

string

string

string

Record<string, unknown>

Promise<unknown>

InteractionClient.interactionWebhookMessage


isReady(): boolean

Defined in: packages/core/src/index.ts:378

Whether the client is ready and connected.

boolean


listenerCount<K>(event): number

Defined in: packages/core/src/index.ts:225

Number of listeners for event, as Node’s EventEmitter reports it.

K extends keyof ClientEvents

K

number

EventEmitter.listenerCount


login(token?): Promise<string>

Defined in: packages/core/src/index.ts:1540

Connects to the Gateway. Resolves with the token used; do not log the return value.

string

Promise<string>


member(guildId, userId): MemberHandle

Defined in: packages/core/src/index.ts:1445

Names a guild member by guild id and user id.

string

string

MemberHandle


message(channelId, messageId): MessageHandle

Defined in: packages/core/src/index.ts:1453

Names a message by channel id and message id.

string

string

MessageHandle


off<K>(event, listener): this

Defined in: packages/core/src/index.ts:210

K extends keyof ClientEvents

K

Listener<ClientEvents[K]>

this

EventEmitter.off


on<K>(event, listener): this

Defined in: packages/core/src/index.ts:191

K extends keyof ClientEvents

K

Listener<ClientEvents[K]>

this

EventEmitter.on


once<K>(event, listener): this

Defined in: packages/core/src/index.ts:200

K extends keyof ClientEvents

K

Listener<ClientEvents[K]>

this

EventEmitter.once


permissionsFor(memberId, guildOrChannelId): PermissionSet | null

Defined in: packages/core/src/index.ts:1498

Resolves a member’s permissions from cached state: guild-level for a guild ID, or channel-level (including overwrites) for a cached channel ID. Returns null when the guild or member is not cached.

string

string

PermissionSet | null


person(id): UserHandle

Defined in: packages/core/src/index.ts:1441

Names a user by id; see Client.guild for the read methods. (bot.user is the bot’s own account, hence the different name.)

string

UserHandle


postInteractionResponse(id, token, response): Promise<unknown>

Defined in: packages/core/src/index.ts:1607

Sends the initial interaction callback.

string

Interaction identifier.

string

Interaction token.

InteractionResponse

Callback payload.

Promise<unknown>

Discord response.

When REST fails.

InteractionClient.postInteractionResponse


removeAllListeners<K>(event?): this

Defined in: packages/core/src/index.ts:228

K extends keyof ClientEvents

K

this

EventEmitter.removeAllListeners


removeListener<K>(event, listener): this

Defined in: packages/core/src/index.ts:218

Alias of off, provided for Node.js EventEmitter familiarity.

K extends keyof ClientEvents

K

Listener<ClientEvents[K]>

this

EventEmitter.removeListener


requestGuildMembers(data): boolean

Defined in: packages/core/src/index.ts:442

Requests guild members.

Record<string, unknown>

Guild member request payload.

boolean

Whether it was sent.


role(guildId, roleId): RoleHandle

Defined in: packages/core/src/index.ts:1449

Names a role by guild id and role id.

string

string

RoleHandle


sendVoiceState(guildId, channelId, options?): boolean

Defined in: packages/core/src/index.ts:434

Joins, moves or leaves a voice channel (op 4). Stable public voice API. Returns false (never throws) when disconnected, rate limited, or when the guild belongs to another shard of a sharded setup.

string

Guild snowflake.

string | null

Channel to join or move to; null leaves.

selfMute and selfDeaf.

boolean

boolean

boolean

Whether it was sent.


setActivity(name, options?): boolean

Defined in: packages/core/src/index.ts:394

Sets what the bot is doing: “Playing chess”, “Watching the logs”. Pass null to clear it. For a custom status (type ActivityEnum.Custom) the text shown is state, so it is set to name unless you give one.

string | null

string

"online" | "dnd" | "idle" | "invisible" | "offline"

ActivityEnum

string

boolean

Whether the update was sent (false while the Gateway is not connected).

bot.setActivity("the logs", { type: ActivityEnum.Watching, status: "idle" });

setPresence(data): boolean

Defined in: packages/core/src/index.ts:382

Sets the bot’s presence / status.

GatewayPresence

Presence payload.

boolean

Whether the payload was sent.


setVoiceState(data): boolean

Defined in: packages/core/src/index.ts:424

Sends a voice state update.

Record<string, unknown>

Voice state payload.

boolean

Whether it was sent.