Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Channel

Represents any channel on Discord

Hierarchy

Index

Constructors

Properties

client: Client

The client that instantiated this structure

Raw Channel data

guildId: undefined | string

Theof the guild the channel is in

Accessors

  • get bitrate(): null | number
  • The bitrate of this voice-based channel

    Returns null | number

  • get createdAt(): Date
  • The time the channel was created at

    Returns Date

  • get createdTimestamp(): number
  • The timestamp the channel was created at

    Returns number

  • get guild(): undefined | Guild
  • The Guild this channel belongs to

    Returns undefined | Guild

  • get id(): string
  • Theof the channel

    Returns string

  • get name(): undefined | string
  • The name of the channel

    Returns undefined | string

  • get nsfw(): boolean
  • If the guild considers this channel NSFW

    Returns boolean

  • The category parent of this channel

    Returns undefined | Channel

  • get parentId(): undefined | string
  • Theof the category parent of this channel

    Returns undefined | string

  • get position(): undefined | number
  • The position of this Guild channel

    Returns undefined | number

  • get rateLimitPerUser(): number
  • The rate limit per user (slowmode) for this channel in seconds

    Returns number

  • get recipient(): null | User
  • The recipient on the other end of the DM

    Returns null | User

  • get topic(): null | string
  • The topic of the guild channel

    Returns null | string

  • The numeric type of the channel

    Returns ChannelType

  • get url(): string
  • The URL to the channel

    Returns string

  • get userLimit(): null | number
  • The maximum amount of users allowed in this channel

    Returns null | number

Methods

  • clone(): any
  • Returns any

  • delete(reason?: string): Promise<Channel>
  • Deletes this {@link @Guild}Channel

    example
    channel.delete('I am no longer needed')
    

    Parameters

    • reason: string = ''

      Reason for deleting this channel

    Returns Promise<Channel>

  • isCategory(): boolean
  • Indicates whether this channel is a category

    Returns boolean

  • isNews(): boolean
  • Indicates whether this channel is a news channel

    Returns boolean

  • isNewsThread(): boolean
  • Indicates whether this channel is a thread in a news channel

    Returns boolean

  • isPrivateThread(): boolean
  • Indicates whether this channel is a private thread in a text channel

    Returns boolean

  • isPublicThread(): boolean
  • Indicates whether this channel is a public thread in a text channel

    Returns boolean

  • isStage(): boolean
  • Indicates whether this channel is a stage channel

    Returns boolean

  • isText(): boolean
  • Indicates whether this channel is a text channel

    Returns boolean

  • isTextBased(): boolean
  • Indicates whether this channel can have messages

    Returns boolean

  • isThreadBased(): boolean
  • Indicates whether this channel is a thread

    Returns boolean

  • isVoice(): boolean
  • Indicates whether this channel is a voice channel

    Returns boolean

  • isVoiceBased(): boolean
  • Indicates whether this channel is voice based

    Returns boolean

  • Sends a message to this channel

    example
    const { EmbedBuilder } = require('helly');
    const embed = new EmbedBuilder().setTitle('Pong!')
    if (channel.isText()) channel.send({ embeds: [embed] })
    example
    const { EmbedBuilder } = require('helly');
    const embed = new EmbedBuilder().setTitle('Pong!')
    if (channel.isText()) channel.send({ content: 'Ping?', embeds: [embed] })
    example
    if (channel.isText()) channel.send('Hello world!')
    

    Parameters

    Returns Promise<Message>

  • setBitrate(bitrate?: number, reason?: string): undefined | Promise<Channel>
  • Sets the bitrate of the channel

    example
    channel.setBitrate(48_000)
    

    Parameters

    • bitrate: number = 64_000

      The new bitrate

    • reason: string = ''

      Reason for changing the channel's bitrate

    Returns undefined | Promise<Channel>

  • setNSFW(nsfw?: boolean, reason?: string): undefined | Promise<Channel>
  • Sets whether this channel is flagged as NSFW

    example
    channel.setNSFW(true)
    
    example
    channel.setNSFW(false, 'No longer NSFW')
    

    Parameters

    • nsfw: boolean = true
    • reason: string = ''

      Reason for changing the channel's NSFW flag

    Returns undefined | Promise<Channel>

  • setName(name: string, reason?: string): undefined | Promise<Channel>
  • Sets a new name for the guild channel

    example
    channel.setName('server-rules')
    
    example
    channel.setName('general')
    

    Parameters

    • name: string

      The new name for the guild channel

    • reason: string = ''

      Reason for changing the guild channel's name

    Returns undefined | Promise<Channel>

  • setPosition(position?: number, reason?: string): undefined | Promise<Channel>
  • Sets a new position for the guild channel

    example
    channel.setPosition(13)
    
    example
    channel.setPosition(3)
    

    Parameters

    • position: number = 0

      The new position for the guild channel

    • reason: string = ''

      The reason for changing the position

    Returns undefined | Promise<Channel>

  • setRateLimitPerUser(rateLimitPerUser?: number, reason?: string): undefined | Promise<Channel>
  • Sets the rate limit per user (slowmode) for this channel

    Parameters

    • rateLimitPerUser: number = 0

      The rate limit per user in seconds

    • reason: string = ''

      The reason for changing the rate limit

    Returns undefined | Promise<Channel>

  • setTopic(topic?: null | string, reason?: string): undefined | Promise<Channel>
  • Changes the topic of this channel

    example
    // Removes the channel topic
    channel.setTopic(null)
    example
    channel.setTopic('Server rules.')
    

    Parameters

    • topic: null | string = ...

      The new topic of this channel

    • reason: string = ''

      The reason for changing the topic

    Returns undefined | Promise<Channel>

  • Changes the type of this channel

    example
    channel.setType(ChannelType.GuildNews)
    
    example
    // set the type of the channel to Text
    channel.setType(0, 'This was needed')

    Parameters

    • type: ChannelType = ChannelType.GuildText

      The new type of the channel. Only conversion between GuildText and GuildNews is supported and only in guilds with the "NEWS" feature

    • reason: string = ''

      The reason for changing the type

    Returns undefined | Promise<Channel>

  • toString(): string
  • Returns the mention of the chanel

    Returns string

Generated using TypeDoc version 0.22.16, the 9/16/2022 at 1:09:15 AM