2020-10-22 15:50:47 +00:00
|
|
|
import { Client } from '../models/client.ts'
|
2020-10-31 12:33:34 +00:00
|
|
|
import { ChannelPayload, ChannelTypes } from '../types/channel.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
import { Base } from './base.ts'
|
|
|
|
|
|
|
|
export class Channel extends Base {
|
|
|
|
type: ChannelTypes
|
|
|
|
id: string
|
2020-10-24 15:00:42 +00:00
|
|
|
static cacheName = 'channel'
|
2020-12-02 12:29:52 +00:00
|
|
|
get mention(): string {
|
2020-10-25 17:03:53 +00:00
|
|
|
return `<#${this.id}>`
|
|
|
|
}
|
2020-10-22 15:50:47 +00:00
|
|
|
|
2020-12-02 12:29:52 +00:00
|
|
|
constructor(client: Client, data: ChannelPayload) {
|
2020-10-25 06:50:32 +00:00
|
|
|
super(client, data)
|
2020-10-22 15:50:47 +00:00
|
|
|
this.type = data.type
|
|
|
|
this.id = data.id
|
2020-10-29 14:43:27 +00:00
|
|
|
}
|
|
|
|
|
2020-12-03 05:28:20 +00:00
|
|
|
readFromData(data: ChannelPayload): void {
|
2020-10-29 14:43:27 +00:00
|
|
|
this.type = data.type ?? this.type
|
|
|
|
this.id = data.id ?? this.id
|
2020-10-22 15:50:47 +00:00
|
|
|
}
|
|
|
|
}
|