Skip to content

Commit 33f23e3

Browse files
committed
games: Add scrabbledex top
1 parent a5a2aef commit 33f23e3

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

src/ps/commands/games/other.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { addUGOPoints, getAllUGOPoints, getUGOPlayed, setUGOPlayed } from '@/cache/ugo';
1+
import { addUGOPoints, getUGOPlayed, setUGOPlayed } from '@/cache/ugo';
22
import { getScrabbleDex } from '@/database/games';
3+
import { IS_ENABLED } from '@/enabled';
34
import { Board } from '@/ps/commands/points';
45
import { Games } from '@/ps/games';
56
import { parseMod } from '@/ps/games/mods';
@@ -97,11 +98,25 @@ export const command: PSCommand[] = [
9798
},
9899
{
99100
name: 'scrabbledex',
100-
help: "Shows a user's current Scrabble Dex for UGO.",
101+
help: "Shows a user's current ScrabbleDex for UGO.",
101102
syntax: 'CMD [user?]',
102103
flags: { allowPMs: true },
103104
categories: ['game'],
105+
children: {
106+
leaderboard: {
107+
name: 'leaderboard',
108+
help: 'Shows the current ScrabbleDex leaderboard for UGO.',
109+
syntax: 'CMD',
110+
aliases: ['board', 'lb', 'top'],
111+
async run({ message, $T }) {
112+
if (!IS_ENABLED.DB) throw new ChatError($T('DISABLED.DB'));
113+
const entries = await getScrabbleDex();
114+
message.author.pageHTML(renderScrabbleDexLeaderboard(entries!, $T), { name: 'scrabbledex' });
115+
},
116+
},
117+
},
104118
async run({ message, broadcastHTML, arg, $T }) {
119+
if (!IS_ENABLED.DB) throw new ChatError($T('DISABLED.DB'));
105120
const target = toId(arg) || message.author.id;
106121
const allEntries = await getScrabbleDex();
107122
const results = allEntries!.filter(entry => entry.by === target);

0 commit comments

Comments
 (0)