SquadJS/plugins/auto-tk-warn/index.js
2020-05-21 22:04:16 +01:00

16 lines
513 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!'}`);
});
}