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'
|
|
|
|
import { GroupDMChannelPayload } from '../types/channelTypes.ts'
|
|
|
|
import { Channel } from './channel.ts'
|
|
|
|
|
2020-10-25 17:03:53 +00:00
|
|
|
export class GroupDMChannel extends Channel {
|
2020-10-23 16:11:00 +00:00
|
|
|
name: string
|
|
|
|
icon?: string
|
|
|
|
ownerID: string
|
|
|
|
|
|
|
|
constructor (client: Client, data: GroupDMChannelPayload) {
|
|
|
|
super(client, data)
|
|
|
|
|
|
|
|
this.name = data.name
|
|
|
|
this.icon = data.icon
|
|
|
|
this.ownerID = data.owner_id
|
2020-10-29 14:43:27 +00:00
|
|
|
cache.set('groupchannel', this.id, this)
|
|
|
|
}
|
|
|
|
|
2020-10-30 14:51:40 +00:00
|
|
|
protected readFromData (data: GroupDMChannelPayload): void {
|
2020-10-29 14:43:27 +00:00
|
|
|
super.readFromData(data)
|
|
|
|
this.name = data.name ?? this.name
|
|
|
|
this.icon = data.icon ?? this.icon
|
|
|
|
this.ownerID = data.owner_id ?? this.ownerID
|
2020-10-23 16:11:00 +00:00
|
|
|
}
|
|
|
|
}
|