Skip to content

Commit

Permalink
Random tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Senryoku committed Nov 25, 2024
1 parent f7cd277 commit 00a7715
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<keyof typeof SessionsSettingsProps, unknown> = {}
) {
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)
Expand Down
1 change: 1 addition & 0 deletions src/Session/SessionProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/draftQueue/DraftQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 00a7715

Please sign in to comment.