2020-05-18 13:40:47 -05:00
|
|
|
import { LOG_PARSER_TEAMKILL } from 'squad-server/events/log-parser';
|
|
|
|
|
2020-06-13 09:33:44 -05:00
|
|
|
export default async function(server, options = {}) {
|
2020-05-18 13:40:47 -05:00
|
|
|
if (!server)
|
|
|
|
throw new Error(
|
|
|
|
'DiscordAdminCamLogs must be provided with a reference to the server.'
|
|
|
|
);
|
|
|
|
|
|
|
|
server.on(LOG_PARSER_TEAMKILL, info => {
|
|
|
|
// ignore suicides
|
2020-06-13 09:33:44 -05:00
|
|
|
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!'}`
|
|
|
|
);
|
2020-05-18 13:40:47 -05:00
|
|
|
});
|
|
|
|
}
|