18 lines
715 B
JavaScript
18 lines
715 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.fetchMatchFromShareCode = fetchMatchFromShareCode;
|
|
const csgo_sharecode_1 = require("csgo-sharecode");
|
|
async function fetchMatchFromShareCode(shareCode, session) {
|
|
const { csgo } = session;
|
|
const decoded = (0, csgo_sharecode_1.decodeMatchShareCode)(shareCode);
|
|
return new Promise((resolve, reject) => {
|
|
csgo.once('matchList', (matches) => {
|
|
const match = matches.find((m) => m.matchid === decoded.matchId.toString());
|
|
if (!match)
|
|
return reject(new Error('❌ Kein Match gefunden'));
|
|
resolve(match);
|
|
});
|
|
csgo.requestGame(shareCode);
|
|
});
|
|
}
|