Cockatrice/webclient/src/websocket/commands/admin/adjustMod.ts
Zach H c4bf9eb61c
Cleanup (#5057)
* Add Types

* Add Types
2024-06-17 00:32:36 -04:00

26 lines
871 B
TypeScript

import webClient from '../../WebClient';
import { AdminPersistence } from '../../persistence';
export function adjustMod(userName: string, shouldBeMod?: boolean, shouldBeJudge?: boolean): void {
const command = webClient.protobuf.controller.Command_AdjustMod.create({ userName, shouldBeMod, shouldBeJudge });
const sc = webClient.protobuf.controller.AdminCommand.create({ '.Command_AdjustMod.ext': command });
webClient.protobuf.sendAdminCommand(sc, (raw) => {
const { responseCode } = raw;
let error: string;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
AdminPersistence.adjustMod(userName, shouldBeMod, shouldBeJudge);
return;
default:
error = 'Failed to reload config.';
break;
}
if (error) {
console.error(responseCode, error);
}
});
}