revbot.js
    Preparing search index...

    Class DMChannel

    Represents a direct message (DM) channel between users.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Creates a new DMChannel instance.

      Parameters

      • client: client

        The client instance.

      • data: {
            _id: string;
            active: boolean;
            channel_type: "DirectMessage";
            last_message_id?: null | string;
            recipients: string[];
        }

        The raw data for the DM channel from the API.

        • _id: string

          Unique Id

        • active: boolean

          Whether this direct message channel is currently open on both sides

        • channel_type: "DirectMessage"
        • Optionallast_message_id?: null | string

          Id of the last message sent in this channel

        • recipients: string[]

          2-tuple of user ids participating in direct message

      Returns DMChannel

    Properties

    active: boolean

    Whether the DM channel is currently active.

    client: client

    The client instance.

    id: string

    The unique identifier for the object.

    lastMessageId: null | string = null

    The ID of the last message sent in this DM channel, if any.

    messages: MessageManager = ...

    Manages the messages in this DM channel.

    permissions: Readonly<ChannelPermissions> = DEFAULT_PERMISSION_DM

    The default permissions for the DM channel.

    type: DM = ChannelTypes.DM

    The type of the channel, which is always DM for direct message channels.

    Accessors

    • get createdTimestamp(): number

      Gets the timestamp (in milliseconds) when the channel was created.

      Returns number

      The timestamp of the channel's creation.

    Methods

    • Updates the object with new data and returns a clone of the object.

      Parameters

      • data: PartialObject

        The data to update the object with.

      • Optionalclear: string[]

        Fields to clear in the object.

      Returns this

      A clone of the updated object.

    • Deletes the current channel instance from the client's channel collection.

      This method interacts with the client's channel management system to remove the channel. Once deleted, the channel will no longer be accessible through the client.

      Returns Promise<void>

      A promise that resolves when the channel has been successfully deleted.

      const channel = client.channels.get('1234567890');
      if (channel) {
      await channel.delete();
      console.log('Channel deleted successfully.');
      }