use more generic function for time conversions

This commit is contained in:
MathMan05 2024-09-03 11:17:06 -05:00
parent 0fc51f0e71
commit 4c4f7f8619
4 changed files with 10 additions and 8 deletions

View file

@ -3,6 +3,7 @@ import { Channel } from "./channel.js";
import { Message } from "./message.js";
import { User } from "./user.js";
import { Permissions } from "./permissions.js";
import { SnowFlake } from "./snowflake.js";
class Direct extends Guild {
constructor(json, owner) {
super(-1, owner, null);
@ -95,7 +96,7 @@ class Group extends Channel {
this.mentions = 0;
this.setUpInfiniteScroller();
if (this.lastmessageid) {
this.position = Number((BigInt(this.lastmessageid) >> 22n) + 1420070400000n);
this.position = SnowFlake.stringToUnixTime(this.lastmessageid);
}
this.position = -Math.max(this.position, this.getUnixTime());
}