> ## Documentation Index
> Fetch the complete documentation index at: https://yor.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Yor.ts | classes/Channel

[yor.ts](../README) / [Exports](../modules) / Channel

# Class: Channel

## Hierarchy

* [`Base`](Base)

  ↳ **`Channel`**

## Table of contents

### Constructors

* [constructor](Channel#constructor)

### Properties

* [API](Channel#api)
* [client](Channel#client)
* [flags](Channel#flags)
* [id](Channel#id)
* [name](Channel#name)
* [raw](Channel#raw)
* [type](Channel#type)

### Methods

* [bulkDeleteMessages](Channel#bulkdeletemessages)
* [createInvite](Channel#createinvite)
* [createWebhook](Channel#createwebhook)
* [createdAt](Channel#createdat)
* [createdTimestamp](Channel#createdtimestamp)
* [crosspostMessage](Channel#crosspostmessage)
* [delete](Channel#delete)
* [edit](Channel#edit)
* [editMessage](Channel#editmessage)
* [fetchMessage](Channel#fetchmessage)
* [fetchMessages](Channel#fetchmessages)
* [getInvites](Channel#getinvites)
* [getWebhooks](Channel#getwebhooks)
* [isDMBased](Channel#isdmbased)
* [isTextBased](Channel#istextbased)
* [isThread](Channel#isthread)
* [isVoiceBased](Channel#isvoicebased)
* [pinMessage](Channel#pinmessage)
* [send](Channel#send)
* [toString](Channel#tostring)
* [unpinMessage](Channel#unpinmessage)

## Constructors

### constructor

• **new Channel**(`client`, `data`): [`Channel`](Channel)

Constructs a new instance of the class.

#### Parameters

| Name     | Type                                                                                                                                                                                                                                                                                                                | Description        |
| :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----------------- |
| `client` | [`YorClient`](YorClient)                                                                                                                                                                                                                                                                                            | The client object. |
| `data`   | `undefined` \| \{ `flags?`: `ChannelFlags` ; `id`: `string` ; `name?`: `null` \| `string` ; `type`: `GuildText` \| `DM` \| `GuildVoice` \| `GroupDM` \| `GuildCategory` \| `GuildAnnouncement` \| `AnnouncementThread` \| `PublicThread` \| `PrivateThread` \| `GuildStageVoice` \| `GuildForum` \| `GuildMedia`  } | The channel data.  |

#### Returns

[`Channel`](Channel)

**`Throws`**

If channel data is not provided.

#### Overrides

[Base](Base).[constructor](Base#constructor)

#### Defined in

[src/structures/Channel.ts:45](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L45)

## Properties

### API

• `Private` **API**: `ChannelsAPI`

#### Defined in

[src/structures/Channel.ts:36](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L36)

***

### client

• **client**: [`YorClient`](YorClient)

#### Inherited from

[Base](Base).[client](Base#client)

#### Defined in

[src/structures/Base.ts:4](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Base.ts#L4)

***

### flags

• `Optional` **flags**: `ChannelFlags`

#### Defined in

[src/structures/Channel.ts:32](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L32)

***

### id

• **id**: `string`

#### Defined in

[src/structures/Channel.ts:29](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L29)

***

### name

• **name**: `undefined` | `string`

#### Defined in

[src/structures/Channel.ts:30](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L30)

***

### raw

• **raw**: [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<`APIChannel`>

#### Defined in

[src/structures/Channel.ts:34](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L34)

***

### type

• **type**: `number`

#### Defined in

[src/structures/Channel.ts:31](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L31)

## Methods

### bulkDeleteMessages

▸ **bulkDeleteMessages**(`messages`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Bulk deletes messages

#### Parameters

| Name       | Type        | Description                           |
| :--------- | :---------- | :------------------------------------ |
| `messages` | `string`\[] | The data used to bulk delete messages |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Promise that resolves when the messages are deleted

#### Defined in

[src/structures/Channel.ts:169](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L169)

***

### createInvite

▸ **createInvite**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIInvite`>

Creates an invite using the given data and returns the created invite.

#### Parameters

| Name   | Type                               | Description                         |
| :----- | :--------------------------------- | :---------------------------------- |
| `data` | `RESTPostAPIChannelInviteJSONBody` | The data used to create the invite. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIInvite`>

The created invite.

#### Defined in

[src/structures/Channel.ts:129](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L129)

***

### createWebhook

▸ **createWebhook**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Webhook`](Webhook)>

Creates a webhook in the current channel or parent channel (if a thread) with the given data

#### Parameters

| Name   | Type                                                           | Description                        |
| :----- | :------------------------------------------------------------- | :--------------------------------- |
| `data` | `RESTPostAPIChannelWebhookJSONBody` & \{ `reason`: `string`  } | The data for creating the webhook. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Webhook`](Webhook)>

A promise that resolves with the created webhook.

#### Defined in

[src/structures/Channel.ts:274](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L274)

***

### createdAt

▸ **createdAt**(): [`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)

Returns the creation date of the object.

#### Returns

[`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)

The creation date of the object.

#### Defined in

[src/structures/Channel.ts:212](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L212)

***

### createdTimestamp

▸ **createdTimestamp**(): `number`

Returns the created timestamp as a Date object.

#### Returns

`number`

The created timestamp.

#### Defined in

[src/structures/Channel.ts:198](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L198)

***

### crosspostMessage

▸ **crosspostMessage**(`messageId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Crossposts a message.

#### Parameters

| Name        | Type     | Description                         |
| :---------- | :------- | :---------------------------------- |
| `messageId` | `string` | The ID of the message to crosspost. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

A promise that resolves to the crossposted message.

#### Defined in

[src/structures/Channel.ts:119](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L119)

***

### delete

▸ **delete**(): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIChannel`>

Deletes the channel

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIChannel`>

Promise that resolves to the deleted channel

#### Defined in

[src/structures/Channel.ts:149](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L149)

***

### edit

▸ **edit**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIChannel`>

Edits the channel

#### Parameters

| Name   | Type                          | Description                       |
| :----- | :---------------------------- | :-------------------------------- |
| `data` | `RESTPatchAPIChannelJSONBody` | The data used to edit the channel |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIChannel`>

Promise that resolves to the edited channel

#### Defined in

[src/structures/Channel.ts:159](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L159)

***

### editMessage

▸ **editMessage**(`messageId`, `data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Edits a message.

#### Parameters

| Name        | Type                                                                | Description                            |
| :---------- | :------------------------------------------------------------------ | :------------------------------------- |
| `messageId` | `string`                                                            | The ID of the message to be edited.    |
| `data`      | `RESTPatchAPIChannelMessageJSONBody` & \{ `files?`: `RawFile`\[]  } | The data to be updated in the message. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

* A promise that resolves to the edited message.

#### Defined in

[src/structures/Channel.ts:84](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L84)

***

### fetchMessage

▸ **fetchMessage**(`messageId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Fetches a specific message by its ID.

#### Parameters

| Name        | Type     | Description                     |
| :---------- | :------- | :------------------------------ |
| `messageId` | `string` | The ID of the message to fetch. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

A Promise that resolves to the fetched message.

#### Defined in

[src/structures/Channel.ts:97](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L97)

***

### fetchMessages

▸ **fetchMessages**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`\[]>

Fetches messages using the provided data.

#### Parameters

| Name   | Type                             | Description                      |
| :----- | :------------------------------- | :------------------------------- |
| `data` | `RESTGetAPIChannelMessagesQuery` | The data used to fetch messages. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`\[]>

A promise that resolves to an array of API messages.

#### Defined in

[src/structures/Channel.ts:107](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L107)

***

### getInvites

▸ **getInvites**(): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIInvite`\[]>

Retrieves the invites.

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIInvite`\[]>

The list of invites.

#### Defined in

[src/structures/Channel.ts:140](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L140)

***

### getWebhooks

▸ **getWebhooks**(): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Webhook`](Webhook)\[]>

Gets all webhooks in the current channel or parent channel (if a thread)

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Webhook`](Webhook)\[]>

A promise that resolves with an array of webhooks.

#### Defined in

[src/structures/Channel.ts:305](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L305)

***

### isDMBased

▸ **isDMBased**(): `boolean`

Determines if the channel is DM-based.

#### Returns

`boolean`

* True if the channel is DM-based, false otherwise.

#### Defined in

[src/structures/Channel.ts:254](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L254)

***

### isTextBased

▸ **isTextBased**(): `boolean`

Checks if the function is text-based.

#### Returns

`boolean`

true if the function is text-based, false otherwise.

#### Defined in

[src/structures/Channel.ts:245](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L245)

***

### isThread

▸ **isThread**(): `boolean`

Checks if the channel type is a thread.

#### Returns

`boolean`

true if the channel type is a thread, false otherwise

#### Defined in

[src/structures/Channel.ts:221](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L221)

***

### isVoiceBased

▸ **isVoiceBased**(): `boolean`

Determines if the channel is voice-based.

#### Returns

`boolean`

Returns true if the channel is voice-based, false otherwise.

#### Defined in

[src/structures/Channel.ts:234](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L234)

***

### pinMessage

▸ **pinMessage**(`messageId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Pin a message

#### Parameters

| Name        | Type     | Description                    |
| :---------- | :------- | :----------------------------- |
| `messageId` | `string` | The data used to pin a message |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Promise that resolves when the message is pinned

#### Defined in

[src/structures/Channel.ts:179](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L179)

***

### send

▸ **send**(`data`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

Sends a message with the given data.

#### Parameters

| Name   | Type                                                               | Description               |
| :----- | :----------------------------------------------------------------- | :------------------------ |
| `data` | `RESTPostAPIChannelMessageJSONBody` & \{ `files?`: `RawFile`\[]  } | The data for the message. |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`APIMessage`>

A promise that resolves to the created message.

#### Defined in

[src/structures/Channel.ts:71](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L71)

***

### toString

▸ **toString**(): \`\<#\$\{string}>\`

Returns a string representation of the channel.

#### Returns

\`\<#\$\{string}>\`

The string representation of the channel.

#### Defined in

[src/structures/Channel.ts:263](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L263)

***

### unpinMessage

▸ **unpinMessage**(`messageId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Unpin a message

#### Parameters

| Name        | Type     | Description                      |
| :---------- | :------- | :------------------------------- |
| `messageId` | `string` | The data used to unpin a message |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`>

Promise that resolves when the message is unpinned

#### Defined in

[src/structures/Channel.ts:189](https://github.com/OreOreki/yor.ts/blob/ff21935/src/structures/Channel.ts#L189)
