mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 19:45:11 +00:00
fix: um
This commit is contained in:
parent
792a9491ed
commit
0c95405d4c
2 changed files with 12 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ import { EncryptedJsonDb } from "../modules/encrypted-db";
|
|||
import { sendSchedule } from "../modules/robotics";
|
||||
import { potatoGame } from "../modules/randomResponseSystem";
|
||||
import { getMessageCount } from "../modules/howWasYourDay";
|
||||
import { getTextVersionOfData } from "../modules/flightly";
|
||||
const clean = async (text) => {
|
||||
// If our input is a promise, await it before continuing
|
||||
if (text && text.constructor?.name == "Promise") text = await text;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import dayjs from "dayjs";
|
||||
import ms from "ms";
|
||||
export interface FlightData {
|
||||
flight: Flight;
|
||||
flightPosition: FlightPosition[];
|
||||
|
|
@ -161,8 +163,14 @@ export function getFlightData(flightId: string): Promise<Flight> {
|
|||
export async function getTextVersionOfData(flightId: string) {
|
||||
const flightD = await getFlightData(flightId);
|
||||
return `
|
||||
${flightD.airline.name} ${flightD.flight_number} on ${new Date(flightD.arrival.schedule.gate.actual).toISOString().split("T")[0]}
|
||||
${flightD.departure.airport.city} to ${flightD.arrival.actual_airport.city}
|
||||
[todo]
|
||||
${flightD.airline.name} ${flightD.flight_number} on ${new Date(flightD.arrival.schedule.gate.estimated * 1000).toISOString().split('T')[0]}
|
||||
${flightD.departure.airport.city} to ${flightD.arrival.actual_airport.city}
|
||||
funny arrow here: ${dayjs(flightD.departure.schedule.runway.estimated * 1000).format("h:mm A Z")} UTC
|
||||
not so funny arrow here: ${dayjs(flightD.arrival.schedule.runway.estimated * 1000).format("h:mm A Z")} UTC
|
||||
|
||||
Flight length: ${ms(1000*Math.abs(flightD.departure.schedule.runway.estimated - flightD.arrival.schedule.runway.estimated))}
|
||||
|
||||
Arriving at Terminal ${0} - Gate ${flightD.arrival.gate} at ${dayjs(flightD.arrival.schedule.runway.estimated * 1000).format("h:mm A Z")} UTC
|
||||
Updates: https://live.flighty.app/${flightD.id}
|
||||
`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue