From 7f581d89dbf8b2b69209ad3be46955bccd4129eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksander=20Wilczy=C5=84ski?= Date: Fri, 2 Aug 2024 12:56:13 +0200 Subject: [PATCH] Upload files to "src/modules" --- src/modules/stations.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/modules/stations.ts diff --git a/src/modules/stations.ts b/src/modules/stations.ts new file mode 100644 index 0000000..945ca12 --- /dev/null +++ b/src/modules/stations.ts @@ -0,0 +1,26 @@ +import { MLog } from '../mongo/logs.js'; +import { IPlayer } from '../types/player.js'; +import { IStation } from '../types/station.js'; +import { SimrailClientEvents } from '../util/SimrailClient.js'; +import { v4 } from 'uuid'; + +export class StationsModule { + public static load() { + + client.on(SimrailClientEvents.StationLeft, (station: IStation, player: IPlayer, joinedAt: number) => { + const date = new Date(); + + MLog.create({ + id: v4(), + userSteamId: player.steamid, + userAvatar: player.avatarfull, + userUsername: player.personaname, + joinedDate: joinedAt, + leftDate: date.getTime(), + stationName: station.Name, + stationShort: station.Prefix, + server: 'pl2' + }); + }) + } +} \ No newline at end of file