feat(TextBasedChannel): add lastPinTimestamp and lastPinAt (#2813)

* add lastPinTimestamp

* typings

* use or instead of ternary
This commit is contained in:
Ash
2018-09-03 03:11:52 -04:00
committed by SpaceEEC
parent b068abb5de
commit e96a60361a
6 changed files with 45 additions and 1 deletions

View File

@@ -16,7 +16,12 @@ class ChannelPinsUpdate extends AbstractHandler {
const data = packet.d;
const channel = client.channels.get(data.channel_id);
const time = new Date(data.last_pin_timestamp);
if (channel && time) client.emit(Events.CHANNEL_PINS_UPDATE, channel, time);
if (channel && time) {
// Discord sends null for last_pin_timestamp if the last pinned message was removed
channel.lastPinTimestamp = time.getTime() || null;
client.emit(Events.CHANNEL_PINS_UPDATE, channel, time);
}
}
}