class DMChannel


TextBasedChannelMixin(BaseChannel, false, [ 'bulkDelete', 'fetchWebhooks', 'createWebhook', 'setRateLimitPerUser', 'setNSFW',])
export class DMChannel extends TextBasedChannelMixin(BaseChannel, false, [ 'bulkDelete', 'fetchWebhooks', 'createWebhook', 'setRateLimitPerUser', 'setNSFW',])

Represents a direct message channel between two users.

The flags that are applied to the channel. This is only null in a PartialGroupDMChannel. In all other cases, it is not null.

lastMessage? : Message

The Message object of the last message in the channel, if one was sent

lastMessageId? : Snowflake

The channel's last message id, if one was sent

lastPinAt? : Date

The date when the last pinned message was pinned, if there was one

lastPinTimestamp? : number

The timestamp when the last pinned message was pinned, if there was one

messages : DMMessageManager

A manager of the messages belonging to this channel

recipient : User | null

The recipient on the other end of the DM

recipientId : Snowflake

The recipient's id

The type of the channel

Collects a single component interaction that passes the filter. The Promise will reject if the time expires.

// Collect a message component interaction
const filter = (interaction) => interaction.customId === 'button' && === 'someId';
channel.awaitMessageComponent({ filter, time: 15_000 })
  .then(interaction => console.log(`${interaction.customId} was clicked!`))

Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.

// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages({ filter, max: 4, time: 60_000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));

createMessageCollector() : MessageCollector

Creates a Message Collector.

// Create a message collector
const filter = message => message.content.includes('discord');
const collector = channel.createMessageCollector({ filter, time: 15_000 });
collector.on('collect', message => console.log(`Collected ${message.content}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));

createMessageComponentCollector() : InteractionCollector

Creates a component interaction collector.

// Create a button interaction collector
const filter = (interaction) => interaction.customId === 'button' && === 'someId';
const collector = channel.createMessageComponentCollector({ filter, time: 15_000 });
collector.on('collect', interaction => console.log(`Collected ${interaction.customId}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));

force?: boolean
) : Promise<this>

Fetch this DMChannel.

Sends a message to this channel.

// Send a basic message
  .then(message => console.log(`Sent message: ${message.content}`))
// Send a remote file
  files: ['']
// Send a local file
  files: [{
    attachment: 'entire/path/to/file.jpg',
    name: 'file.jpg',
    description: 'A description of the file'

sendTyping() : Promise<void>

Sends a typing indicator in the channel.

// Start typing in a channel

Returns: Resolves upon the typing status being sent *

toString() : UserMention

When concatenated with a string, this automatically returns the recipient's mention instead of the DMChannel object.

// Logs: Hello from <@123456789012345678>!
console.log(`Hello from ${channel}!`);