|
1 | 1 | import { Temporal } from '@js-temporal/polyfill'; |
2 | 2 |
|
3 | | -import { PSPointsNonce, PSRoomConfigs } from '@/cache'; |
| 3 | +import { PSCommands, PSPointsNonce, PSRoomConfigs } from '@/cache'; |
4 | 4 | import { prefix } from '@/config/ps'; |
5 | 5 | import { bulkAddPoints } from '@/database/points'; |
6 | 6 | import { ANNOUNCEMENTS_CHANNEL, ROLES } from '@/discord/constants/servers/petmods'; |
7 | 7 | import { getChannel } from '@/discord/loaders/channels'; |
8 | 8 | import { IS_ENABLED } from '@/enabled'; |
| 9 | +import { i18n } from '@/i18n'; |
9 | 10 | import { TimeZone } from '@/ps/handlers/cron/constants'; |
10 | 11 | import getSecretFunction from '@/secrets/functions'; |
11 | 12 | import { toId } from '@/tools'; |
12 | 13 | import { Form } from '@/utils/components/ps'; |
13 | 14 | import { Logger } from '@/utils/logger'; |
14 | 15 | import { randomString } from '@/utils/random'; |
15 | 16 |
|
| 17 | +import type { PSCommandContext } from '@/types/chat'; |
| 18 | +import type { RecursivePartial } from '@/types/common'; |
| 19 | +import type { PSMessage } from '@/types/ps'; |
16 | 20 | import type { Client } from 'ps-client'; |
17 | 21 |
|
18 | 22 | export type BracketNode = { |
@@ -131,8 +135,23 @@ export function tourHandler(this: Client, roomId: string, line: string, isIntro? |
131 | 135 | ]) |
132 | 136 | ), |
133 | 137 | roomId |
134 | | - ).then(() => { |
135 | | - // TODO: Run leaderboard |
| 138 | + ).then(async res => { |
| 139 | + if (!res) return; |
| 140 | + const lbCommand = PSCommands.leaderboard; |
| 141 | + const partialMessage: RecursivePartial<PSMessage> = { |
| 142 | + type: 'chat', |
| 143 | + target: room, |
| 144 | + parent: this, |
| 145 | + }; |
| 146 | + const $T = i18n(); // TODO: Use language pref |
| 147 | + const partialContext: Partial<PSCommandContext> = { |
| 148 | + args: [], |
| 149 | + message: partialMessage as PSMessage, |
| 150 | + broadcastHTML: room.sendHTML.bind(room), |
| 151 | + $T, |
| 152 | + }; |
| 153 | + |
| 154 | + lbCommand.run(partialContext as PSCommandContext); |
136 | 155 | }); |
137 | 156 | } |
138 | 157 | if (roomId === 'capproject') { |
|
0 commit comments