From b66ca5eaed769c5e456c7f8e434261298aee0d15 Mon Sep 17 00:00:00 2001 From: O3H Date: Wed, 1 May 2024 15:44:49 +0100 Subject: [PATCH] fix timestamp stuff + remove engines.pnpm --- aurora/commands/subscribe.ts | 6 +++--- aurora/slashcommands/subscribe.ts | 5 ++--- bot/utils/fn.ts | 6 +++--- bot/utils/linking.ts | 6 +++--- package.json | 3 +-- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/aurora/commands/subscribe.ts b/aurora/commands/subscribe.ts index 2e708d67..1d7b6ec1 100644 --- a/aurora/commands/subscribe.ts +++ b/aurora/commands/subscribe.ts @@ -1,6 +1,7 @@ import * as fn from '../../bot/utils/fn.js' -import admin from 'firebase-admin' +import { getFirestore, FieldValue } from 'firebase-admin/firestore' + import { type Client, type Message, @@ -8,7 +9,6 @@ import { PermissionFlagsBits, ChannelType, } from "discord.js" -const FieldValue = admin.firestore.FieldValue const ManageMsgs = PermissionFlagsBits.ManageMessages export default { @@ -35,7 +35,7 @@ export default { } const channelID = message.channel.id - const db = admin.firestore() + const db = getFirestore() const subscriptionSuccess = new EmbedBuilder() .setTitle("Subscription Success!") diff --git a/aurora/slashcommands/subscribe.ts b/aurora/slashcommands/subscribe.ts index c36667a5..533c35eb 100644 --- a/aurora/slashcommands/subscribe.ts +++ b/aurora/slashcommands/subscribe.ts @@ -8,8 +8,7 @@ import { import * as fn from '../../bot/utils/fn.js' -import admin from 'firebase-admin' -const FieldValue = admin.firestore.FieldValue +import { getFirestore, FieldValue } from 'firebase-admin/firestore' const subscriptionSuccess = new EmbedBuilder() .setTitle("Subscription Success!") @@ -53,7 +52,7 @@ export default { const channelID = channel.id const memberID = member.id - const db = admin.firestore() + const db = getFirestore() switch (subCmd.toLowerCase()) { case "queue": { diff --git a/bot/utils/fn.ts b/bot/utils/fn.ts index ed9ed356..6cc817a0 100644 --- a/bot/utils/fn.ts +++ b/bot/utils/fn.ts @@ -13,7 +13,7 @@ import { } from "discord.js" import moment from "moment" -import { firestore } from "firebase-admin" +import { Timestamp } from "firebase-admin/firestore" import fs from 'fs' import { request } from "undici" @@ -107,10 +107,10 @@ const devsFooter = (client: Client) => ({ iconURL: client.user.avatarURL() }) -function unixFromDate(date: Date | firestore.Timestamp): number { +function unixFromDate(date: Date | Timestamp): number { let result: Date = null - if (date instanceof firestore.Timestamp) result = new Date(date["seconds"] * 1000) + if (date instanceof Timestamp) result = new Date(date["seconds"] * 1000) else if (date instanceof Date) result = date return result ? moment.utc(result).unix() : null diff --git a/bot/utils/linking.ts b/bot/utils/linking.ts index 3d2471b9..0e274420 100644 --- a/bot/utils/linking.ts +++ b/bot/utils/linking.ts @@ -1,14 +1,14 @@ import { setPlayers, getPlayers} from "./database.js" import { Players } from "./minecraft.js" -import { firestore } from "firebase-admin" +import { Timestamp } from "firebase-admin/firestore" type ResidentProfile = { name: string linkedID: string | number lastOnline: { - nova: Date | firestore.Timestamp - aurora: Date | firestore.Timestamp + nova: Date | Timestamp + aurora: Date | Timestamp } } diff --git a/package.json b/package.json index 88b84caa..1dd7aacd 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ "deploy": "pm2 deploy production" }, "engines": { - "node": ">=16.20.2", - "pnpm": ">=8.6" + "node": ">=16.20.2" }, "devDependencies": { "@types/node": "^20.8.6",