From 00a771556b16863a9d186f10682c0b6d0afdb4ee Mon Sep 17 00:00:00 2001 From: Senryoku Date: Tue, 26 Nov 2024 00:16:55 +0100 Subject: [PATCH] Random tweaks --- src/Session.ts | 8 ++++++-- src/Session/SessionProps.ts | 1 + src/draftQueue/DraftQueue.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Session.ts b/src/Session.ts index f82f8072a..2c72b63e0 100644 --- a/src/Session.ts +++ b/src/Session.ts @@ -174,10 +174,14 @@ export class Session implements IIndexable { lastTakeOverRequest: number = 0; - constructor(id: SessionID, owner: UserID | undefined, options: Options = {}) { + constructor( + id: SessionID, + owner: UserID | undefined, + options: { managed?: boolean } & Record = {} + ) { this.id = id; this.owner = owner; - if (!owner) this.managed = true; + if (options.managed) this.managed = options.managed; // Validate and set session settings for (const p in options) diff --git a/src/Session/SessionProps.ts b/src/Session/SessionProps.ts index 518303e3d..918a979d5 100644 --- a/src/Session/SessionProps.ts +++ b/src/Session/SessionProps.ts @@ -71,6 +71,7 @@ export const SessionsSettingsProps: { [propName: string]: (val: unknown) => bool }, useCustomCardList: isBoolean, customCardListWithReplacement: isBoolean, + customCardListDuplicateProtection: isBoolean, customCardList: isObject, distributionMode(val: unknown): val is DistributionMode { if (!isString(val)) return false; diff --git a/src/draftQueue/DraftQueue.ts b/src/draftQueue/DraftQueue.ts index 82422c845..d3a8ae582 100644 --- a/src/draftQueue/DraftQueue.ts +++ b/src/draftQueue/DraftQueue.ts @@ -125,7 +125,7 @@ function launchSession(queueDescription: QueueDescription, users: UserID[], botC let sessionID = `DraftQueue-${queueDescription.setCode.toUpperCase()}-${uuidv4()}`; while (sessionID in Sessions) sessionID = `DraftQueue-${queueDescription.setCode.toUpperCase()}-${uuidv4()}`; - const session = new Session(sessionID, undefined); + const session = new Session(sessionID, undefined, { managed: true }); if (queueDescription.settings) { if (queueDescription.settings.pickedCardsPerRound)