You are reading the documentation for the next version of discord.js. Documentation for v13/v14+ has been moved to old.discordjs.dev

UsersAPI

export declare class UsersAPI
export declare class UsersAPI

No summary provided.

constructor(rest)
Constructs a new instance of the UsersAPI class
NameTypeOptionalDescription
restRESTNoNone
createDM(userId, options?):Promise<APIChannel>
Opens a new DM channel with a user
NameTypeOptionalDescription
userIdSnowflakeNoThe id of the user to open a DM channel with
optionsPick<RequestData, 'signal'>YesThe options for opening the DM
edit(body, options?):Promise<APIUser>
NameTypeOptionalDescription
bodyRESTPatchAPICurrentUserJSONBodyNoThe new data for the current user
optionsPick<RequestData, 'signal'>YesThe options for editing the user
editCurrentGuildMember(guildId, body?, options?):Promise<APIGuildMember>
Edits the guild member for the current user
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
bodyRESTPatchAPIGuildMemberJSONBodyYesThe new data for the guild member
optionsPick<RequestData, 'reason' | 'signal'>YesThe options for editing the guild member
get(userId, options?):Promise<APIUser>
NameTypeOptionalDescription
userIdSnowflakeNoThe id of the user to fetch
optionsPick<RequestData, 'signal'>YesThe options for fetching the user
getApplicationRoleConnection(applicationId, options?):Promise<APIApplicationRoleConnection>
Gets the current user's active application role connection
NameTypeOptionalDescription
applicationIdSnowflakeNoThe id of the application
optionsPick<RequestData, 'signal'>YesThe options for fetching the role connections
getConnections(options?):Promise<RESTGetAPICurrentUserConnectionsResult>
NameTypeOptionalDescription
optionsPick<RequestData, 'signal'>YesThe options for fetching the user's connections
getCurrent(options?):Promise<APIUser>
Returns the user object of the requester's account
NameTypeOptionalDescription
optionsPick<RequestData, 'signal'>YesThe options for fetching the current user
getGuildMember(guildId, options?):Promise<APIGuildMember>
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
optionsPick<RequestData, 'signal'>YesThe options for fetching the guild member
getGuilds(query?, options?):Promise<RESTGetAPICurrentUserGuildsResult>
Returns a list of partial guild objects the current user is a member of
NameTypeOptionalDescription
queryRESTGetAPICurrentUserGuildsQueryYesThe query options for fetching the current user's guilds
optionsPick<RequestData, 'signal'>YesThe options for fetching the guilds
leaveGuild(guildId, options?):Promise<void>
Leaves the guild with the given id
NameTypeOptionalDescription
guildIdSnowflakeNoThe id of the guild
optionsPick<RequestData, 'signal'>YesThe options for leaving the guild
updateApplicationRoleConnection(applicationId, body, options?):Promise<APIApplicationRoleConnection>
Updates the current user's application role connection
NameTypeOptionalDescription
applicationIdSnowflakeNoThe id of the application
bodyRESTPutAPICurrentUserApplicationRoleConnectionJSONBodyNoThe data for updating the application role connection
optionsPick<RequestData, 'signal'>YesThe options for updating the application role connection