2020-10-29 14:43:27 +00:00
|
|
|
import cache from '../models/cache.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
import { Client } from '../models/client.ts'
|
2020-10-23 16:11:00 +00:00
|
|
|
import { DMChannelPayload } from '../types/channelTypes.ts'
|
|
|
|
import { UserPayload } from '../types/userTypes.ts'
|
|
|
|
import { TextChannel } from './textChannel.ts'
|
2020-10-22 15:50:47 +00:00
|
|
|
|
2020-10-23 16:11:00 +00:00
|
|
|
export class DMChannel extends TextChannel {
|
|
|
|
recipients: UserPayload[]
|
|
|
|
|
|
|
|
constructor (client: Client, data: DMChannelPayload) {
|
2020-10-22 15:50:47 +00:00
|
|
|
super(client, data)
|
2020-10-23 16:11:00 +00:00
|
|
|
this.recipients = data.recipients
|
2020-10-29 14:43:27 +00:00
|
|
|
cache.set('dmchannel', this.id, this)
|
|
|
|
}
|
|
|
|
|
2020-10-30 14:51:40 +00:00
|
|
|
protected readFromData (data: DMChannelPayload): void {
|
2020-10-29 14:43:27 +00:00
|
|
|
super.readFromData(data)
|
|
|
|
this.recipients = data.recipients ?? this.recipients
|
2020-10-22 15:50:47 +00:00
|
|
|
}
|
|
|
|
}
|