diff --git a/ebs/src/modules/transactions.ts b/ebs/src/modules/transactions.ts index 70c930c..565d697 100644 --- a/ebs/src/modules/transactions.ts +++ b/ebs/src/modules/transactions.ts @@ -7,9 +7,9 @@ import { addFulfilledTransaction, deletePrepurchase, getPrepurchase, isReceiptUs import { sendToLogger } from "../util/logger"; import { connection } from "./game"; import { TwitchUser } from "./game/messages"; -import { getHelixUser } from "../util/twitch"; import { asyncCatch } from "../util/middleware"; import { sendShock } from "../util/pishock"; +import { getTwitchUser } from "./twitch"; app.post( "/public/prepurchase", @@ -287,18 +287,6 @@ app.post( }) ); -async function getTwitchUser(id: string): Promise { - const user = await getHelixUser(id); - if (!user) { - return null; - } - return { - id: user.id, - displayName: user.displayName, - login: user.name, - }; -} - function validateArgs(config: Config, cart: Cart, logContext: LogMessage): string | undefined { const redeem = config.redeems![cart.id]; diff --git a/ebs/src/modules/twitch.ts b/ebs/src/modules/twitch.ts index 1dd63a5..1643881 100644 --- a/ebs/src/modules/twitch.ts +++ b/ebs/src/modules/twitch.ts @@ -1,7 +1,20 @@ import { app } from ".."; import { asyncCatch } from "../util/middleware"; import { getHelixUser } from "../util/twitch"; +import { TwitchUser } from "./game/messages"; app.get("/private/user/:id", asyncCatch(async (req, res) => { - res.json(await getHelixUser(req.params["id"])); + res.json(await getTwitchUser(req.params["id"])); })); + +export async function getTwitchUser(id: string): Promise { + const user = await getHelixUser(id); + if (!user) { + return null; + } + return { + id: user.id, + displayName: user.displayName, + login: user.name, + }; +} \ No newline at end of file