Skip to content

Class ClientUser

🏭 Constructors

constructor

ts
new ClientUser(client: Client, props: Record<string, any>): ClientUser

Parameters

  • client: Client
  • props: Record<string, any>

Return Type

  • ClientUser

Inherited from: User.constructor

Defined in: packages/discord-rpc/structures/User.ts:47

🏷️ Properties

avatar

ts
avatar: null | string

the user's avatar hashInherited from: User.avatar

Defined in: packages/discord-rpc/structures/User.ts:21

avatar_decoration optional

ts
avatar_decoration: null | string

Inherited from: User.avatar_decoration

Defined in: packages/discord-rpc/structures/User.ts:45

client

ts
client: Client

the client instance Inherited from: User.client

Defined in: packages/discord-rpc/structures/Base.ts:7

discriminator

ts
discriminator: string

the user's 4-digit discord-tag Inherited from: User.discriminator

Defined in: packages/discord-rpc/structures/User.ts:17

flags optional

ts
flags: UserFlags

the flags on a user's account Inherited from: User.flags

Defined in: packages/discord-rpc/structures/User.ts:25

id

ts
id: string

the user's id Inherited from: User.id

Defined in: packages/discord-rpc/structures/User.ts:9

premium_type optional

ts
premium_type: UserPremiumType

the type of Nitro subscription on a user's account Inherited from: User.premium_type

Defined in: packages/discord-rpc/structures/User.ts:29

presence optional

ts
presence: Object

user's rich presence Inherited from: User.presence

Defined in: packages/discord-rpc/structures/User.ts:38

public_flags optional

ts
public_flags: UserFlags

the public flags on a user's account Inherited from: User.public_flags

Defined in: packages/discord-rpc/structures/User.ts:33

username

ts
username: string

the user's username, not unique across the platform Inherited from: User.username

Defined in: packages/discord-rpc/structures/User.ts:13

🔑 Accessors

avatarUrl

Inherited from: User.avatarUrl

Defined in: packages/discord-rpc/structures/User.ts:61

defaultAvatarUrl

Inherited from: User.defaultAvatarUrl

Defined in: packages/discord-rpc/structures/User.ts:71

tag

Inherited from: User.tag

Defined in: packages/discord-rpc/structures/User.ts:78

🔧 Methods

clearActivity

ts
clearActivity(pid: number): Promise<void>

Used to clear a user's Rich Presence.

Parameters

  • pid: number the application's process id

Return Type

  • Promise<void>

Defined in: packages/discord-rpc/structures/ClientUser.ts:274

closeJoinRequest

ts
closeJoinRequest(userId: string): Promise<void>

Used to reject an Ask to Join request.

Parameters

  • userId: string the id of the requesting user

Return Type

  • Promise<void>

Defined in: packages/discord-rpc/structures/ClientUser.ts:169

connectToLobby

ts
connectToLobby(lobbyId: string, secret: string): Promise<Lobby>

Used to join a new lobby.

Parameters

  • lobbyId: string the id of the lobby to join
  • secret: string the secret of the lobby to join

Return Type

  • Promise<Lobby>

Defined in: packages/discord-rpc/structures/ClientUser.ts:302

createLobby

ts
createLobby(type: LobbyType, capacity: number, locked: boolean, metadata: any): Promise<Lobby>

Create a new lobby

Parameters

  • type: LobbyType lobby type
  • capacity: number lobby size
  • locked: boolean is lobby locked
  • metadata: any additional data?

Return Type

  • Promise<Lobby>

Defined in: packages/discord-rpc/structures/ClientUser.ts:289

fetchChannel

ts
fetchChannel(channelId: string): Promise<Channel>

Used to get a channel the client is in.

Parameters

  • channelId: string id of the channel to get

Return Type

  • Promise<Channel>

Defined in: packages/discord-rpc/structures/ClientUser.ts:74

fetchChannels

ts
fetchChannels(guildId: string): Promise<Channel>

Used to get a guild's channels the client is in.

Parameters

  • guildId: string id of the guild to get channels for

Return Type

  • Promise<Channel>

Defined in: packages/discord-rpc/structures/ClientUser.ts:83

fetchGuild

ts
fetchGuild(guildId: string, timeout: number): Promise<Guild>

Used to get a guild the client is in.

Parameters

  • guildId: string id of the guild to get
  • timeout: number asynchronously get guild with time to wait before timing out

Return Type

  • Promise<Guild>

Defined in: packages/discord-rpc/structures/ClientUser.ts:55

fetchGuilds

ts
fetchGuilds(): Promise<Guild[]>

Used to get a list of guilds the client is in.

Return Type

  • Promise<Guild[]>

Defined in: packages/discord-rpc/structures/ClientUser.ts:63

fetchUser

ts
fetchUser(userId: string): Promise<User>

