2021-03-19 15:39:14 +00:00
|
|
|
import { GuildChannel } from './channel.ts'
|
2020-12-20 09:11:37 +00:00
|
|
|
import {
|
|
|
|
GuildCategoryChannelPayload,
|
|
|
|
ModifyGuildCategoryChannelOption,
|
2021-03-19 15:39:14 +00:00
|
|
|
ModifyGuildCategoryChannelPayload
|
2020-12-20 09:11:37 +00:00
|
|
|
} from '../types/channel.ts'
|
|
|
|
import { CHANNEL } from '../types/endpoint.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
|
2021-03-19 15:39:14 +00:00
|
|
|
export class CategoryChannel extends GuildChannel {
|
2020-12-20 09:11:37 +00:00
|
|
|
readFromData(data: GuildCategoryChannelPayload): void {
|
2020-10-29 14:43:27 +00:00
|
|
|
super.readFromData(data)
|
2020-10-23 16:11:00 +00:00
|
|
|
}
|
2020-12-20 09:11:37 +00:00
|
|
|
|
|
|
|
async edit(
|
|
|
|
options?: ModifyGuildCategoryChannelOption
|
|
|
|
): Promise<CategoryChannel> {
|
|
|
|
const body: ModifyGuildCategoryChannelPayload = {
|
|
|
|
name: options?.name,
|
|
|
|
position: options?.position,
|
|
|
|
permission_overwrites: options?.permissionOverwrites,
|
|
|
|
parent_id: options?.parentID
|
|
|
|
}
|
|
|
|
|
|
|
|
const resp = await this.client.rest.patch(CHANNEL(this.id), body)
|
|
|
|
|
|
|
|
return new CategoryChannel(this.client, resp, this.guild)
|
|
|
|
}
|
2020-10-23 16:11:00 +00:00
|
|
|
}
|