users.update()

The client.users.update() method allows you to enable or disable Do Not Disturb (DND) and other preferences for the current user.

Definition

client.users.update({
displayName: ?string,
dnd: ?bool,
dndText: ?string,
}):Promise<User,Error>

Parameters

ParameterTypeDescription
displayName?stringUser's display name
dnd?boolIndicates whether dnd is enabled or disabled
dndText?stringAn auto-reply message to send whenever someone first tries to contact the current user

Returns

Once the returned Promise is resolved, we will have access to the updated User object.

Example

const user = await client.users.update({
displayName: 'some-display-id',
dnd: true,
dndText: 'I\'m away right now'
});
console.log(
user.displayName, 'dnd is', user.dnd ? 'enabled' : 'disabled',
'with auto-reply message', user.dndText
);