Parameters

  • userId: string

Return Type

  • Promise<User>

Defined in: packages/discord-rpc/structures/ClientUser.ts:44

getImage

ts
getImage(userId: string, format: "png" | "webp" | "jpg"= 'png', size: 16 | 32 | 64 | 128 | 256 | 512 | 1024= 1024): Promise<string>

Used to get a user's avatar

Parameters

  • userId: string id of the user to get the avatar of
  • format: "png" | "webp" | "jpg" image format
  • size: 16 | 32 | 64 | 128 | 256 | 512 | 1024 image size

Return Type

  • Promise<string>

Defined in: packages/discord-rpc/structures/ClientUser.ts:323

getRelationships

ts
getRelationships(): Promise<User[]>

Return Type

  • Promise<User[]>

Defined in: packages/discord-rpc/structures/ClientUser.ts:194

getSelectedVoiceChannel

ts
getSelectedVoiceChannel(): Promise<null | Channel>

Used to get the client's current voice channel. There are no arguments for this command. Returns the Get Channel response, or null if none.

Return Type

  • Promise<null | Channel>

Defined in: packages/discord-rpc/structures/ClientUser.ts:93

getVoiceSettings

ts
getVoiceSettings(): Promise<VoiceSettings>

Used to get current client's voice settings

Return Type

  • Promise<VoiceSettings>

Defined in: packages/discord-rpc/structures/ClientUser.ts:135

leaveTextChannel

ts
leaveTextChannel(timeout: number): Promise<void>

Used to leave text channels, group dms, or dms.

Parameters

  • timeout: number asynchronously join channel with time to wait before timing out

Return Type

  • Promise<void>

Defined in: packages/discord-rpc/structures/ClientUser.ts:190

leaveVoiceChannel

ts
leaveVoiceChannel(timeout: number, force: boolean): Promise<void>

Used to leave voice channels, group dms, or dms

Parameters

  • timeout: number asynchronously join channel with time to wait before timing out
  • force: boolean forces a user to join a voice channel

Return Type

  • Promise<void>

Defined in: packages/discord-rpc/structures/ClientUser.ts:123

selectTextChannel

ts
selectTextChannel(channelId: string, timeout: number): Promise<null | Channel>

Used to join text channels, group dms, or dms. Returns the Get Channel response, or null if none.

Parameters

  • channelId: string channel id to join
  • timeout: number asynchronously join channel with time to wait before timing out

Return Type

  • Promise<null | Channel>

Defined in: packages/discord-rpc/structures/ClientUser.ts:179

selectVoiceChannel

ts
selectVoiceChannel(channelId: string, timeout: number, force: boolean): Promise<Channel>

Used to join voice channels, group dms, or dms. Returns the Get Channel response, null if none.

Parameters

  • channelId: string channel id to join
  • timeout: number asynchronously join channel with time to wait before timing out
  • force: boolean forces a user to join a voice channel

Return Type

  • Promise<Channel>

Defined in: packages/discord-rpc/structures/ClientUser.ts:105

sendJoinInvite

ts
sendJoinInvite(userId: string): Promise<void>

Used to accept an Ask to Join request.

Parameters

  • userId: string the id of the requesting user

Return Type

  • Promise<void>

Defined in: packages/discord-rpc/structures/ClientUser.ts:161

sendToLobby

ts
sendToLobby(lobbyId: string, data: string): Promise<Lobby>

Used to join a new lobby.

Parameters

  • lobbyId: string the id of the lobby to join
  • data: string additional data to send to lobby

Return Type

  • Promise<Lobby>

Defined in: packages/discord-rpc/structures/ClientUser.ts:312

setActivity

ts
setActivity(activity: SetActivity, pid: number): Promise<SetActivityResponse>

Used to update a user's Rich Presence.

Parameters

  • activity: SetActivity the rich presence to assign to the user
  • pid: number the application's process id

Return Type

  • Promise<SetActivityResponse>

Defined in: packages/discord-rpc/structures/ClientUser.ts:207

setCeritfiedDevices

ts
setCeritfiedDevices(devices: CertifiedDevice[]): Promise<void>

Used by hardware manufacturers to send information about the current state of their certified devices that are connected to Discord.

Parameters

  • devices: CertifiedDevice[] a list of devices for your manufacturer, in order of priority

Return Type

  • Promise<void>

Defined in: packages/discord-rpc/structures/ClientUser.ts:153

setVoiceSettings

ts
setVoiceSettings(voiceSettings: Partial<VoiceSettings>): Promise<VoiceSettings>

Used to change voice settings of users in voice channels

Parameters

  • voiceSettings: Partial<VoiceSettings> the settings

Return Type

  • Promise<VoiceSettings>

Defined in: packages/discord-rpc/structures/ClientUser.ts:144