revbot.js
    Preparing search index...

    Class TextChannel

    Represents a text channel in a server.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Creates a new TextChannel instance.

      Parameters

      • client: client

        The client instance.

      • data: {
            _id: string;
            channel_type: "TextChannel";
            default_permissions?: null | { a: number; d: number };
            description?: null | string;
            icon?:
                | null
                | {
                    _id: string;
                    content_type: string;
                    deleted?: null
                    | boolean;
                    filename: string;
                    message_id?: null | string;
                    metadata:
                        | { type: "File" }
                        | { type: "Text" }
                        | { height: number; type: "Image"; width: number }
                        | { height: number; type: "Video"; width: number }
                        | { type: "Audio" };
                    object_id?: null | string;
                    reported?: null | boolean;
                    server_id?: null | string;
                    size: number;
                    tag: string;
                    user_id?: null | string;
                };
            last_message_id?: null
            | string;
            name: string;
            nsfw?: boolean;
            role_permissions?: { [key: string]: { a: number; d: number } };
            server: string;
        }

        The raw data for the text channel from the API.

        • _id: string

          Unique Id

        • channel_type: "TextChannel"
        • Optionaldefault_permissions?: null | { a: number; d: number }

          Default permissions assigned to users in this channel

        • Optionaldescription?: null | string

          Channel description

        • Optionalicon?:
              | null
              | {
                  _id: string;
                  content_type: string;
                  deleted?: null
                  | boolean;
                  filename: string;
                  message_id?: null | string;
                  metadata:
                      | { type: "File" }
                      | { type: "Text" }
                      | { height: number; type: "Image"; width: number }
                      | { height: number; type: "Video"; width: number }
                      | { type: "Audio" };
                  object_id?: null | string;
                  reported?: null | boolean;
                  server_id?: null | string;
                  size: number;
                  tag: string;
                  user_id?: null | string;
              }

          Custom icon attachment

        • Optionallast_message_id?: null | string

          Id of the last message sent in this channel

        • name: string

          Display name of the channel

        • Optionalnsfw?: boolean

          Whether this channel is marked as not safe for work

        • Optionalrole_permissions?: { [key: string]: { a: number; d: number } }

          Permissions assigned based on role to this channel

        • server: string

          Id of the server this channel belongs to

      Returns TextChannel

    Properties

    client: client

    The client instance.

    description: null | string = null

    The description of the channel, or null if none is set.

    icon: null | Attachment = null

    The icon of the channel, or null if none is set.

    id: string

    The unique identifier for the object.

    lastMessageId: null | string = null

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

    messages: MessageManager = ...

    Manages the messages in this text channel.

    name: string

    The name of the channel.

    nsfw: boolean = false

    Whether the channel is marked as NSFW (Not Safe For Work).

    overwrites: Map<string, Overwrite> = ...

    The permission overwrites for the channel.

    serverId: string

    The ID of the server this channel belongs to.

    type: TEXT = ChannelTypes.TEXT

    The type of the channel, which is always TEXT for text 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.');
      }