Skip to content

Commit

Permalink
fix timestamp stuff + remove engines.pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed May 1, 2024
1 parent 4730365 commit b66ca5e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions aurora/commands/subscribe.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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,
EmbedBuilder, Colors,
PermissionFlagsBits, ChannelType,
} from "discord.js"

const FieldValue = admin.firestore.FieldValue
const ManageMsgs = PermissionFlagsBits.ManageMessages

export default {
Expand All @@ -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!")
Expand Down
5 changes: 2 additions & 3 deletions aurora/slashcommands/subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down Expand Up @@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions bot/utils/fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bot/utils/linking.ts
Original file line number Diff line number Diff line change
@@ -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
}
}

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b66ca5e

Please sign in to comment.