2020-10-29 14:43:27 +00:00
|
|
|
import cache from '../models/cache.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
import { Client } from '../models/client.ts'
|
2020-10-31 12:33:34 +00:00
|
|
|
import { GuildVoiceChannelPayload, Overwrite } from '../types/channel.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
import { Channel } from './channel.ts'
|
|
|
|
|
|
|
|
export class VoiceChannel extends Channel {
|
|
|
|
bitrate: string
|
|
|
|
userLimit: number
|
|
|
|
guildID: string
|
|
|
|
name: string
|
|
|
|
position: number
|
|
|
|
permissionOverwrites: Overwrite[]
|
|
|
|
nsfw: boolean
|
|
|
|
parentID?: string
|
|
|
|
|
|
|
|
constructor (client: Client, data: GuildVoiceChannelPayload) {
|
|
|
|
super(client, data)
|
|
|
|
this.bitrate = data.bitrate
|
|
|
|
this.userLimit = data.user_limit
|
|
|
|
this.guildID = data.guild_id
|
|
|
|
this.name = data.name
|
|
|
|
this.position = data.position
|
|
|
|
this.permissionOverwrites = data.permission_overwrites
|
|
|
|
this.nsfw = data.nsfw
|
|
|
|
this.parentID = data.parent_id
|
2020-11-01 11:22:09 +00:00
|
|
|
// TODO: Cache in Gateway Event Code
|
|
|
|
// cache.set('guildvoicechannel', this.id, this)
|
2020-10-29 14:43:27 +00:00
|
|
|
}
|
|
|
|
|
2020-10-30 14:51:40 +00:00
|
|
|
protected readFromData (data: GuildVoiceChannelPayload): void {
|
2020-10-29 14:43:27 +00:00
|
|
|
super.readFromData(data)
|
|
|
|
this.bitrate = data.bitrate ?? this.bitrate
|
|
|
|
this.userLimit = data.user_limit ?? this.userLimit
|
|
|
|
this.guildID = data.guild_id ?? this.guildID
|
|
|
|
this.name = data.name ?? this.name
|
|
|
|
this.position = data.position ?? this.position
|
|
|
|
this.permissionOverwrites =
|
|
|
|
data.permission_overwrites ?? this.permissionOverwrites
|
|
|
|
this.nsfw = data.nsfw ?? this.nsfw
|
|
|
|
this.parentID = data.parent_id ?? this.parentID
|
2020-10-23 16:11:00 +00:00
|
|
|
}
|
|
|
|
}
|