Cockatrice/webclient/src/websocket/commands/moderator/getBanHistory.ts
2026-04-14 14:39:46 -05:00

14 lines
673 B
TypeScript

import { create } from '@bufbuild/protobuf';
import webClient from '../../WebClient';
import { Command_GetBanHistory_ext, Command_GetBanHistorySchema } from 'generated/proto/moderator_commands_pb';
import { ModeratorPersistence } from '../../persistence';
import { Response_BanHistory_ext } from 'generated/proto/response_ban_history_pb';
export function getBanHistory(userName: string): void {
webClient.protobuf.sendModeratorCommand(Command_GetBanHistory_ext, create(Command_GetBanHistorySchema, { userName }), {
responseExt: Response_BanHistory_ext,
onSuccess: (response) => {
ModeratorPersistence.banHistory(userName, response.banList);
},
});
}