Skip to content

Commit 7a365aa

Browse files
committed
tours: Remove time checks for CAP; they want prompts for all tours
1 parent 4ecb9af commit 7a365aa

1 file changed

Lines changed: 33 additions & 40 deletions

File tree

src/ps/handlers/tours.tsx

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -188,51 +188,44 @@ export function tourHandler(this: Client, roomId: string, line: string, isIntro?
188188
}
189189

190190
case 'capproject': {
191-
const currentTime = Temporal.Now.instant().toZonedDateTimeISO(TimeZone.AST).toPlainTime();
191+
if (json.generator !== 'Single Elimination') return;
192192

193-
if (
194-
inRange(currentTime, [new Temporal.PlainTime(11), new Temporal.PlainTime(13)]) ||
195-
inRange(currentTime, [new Temporal.PlainTime(23), new Temporal.PlainTime(1)])
196-
) {
197-
if (json.generator !== 'Single Elimination') return;
198-
199-
const winners = getTopFour();
200-
const pointsToAdd: Record<string, number> = {};
201-
202-
[3, 2, 1, 1].forEach((amt, index) => {
203-
if (winners[index]) {
204-
pointsToAdd[winners[index]] = amt;
205-
}
206-
});
193+
const winners = getTopFour();
194+
const pointsToAdd: Record<string, number> = {};
207195

208-
const pointsType = PSRoomConfigs[roomId]?.points?.types.tournight;
209-
if (!pointsType) {
210-
room.send("Hi for some reason Tour Nights don't exist, someone go poke PartMan");
211-
Logger.errorLog(new Error(`CAP room points: ${JSON.stringify(PSRoomConfigs[roomId])}`));
212-
return;
196+
[3, 2, 1, 1].forEach((amt, index) => {
197+
if (winners[index]) {
198+
pointsToAdd[winners[index]] = amt;
213199
}
200+
});
214201

215-
const nonce = randomString();
216-
PSPointsNonce[nonce] = labelPoints(pointsToAdd, pointsType.id);
217-
218-
room.sendHTML(
219-
<div className="infobox">
220-
<p>
221-
<b>{pointsType.plural}</b>
222-
{': '}
223-
{Object.entries(pointsToAdd)
224-
.map(([user, amount]) => `+${amount} ${user}`)
225-
.join(', ')}
226-
</p>
227-
<p>
228-
<Form value={`/botmsg ${this.status.username},${prefix}@${roomId} addnonce ${nonce}`}>
229-
<button>Add Points!</button>
230-
</Form>
231-
</p>
232-
</div>,
233-
{ rank: '%' }
234-
);
202+
const pointsType = PSRoomConfigs[roomId]?.points?.types.tournight;
203+
if (!pointsType) {
204+
room.send("Hi for some reason Tour Nights don't exist, someone go poke PartMan");
205+
Logger.errorLog(new Error(`CAP room points: ${JSON.stringify(PSRoomConfigs[roomId])}`));
206+
return;
235207
}
208+
209+
const nonce = randomString();
210+
PSPointsNonce[nonce] = labelPoints(pointsToAdd, pointsType.id);
211+
212+
room.sendHTML(
213+
<div className="infobox">
214+
<p>
215+
<b>{pointsType.plural}</b>
216+
{': '}
217+
{Object.entries(pointsToAdd)
218+
.map(([user, amount]) => `+${amount} ${user}`)
219+
.join(', ')}
220+
</p>
221+
<p>
222+
<Form value={`/botmsg ${this.status.username},${prefix}@${roomId} addnonce ${nonce}`}>
223+
<button>Add Points!</button>
224+
</Form>
225+
</p>
226+
</div>,
227+
{ rank: '%' }
228+
);
236229
break;
237230
}
238231

0 commit comments

Comments
 (0)