2023-04-27 07:19:04 -05:00
|
|
|
import DiscordBasePlugin from './discord-base-plugin.js';
|
|
|
|
|
|
|
|
export default class DiscordCheater extends DiscordBasePlugin {
|
|
|
|
static get description() {
|
|
|
|
return 'The <code>DiscordCheater</code> plugin will send any suspected cheating to a Discord channel.';
|
|
|
|
}
|
|
|
|
|
|
|
|
static get defaultEnabled() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static get optionsSpecification() {
|
|
|
|
return {
|
|
|
|
...DiscordBasePlugin.optionsSpecification,
|
|
|
|
channelID: {
|
|
|
|
required: true,
|
|
|
|
description: 'The ID of the channel to log admin broadcasts to.',
|
|
|
|
default: '',
|
|
|
|
example: '667741905228136459'
|
|
|
|
},
|
|
|
|
color: {
|
|
|
|
required: false,
|
|
|
|
description: 'The color of the embed.',
|
2023-05-11 11:33:07 -05:00
|
|
|
default: 0xff0000
|
2023-04-27 07:19:04 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor(server, options, connectors) {
|
|
|
|
super(server, options, connectors);
|
|
|
|
|
|
|
|
this.cheat = this.cheat.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
async mount() {
|
|
|
|
this.server.on('PLAYER-CHEAT', this.cheat);
|
|
|
|
}
|
|
|
|
|
|
|
|
async unmount() {
|
|
|
|
this.server.removeEventListener('PLAYER-CHEAT', this.cheat);
|
|
|
|
}
|
|
|
|
|
|
|
|
async cheat(info) {
|
|
|
|
await this.sendDiscordMessage({
|
|
|
|
embed: {
|
|
|
|
title: 'Suspected Cheater',
|
2023-05-11 11:33:07 -05:00
|
|
|
color: info.probcolor ? info.probcolor : this.options.color,
|
2023-04-27 07:19:04 -05:00
|
|
|
fields: [
|
|
|
|
{
|
|
|
|
name: 'Player Name',
|
|
|
|
value: info.player ? info.player.name : 'Unkown Name',
|
|
|
|
inline: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'SteamID',
|
|
|
|
value: info.player
|
|
|
|
? `[${info.player.steamID}](https://steamcommunity.com/profiles/${info.player.steamID})`
|
|
|
|
: 'Unkown steamID',
|
|
|
|
inline: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Player Raw ID (give to Skillet)',
|
|
|
|
value: info.rawID ? info.rawID : 'Unknown ID'
|
|
|
|
},
|
2023-05-09 21:06:07 -05:00
|
|
|
{
|
|
|
|
name: 'raw log string (give to Skillet)',
|
|
|
|
value: info.raw ? info.raw : 'Unkown'
|
2023-05-09 21:38:24 -05:00
|
|
|
},
|
2023-04-27 07:19:04 -05:00
|
|
|
{
|
|
|
|
name: 'Type of Cheating',
|
|
|
|
value: info.cheatType
|
2023-05-11 11:33:07 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Probibility of cheating',
|
|
|
|
value: info.probcheat ? info.probcheat : 'high',
|
|
|
|
inline: true
|
2023-04-27 07:19:04 -05:00
|
|
|
}
|
|
|
|
],
|
2023-05-09 21:06:07 -05:00
|
|
|
timestamp: info.time ? info.time.toISOString() : 'Unkown'
|
2023-04-27 07:19:04 -05:00
|
|
|
}
|
|
|
|
});
|
2023-07-27 22:47:39 -05:00
|
|
|
if(info.probcheat==='high'){
|
|
|
|
this.server.rcon.kick(info.player.steamID, 'R14 | Cheating - highly suspected');
|
|
|
|
}
|
2023-04-27 07:19:04 -05:00
|
|
|
}
|
|
|
|
}
|