Skip to content

Commit 5fc580c

Browse files
committed
games: Only allow ugoexternal if UGO is active
1 parent 9262a03 commit 5fc580c

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/ps/commands/games/other.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { parseMod } from '@/ps/games/mods';
55
import { checkWord } from '@/ps/games/scrabble/checker';
66
import { ScrabbleMods } from '@/ps/games/scrabble/constants';
77
import { ScrabbleModData } from '@/ps/games/scrabble/mods';
8+
import { isUGOActive } from '@/ps/ugo';
89
import { CHAIN_REACTION_META } from '@/ps/ugo/constants';
910
import { toId } from '@/tools';
1011
import { ChatError } from '@/utils/chatError';
@@ -112,6 +113,7 @@ export const command: PSCommand[] = [
112113
perms: message => message.author.id === 'partprofessor',
113114
categories: ['game'],
114115
async run({ arg, message }) {
116+
if (!isUGOActive()) throw new ChatError("UGO isn't active!" as ToTranslate);
115117
const players = arg.split(',');
116118
const winner = players[0];
117119

src/ps/games/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { usePersistedCache } from '@/cache/persisted';
2+
import { isUGOActive } from '@/ps/ugo';
23

34
import type { CommonGame } from '@/ps/games/game';
45
import type { Meta } from '@/ps/games/types';
@@ -24,5 +25,6 @@ export function createGrid<T>(x: number, y: number, fill: (x: number, y: number)
2425
export function checkUGO(
2526
game: CommonGame
2627
): game is CommonGame & { meta: Meta & { id: UGOBoardGames; ugo: NonNullable<Meta['ugo']> } } {
28+
if (isUGOActive()) return false;
2729
return game.roomid === 'boardgames' && !!game.meta.ugo;
2830
}

src/ps/ugo/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TimeZone } from '@/ps/handlers/cron/constants';
44
import { UGO_2025_END, UGO_2025_START } from '@/ps/ugo/constants';
55
import { instantInRange } from '@/utils/timeInRange';
66

7-
export function isActive(): boolean {
7+
export function isUGOActive(): boolean {
88
const now = Temporal.Now.zonedDateTimeISO(TimeZone.GMT);
99
return instantInRange(now, [UGO_2025_START, UGO_2025_END]);
1010
}

0 commit comments

Comments
 (0)