3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Use SnowflakeUtil.deconstruct

This commit is contained in:
almeidx 2021-07-29 13:14:45 +01:00
parent afab564628
commit 71cc3176f6
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664

View file

@ -1,10 +1,6 @@
import moment from "moment";
const EPOCH = 1420070400000;
import { Snowflake, SnowflakeUtil } from "discord.js";
export function idToTimestamp(id: string) {
if (typeof id === "number") return null;
return moment(+id / 4194304 + EPOCH)
.utc()
.valueOf();
return SnowflakeUtil.deconstruct(id as Snowflake).timestamp;
}