2020-10-23 16:11:00 +00:00
|
|
|
import { Client } from '../models/client.ts'
|
|
|
|
import { GuildChannel } from './guildChannel.ts'
|
|
|
|
import { GuildTextChannelPayload } from '../types/channelTypes.ts'
|
2020-10-29 14:43:27 +00:00
|
|
|
import cache from '../models/cache.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
|
|
|
|
export class GuildTextChannel extends GuildChannel {
|
|
|
|
rateLimit: number
|
|
|
|
topic?: string
|
|
|
|
|
2020-10-25 17:03:53 +00:00
|
|
|
get mention (): string {
|
2020-10-23 16:11:00 +00:00
|
|
|
return `<#${this.id}>`
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor (client: Client, data: GuildTextChannelPayload) {
|
|
|
|
super(client, data)
|
|
|
|
this.topic = data.topic
|
|
|
|
this.rateLimit = data.rate_limit_per_user
|
2020-10-29 14:43:27 +00:00
|
|
|
cache.set('guildtextchannel', this.id, this)
|
|
|
|
}
|
|
|
|
|
|
|
|
readFromData (data: GuildTextChannelPayload): void {
|
|
|
|
super.readFromData(data)
|
|
|
|
this.topic = data.topic ?? this.topic
|
|
|
|
this.rateLimit = data.rate_limit_per_user ?? this.rateLimit
|
2020-10-23 16:11:00 +00:00
|
|
|
}
|
|
|
|
}
|