|
1 | | -import { addUGOPoints, getAllUGOPoints, getUGOPlayed, setUGOPlayed } from '@/cache/ugo'; |
| 1 | +import { addUGOPoints, getUGOPlayed, setUGOPlayed } from '@/cache/ugo'; |
2 | 2 | import { getScrabbleDex } from '@/database/games'; |
| 3 | +import { IS_ENABLED } from '@/enabled'; |
3 | 4 | import { Board } from '@/ps/commands/points'; |
4 | 5 | import { Games } from '@/ps/games'; |
5 | 6 | import { parseMod } from '@/ps/games/mods'; |
@@ -97,11 +98,25 @@ export const command: PSCommand[] = [ |
97 | 98 | }, |
98 | 99 | { |
99 | 100 | name: 'scrabbledex', |
100 | | - help: "Shows a user's current Scrabble Dex for UGO.", |
| 101 | + help: "Shows a user's current ScrabbleDex for UGO.", |
101 | 102 | syntax: 'CMD [user?]', |
102 | 103 | flags: { allowPMs: true }, |
103 | 104 | 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 | + }, |
104 | 118 | async run({ message, broadcastHTML, arg, $T }) { |
| 119 | + if (!IS_ENABLED.DB) throw new ChatError($T('DISABLED.DB')); |
105 | 120 | const target = toId(arg) || message.author.id; |
106 | 121 | const allEntries = await getScrabbleDex(); |
107 | 122 | const results = allEntries!.filter(entry => entry.by === target); |
|
0 commit comments