Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/harmony/src/client/mod.ts>Client

An easy to use Discord API Library for Deno.
Go to Latest
class Client
Re-export
import { Client } from "https://deno.land/x/harmony@v2.8.0/src/client/mod.ts";

Harmony Client. Provides high-level interface over the REST and WebSocket API.

Constructors

new
Client(options?: ClientOptions)

Properties

optional
_id: string
optional
applicationFlags: number
optional
applicationID: string

Cache Adapter

readonly
channels: ChannelsManager

Channels Manager, providing cache interface to Channels

readonly
clientProperties: ClientProperties

Client Properties

collectors: Set<Collector>

Collectors set

compress: boolean

Whether Zlib compression (for Gateway) is enabled or not

readonly
emojis: EmojisManager

Channels Manager, providing cache interface to Channels

fetchGatewayInfo: boolean

Whether to fetch Gateway info or not

fetchUncachedReactions: boolean

Whether to fetch Uncached Message of Reaction or not?

optional
forceNewSession: boolean

Whether to force new session or not

readonly
gateway: Gateway

Get Shard 0's Gateway

readonly
guilds: GuildManager

Guilds Manager, providing cache & API interface to Guilds

optional
intents: GatewayIntents[]

Gateway Intents

interactions: InteractionsClient

Interactions Client

messageCacheLifetime: number

Time till messages to stay cached, in MS.

messageCacheMax: number

Max number of messages to cache per channel. Default 100

presence: ClientPresence

Client's presence. Startup one if set before connecting

reactionCacheLifetime: number

Time till messages to stay cached, in MS.

REST Manager - used to make all requests

optional
shard: number

Shard on which this Client is

shardCount: number | "auto"

Shard Count

shards: ShardManager

Shard Manager of this Client if Sharded

deprecated
slash: InteractionsClient
readonly
stickers: StickersManager

Stickers Manager, providing cache interface to (Guild) Stickers and API interfacing

token: string | undefined

Token of the Bot/User

optional
upSince: Date

Last READY timestamp

readonly
uptime: number

Since when is Client online (ready).

optional
user: User

User which Client logs in to, undefined until logs in

readonly
users: UsersManager

Users Manager, containing all Users cached

readonly
voice: VoiceManager

Voice Connections Manager

Methods

addCollector(collector: Collector): boolean

Add a new Collector

connect(token?: string, intents?: Array<GatewayIntents | keyof GatewayIntents>): Promise<Client>

This function is used for connecting to discord.

createDM(user: User | string): Promise<DMChannel>

Create a DM Channel with a User

createOAuthURL(options: Omit<OAuthURLOptions, "clientID">): string

Creates an OAuth2 URL

debug(tag: string, msg: string): void

Emits debug event

destroy(): Promise<Client>

Destroy the Gateway connection

editUser(data: { username?: string; avatar?: string; }): Promise<Client>

Modify current (Client) User.

emit(event: keyof ClientEvents, ...args: any[]): Promise<void>

Fetch Application of the Client

fetchInvite(id: string): Promise<Invite>

Fetch an Invite

fetchTemplate(code: string): Promise<Template>

Returns a template object for the given code.

Returns an array of voice region objects that can be used when creating servers.

getEstimatedID(): string
reconnect(): Promise<Client>

Attempt to Close current Gateway connection and Resume

removeCollector(collector: Collector): boolean

Remove a Collector

Sets Cache Adapter

Should NOT be set after bot is already logged in or using current cache. Please look into using cache option.

setAvatar(avatar: string): Promise<Client>

Change Avatar of the Client User

setPresence(presence: ClientPresence | ClientActivity | ActivityGame, onlyInShards?: number[]): void

Changes Presence of Client

setUsername(username: string): Promise<Client>

Change Username of the Client User