SquadJS/plugins/auto-tk-warn/index.js
2020-06-13 15:33:44 +01:00

18 lines
534 B
JavaScript

import { LOG_PARSER_TEAMKILL } from 'squad-server/events/log-parser';
export default async function(server, options = {}) {
if (!server)
throw new Error(
'DiscordAdminCamLogs must be provided with a reference to the server.'
);
server.on(LOG_PARSER_TEAMKILL, info => {
// ignore suicides
if (info.attacker.steamID === info.victim.steamID) return;
server.rcon.execute(
`AdminWarn "${info.attacker.steamID}" ${options.message ||
'Please apologise for ALL TKs in ALL chat!'}`
);
});
}