Skip to content

Commit 793f623

Browse files
committed
tours: Broadcast LB when adding points for Hindi
1 parent 6639d46 commit 793f623

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/ps/handlers/tours.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import { Temporal } from '@js-temporal/polyfill';
22

3-
import { PSPointsNonce, PSRoomConfigs } from '@/cache';
3+
import { PSCommands, PSPointsNonce, PSRoomConfigs } from '@/cache';
44
import { prefix } from '@/config/ps';
55
import { bulkAddPoints } from '@/database/points';
66
import { ANNOUNCEMENTS_CHANNEL, ROLES } from '@/discord/constants/servers/petmods';
77
import { getChannel } from '@/discord/loaders/channels';
88
import { IS_ENABLED } from '@/enabled';
9+
import { i18n } from '@/i18n';
910
import { TimeZone } from '@/ps/handlers/cron/constants';
1011
import getSecretFunction from '@/secrets/functions';
1112
import { toId } from '@/tools';
1213
import { Form } from '@/utils/components/ps';
1314
import { Logger } from '@/utils/logger';
1415
import { randomString } from '@/utils/random';
1516

17+
import type { PSCommandContext } from '@/types/chat';
18+
import type { RecursivePartial } from '@/types/common';
19+
import type { PSMessage } from '@/types/ps';
1620
import type { Client } from 'ps-client';
1721

1822
export type BracketNode = {
@@ -131,8 +135,23 @@ export function tourHandler(this: Client, roomId: string, line: string, isIntro?
131135
])
132136
),
133137
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);
136155
});
137156
}
138157
if (roomId === 'capproject') {

0 commit comments

Comments
 (0)