User
Extends
Base
Type Parameters
Type Parameter | Default type |
---|---|
IsPartial extends boolean | false |
Constructors
new User()
new User<
IsPartial
>(client
,rawDataOrId
):User
<IsPartial
>
Parameters
Parameter | Type |
---|---|
client | Client |
rawDataOrId | IsPartial extends true ? string : APIUser |
Returns
User
<IsPartial
>
Overrides
Base.constructor
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
client | public | Client | - | Base.client |
id | readonly | string | The ID of the user | - |
Accessors
accentColor
get
accentColor():IfPartial
<IsPartial
,null
|number
>
The accent color of the user.
Returns
IfPartial
<IsPartial
, null
| number
>
avatar
get
avatar():IfPartial
<IsPartial
,null
|string
>
The avatar hash of the user. You can use User.avatarUrl to get the URL of the avatar.
Returns
IfPartial
<IsPartial
, null
| string
>
avatarUrl
get
avatarUrl():IfPartial
<IsPartial
,null
|string
>
Get the URL of the user's avatar
Returns
IfPartial
<IsPartial
, null
| string
>
banner
get
banner():IfPartial
<IsPartial
,null
|string
>
The banner hash of the user. You can use User.bannerUrl to get the URL of the banner.
Returns
IfPartial
<IsPartial
, null
| string
>
bannerUrl
get
bannerUrl():IfPartial
<IsPartial
,null
|string
>
Get the URL of the user's banner
Returns
IfPartial
<IsPartial
, null
| string
>
bot
get
bot():IfPartial
<IsPartial
,boolean
>
Is this user a bot?
Returns
IfPartial
<IsPartial
, boolean
>
discriminator
get
discriminator():IfPartial
<IsPartial
,string
>
The discriminator of the user.
Returns
IfPartial
<IsPartial
, string
>
flags
get
flags():IfPartial
<IsPartial
,undefined
|UserFlags
>
The public flags of the user. (Bitfield)
See
https://discord.com/developers/docs/resources/user#user-object-user-flags
Returns
IfPartial
<IsPartial
, undefined
| UserFlags
>
globalName
get
globalName():IfPartial
<IsPartial
,null
|string
>
The global name of the user.
Returns
IfPartial
<IsPartial
, null
| string
>
partial
get
partial():IsPartial
Whether the user is a partial user (meaning it does not have all the data). If this is true, you should use User.fetch to get the full data of the user.
Returns
IsPartial
system
get
system():IfPartial
<IsPartial
,boolean
>
Is this user a system user?
Returns
IfPartial
<IsPartial
, boolean
>
username
get
username():IfPartial
<IsPartial
,string
>
The username of the user.
Returns
IfPartial
<IsPartial
, string
>
Methods
createDm()
createDm(
userId
):Promise
<APIDMChannel
>
Instantiate a new DM channel with this user.
Parameters
Parameter | Type |
---|---|
userId | string |
Returns
Promise
<APIDMChannel
>
fetch()
fetch():
Promise
<void
>
Fetch updated data for this user. If the user is partial, this will fetch all the data for the user and populate the fields. If the user is not partial, all fields will be updated with new values from Discord.
Returns
Promise
<void
>
send()
Send a message to this user.
Parameters
Parameter | Type |
---|---|
data | MessagePayload |